Skip to content

Commit

Permalink
Use exec-transitions in proto rules
Browse files Browse the repository at this point in the history
Closes #12430.

PiperOrigin-RevId: 342026667
  • Loading branch information
Yannic authored and copybara-github committed Nov 12, 2020
1 parent 8fce67f commit 7acf9ea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster",
"//src/main/java/com/google/devtools/build/lib/analysis:config/build_options",
"//src/main/java/com/google/devtools/build/lib/analysis:config/core_option_converters",
"//src/main/java/com/google/devtools/build/lib/analysis:config/execution_transition_factory",
"//src/main/java/com/google/devtools/build/lib/analysis:config/fragment",
"//src/main/java/com/google/devtools/build/lib/analysis:config/fragment_options",
"//src/main/java/com/google/devtools/build/lib/analysis:config/fragment_provider",
"//src/main/java/com/google/devtools/build/lib/analysis:config/host_transition",
"//src/main/java/com/google/devtools/build/lib/analysis:config/invalid_configuration_exception",
"//src/main/java/com/google/devtools/build/lib/analysis:configured_target",
"//src/main/java/com/google/devtools/build/lib/analysis:file_provider",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.analysis.config.HostTransition;
import com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.packages.Attribute;
import com.google.devtools.build.lib.packages.RuleClass;
Expand Down Expand Up @@ -52,7 +52,7 @@ public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironmen
.setOutputToGenfiles()
.add(
attr(":proto_compiler", LABEL)
.cfg(HostTransition.createFactory())
.cfg(ExecutionTransitionFactory.create())
.exec()
.value(PROTO_COMPILER))
/* <!-- #BLAZE_RULE(proto_library).ATTRIBUTE(deps) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.google.devtools.build.lib.analysis.BaseRuleClasses;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.analysis.config.HostTransition;
import com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.StarlarkProviderIdentifier;
import com.google.devtools.build.lib.packages.Type;
Expand Down Expand Up @@ -50,7 +50,11 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment envi
passed to the proto-compiler:
<code>--plugin=protoc-gen-PLUGIN=<executable>.</code>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(attr("plugin", LABEL).exec().cfg(HostTransition.createFactory()).allowedFileTypes())
.add(
attr("plugin", LABEL)
.exec()
.cfg(ExecutionTransitionFactory.create())
.allowedFileTypes())

/* <!-- #BLAZE_RULE(proto_lang_toolchain).ATTRIBUTE(runtime) -->
A language-specific library that the generated code is compiled against.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.google.common.collect.Streams;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.config.HostTransition;
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.packages.Attribute;
Expand Down Expand Up @@ -126,7 +126,7 @@ public boolean isBlacklisted(Artifact protoFile) {
public static Attribute.Builder<List<Label>> blacklistFilegroupAttribute(
String attributeName, List<Label> blacklistFileGroups) {
return attr(attributeName, LABEL_LIST)
.cfg(HostTransition.createFactory())
.cfg(ExecutionTransitionFactory.create())
.value(blacklistFileGroups);
}

Expand Down

0 comments on commit 7acf9ea

Please sign in to comment.