Skip to content

Commit

Permalink
Rename Factory-level ExecutionTransitionFactory.create to createFactory
Browse files Browse the repository at this point in the history
This also provides better consistency with other TransitionFactory that only use `create` to return Transition.

PiperOrigin-RevId: 520458312
Change-Id: Icc0a2e208a2777ab34651fbd7c46f9974dad87ae
  • Loading branch information
Googler authored and copybara-github committed Mar 29, 2023
1 parent 57426bc commit f7829f8
Show file tree
Hide file tree
Showing 46 changed files with 220 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private Allowlist() {}
public static Attribute.Builder<Label> getAttributeFromAllowlistName(String allowlistName) {
String attributeName = getAttributeNameFromAllowlistName(allowlistName).iterator().next();
return attr(attributeName, LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.mandatoryProviders(PackageGroupConfiguredTarget.PROVIDER.id());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,31 +215,31 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
// Input files for every test action
.add(
attr("$test_wrapper", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:test_wrapper")))
.add(
attr("$xml_writer", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:xml_writer")))
.add(
attr("$test_runtime", LABEL_LIST)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(getTestRuntimeLabelList(env)))
.add(
attr("$test_setup_script", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:test_setup")))
.add(
attr("$xml_generator_script", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:test_xml_generator")))
.add(
attr("$collect_coverage_script", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:collect_coverage")))
// Input files for test actions collecting code coverage
Expand All @@ -250,7 +250,7 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
// Used in the one-per-build coverage report generation action.
.add(
attr(":coverage_report_generator", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(
coverageReportGeneratorAttribute(
env.getToolsLabel(DEFAULT_COVERAGE_REPORT_GENERATOR_VALUE))))
Expand Down Expand Up @@ -313,7 +313,7 @@ public static RuleClass.Builder commonCoreAndStarlarkAttributes(RuleClass.Builde
.add(
attr("visibility", NODEP_LABEL_LIST)
.orderIndependent()
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.nonconfigurable(
"special attribute integrated more deeply into Bazel's core logic"))
.add(
Expand Down Expand Up @@ -348,20 +348,20 @@ public static RuleClass.Builder commonCoreAndStarlarkAttributes(RuleClass.Builde
.add(attr("features", STRING_LIST).orderIndependent())
.add(
attr(":action_listener", LABEL_LIST)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(ACTION_LISTENER))
.add(
attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST)
.allowedRuleClasses(ConstraintConstants.ENVIRONMENT_RULE)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.allowedFileTypes(FileTypeSet.NO_FILE)
.dontCheckConstraints()
.nonconfigurable(
"special logic for constraints and select: see ConstraintSemantics"))
.add(
attr(RuleClass.RESTRICTED_ENVIRONMENT_ATTR, LABEL_LIST)
.allowedRuleClasses(ConstraintConstants.ENVIRONMENT_RULE)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.allowedFileTypes(FileTypeSet.NO_FILE)
.dontCheckConstraints()
.nonconfigurable(
Expand All @@ -371,7 +371,7 @@ public static RuleClass.Builder commonCoreAndStarlarkAttributes(RuleClass.Builde
.nonconfigurable("stores configurability keys"))
.add(
attr(RuleClass.APPLICABLE_LICENSES_ATTR, LABEL_LIST)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.allowedFileTypes(FileTypeSet.NO_FILE)
// TODO(b/148601291): Require provider to be "LicenseInfo".
.dontCheckConstraints()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public class ExecutionTransitionFactory
* Returns a new {@link ExecutionTransitionFactory} for the default {@link
* com.google.devtools.build.lib.packages.ExecGroup}.
*/
public static ExecutionTransitionFactory create() {
public static ExecutionTransitionFactory createFactory() {
return new ExecutionTransitionFactory(DEFAULT_EXEC_GROUP_NAME);
}

/**
* Returns a new {@link ExecutionTransitionFactory} for the given {@link
* com.google.devtools.build.lib.packages.ExecGroup}.
*/
public static ExecutionTransitionFactory create(String execGroup) {
public static ExecutionTransitionFactory createFactory(String execGroup) {
return new ExecutionTransitionFactory(execGroup);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ && containsNonNoneKey(arguments, ALLOW_SINGLE_FILE_ARG)) {
"'cfg = \"host\"' is deprecated and should no longer be used. Please use "
+ "'cfg = \"exec\"' instead.");
}
builder.cfg(ExecutionTransitionFactory.create());
builder.cfg(ExecutionTransitionFactory.createFactory());
} else if (trans.equals("exec")) {
builder.cfg(ExecutionTransitionFactory.create());
builder.cfg(ExecutionTransitionFactory.createFactory());
} else if (trans instanceof ExecutionTransitionFactory) {
builder.cfg((ExecutionTransitionFactory) trans);
} else if (trans instanceof SplitTransition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public BuildSetting stringListSetting(Boolean flag, Boolean repeatable) throws E
@Override
public ExecutionTransitionFactory exec(Object execGroupUnchecked) {
return execGroupUnchecked == Starlark.NONE
? ExecutionTransitionFactory.create()
: ExecutionTransitionFactory.create((String) execGroupUnchecked);
? ExecutionTransitionFactory.createFactory()
: ExecutionTransitionFactory.createFactory((String) execGroupUnchecked);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,47 +195,47 @@ public static RuleClass getTestBaseRule(RuleDefinitionEnvironment env) {
// Input files for every test action
.add(
attr("$test_wrapper", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(labelCache.get(toolsRepository + "//tools/test:test_wrapper")))
.add(
attr("$xml_writer", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(labelCache.get(toolsRepository + "//tools/test:xml_writer")))
.add(
attr("$test_runtime", LABEL_LIST)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
// Getting this default value through the getTestRuntimeLabelList helper ensures
// we reuse the same ImmutableList<Label> instance for each $test_runtime attr.
.value(getTestRuntimeLabelList(env)))
.add(
attr("$test_setup_script", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(labelCache.get(toolsRepository + "//tools/test:test_setup")))
.add(
attr("$xml_generator_script", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(labelCache.get(toolsRepository + "//tools/test:test_xml_generator")))
.add(
attr("$collect_coverage_script", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(labelCache.get(toolsRepository + "//tools/test:collect_coverage")))
// Input files for test actions collecting code coverage
.add(
attr(":coverage_support", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(
BaseRuleClasses.coverageSupportAttribute(
labelCache.get(
toolsRepository + BaseRuleClasses.DEFAULT_COVERAGE_SUPPORT_VALUE))))
// Used in the one-per-build coverage report generation action.
.add(
attr(":coverage_report_generator", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(
BaseRuleClasses.coverageReportGeneratorAttribute(
labelCache.get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment envi
.removeAttribute(":java_launcher") // Input files for test actions collecting code coverage
.add(
attr(":lcov_merger", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(BaseRuleClasses.getCoverageOutputGeneratorLabel()))
.cfg(
new ConfigFeatureFlagTransitionFactory(AndroidFeatureFlagSetProvider.FEATURE_FLAG_ATTR))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
.override(attr("stamp", TRISTATE).value(TriState.NO))
.add(
attr(":lcov_merger", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(BaseRuleClasses.getCoverageOutputGeneratorLabel()))
.add(
attr("$collect_cc_coverage", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:collect_cc_coverage")))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <li> DYNAMIC, in which all libraries are linked dynamically (if a dynamic versio
.add(attr("linkstatic", BOOLEAN).value(true))
.add(
attr("$def_parser", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(
new Attribute.ComputedDefault() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
.setOutputToGenfiles()
.add(
attr("$genrule_setup", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(env.getToolsLabel(GENRULE_SETUP_LABEL)))

// TODO(bazel-team): stamping doesn't seem to work. Fix it or remove attribute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ differs only in places that the JLS forbids compilers to inline (and that must h
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("exported_plugins", LABEL_LIST)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.mandatoryProviders(JavaPluginInfo.PROVIDER.id())
.allowedFileTypes())
.advertiseStarlarkProvider(StarlarkProviderIdentifier.forKey(JavaInfo.PROVIDER.getKey()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ class on the runtime classpath or you specify the <code>runtime_deps</code> argu
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("plugins", LABEL_LIST)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.mandatoryProviders(JavaPluginInfo.PROVIDER.id())
.legacyAllowAnyFileType())
.add(
attr(":java_plugins", LABEL_LIST)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.mandatoryProviders(JavaPluginInfo.PROVIDER.id())
.silentRuleClassFilter()
.value(JavaSemantics.JAVA_PLUGINS))
Expand Down Expand Up @@ -441,7 +441,7 @@ <li>If you are using any other launcher, native (C++) dependencies are staticall
.add(attr(":java_launcher", LABEL).value(JavaSemantics.JAVA_LAUNCHER)) // blaze flag
.add(
attr("$launcher", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(env.getToolsLabel("//tools/launcher:launcher")))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
// Input files for test actions collecting code coverage
.add(
attr(":lcov_merger", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(BaseRuleClasses.getCoverageOutputGeneratorLabel()))
// Add the script as an attribute in order for java_test to output code coverage results for
// code covered by CC binaries invocations.
.add(
attr("$collect_cc_coverage", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:collect_cc_coverage")))
/* <!-- #BLAZE_RULE(java_test).ATTRIBUTE(test_class) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment envi
return builder
.add(
attr("$launcher", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(environment.getToolsLabel("//tools/launcher:launcher")))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment envi
builder
.add(
attr(":lcov_merger", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(BaseRuleClasses.getCoverageOutputGeneratorLabel()))
.add(
attr("$launcher", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.value(environment.getToolsLabel("//tools/launcher:launcher")))
// Add the script as an attribute in order for sh_test to output code coverage results for
// code covered by CC binaries invocations.
.add(
attr("$collect_cc_coverage", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.singleArtifact()
.value(environment.getToolsLabel("//tools/test:collect_cc_coverage")));
return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,32 @@ public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env)
.direct_compile_time_input())
.add(
attr(AAR_EMBEDDED_JARS_EXTACTOR, LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_embedded_jars_extractor")))
.add(
attr(AAR_EMBEDDED_PROGUARD_EXTACTOR, LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_embedded_proguard_extractor")))
.add(
attr(AAR_NATIVE_LIBS_ZIP_CREATOR, LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_native_libs_zip_creator")))
.add(
attr(AAR_RESOURCES_EXTRACTOR, LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_resources_extractor")))
.add(
attr("$import_deps_checker", LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_import_deps_checker")))
.add(
attr(ZIPPER, LABEL)
.cfg(ExecutionTransitionFactory.create())
.cfg(ExecutionTransitionFactory.createFactory())
.exec()
.value(env.getToolsLabel("//tools/zip:zipper")))
.advertiseStarlarkProvider(StarlarkProviderIdentifier.forKey(JavaInfo.PROVIDER.getKey()))
Expand Down
Loading

0 comments on commit f7829f8

Please sign in to comment.