From ad62f2d798930e7702f1237fc5cc4a15d1d778f7 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 19 Aug 2021 09:25:25 +0200 Subject: [PATCH] Fix action conflict on exec transitioned cc_proto_library When the proto rules' depdencies were switched over to the exec config in 7acf9ea3fea4850d21114d84fbc5b663d105d3c7, the dependency of CcProtoAspect on the proto C++ toolchain was not updated. Due to this, cc_proto_library had two dependencies on @com_google_protobuf//:protobuf (through :protoc and directly) with potentially incompatible configurations, which lead to conflicting actions. Fixes #13464. --- .../java/com/google/devtools/build/lib/rules/cpp/proto/BUILD | 1 + .../devtools/build/lib/rules/cpp/proto/CcProtoAspect.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/BUILD b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/BUILD index 5dc0c2ecc8cb08..863ffb92eea47f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/BUILD +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/BUILD @@ -21,6 +21,7 @@ java_library( "//src/main/java/com/google/devtools/build/lib/actions", "//src/main/java/com/google/devtools/build/lib/actions:artifacts", "//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster", + "//src/main/java/com/google/devtools/build/lib/analysis:config/execution_transition_factory", "//src/main/java/com/google/devtools/build/lib/analysis:configured_target", "//src/main/java/com/google/devtools/build/lib/analysis:rule_definition_environment", "//src/main/java/com/google/devtools/build/lib/analysis:transitive_info_collection", diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java index 689d29f2623087..98bd2f527e7b94 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java @@ -33,6 +33,7 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.TransitiveInfoProviderMap; import com.google.devtools.build.lib.analysis.TransitiveInfoProviderMapBuilder; +import com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; @@ -128,6 +129,7 @@ public AspectDefinition getDefinition(AspectParameters aspectParameters) { .add( attr(PROTO_TOOLCHAIN_ATTR, LABEL) .mandatoryBuiltinProviders(ImmutableList.of(ProtoLangToolchainProvider.class)) + .cfg(ExecutionTransitionFactory.create()) .value(PROTO_TOOLCHAIN_LABEL)) .add( attr(CcToolchain.CC_TOOLCHAIN_DEFAULT_ATTRIBUTE_NAME, LABEL)