Update all attributes which use the host transition to use the host transition
factory.
This will help ensure that calls to TransitionFactory.isHost will always be
correct.
Part of #7814.
PiperOrigin-RevId: 240977747
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
index 6e59d7e..0660ed5 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
@@ -167,31 +167,31 @@
// Input files for every test action
.add(
attr("$test_wrapper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:test_wrapper")))
.add(
attr("$xml_writer", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:xml_writer")))
.add(
attr("$test_runtime", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(ImmutableList.of(env.getToolsLabel("//tools/test:runtime"))))
.add(
attr("$test_setup_script", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:test_setup")))
.add(
attr("$xml_generator_script", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:test_xml_generator")))
.add(
attr("$collect_coverage_script", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:collect_coverage")))
// Input files for test actions collecting code coverage
@@ -202,7 +202,7 @@
// Used in the one-per-build coverage report generation action.
.add(
attr(":coverage_report_generator", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
coverageReportGeneratorAttribute(
env.getToolsLabel(DEFAULT_COVERAGE_REPORT_GENERATOR_VALUE))))
@@ -240,7 +240,7 @@
.add(
attr("visibility", NODEP_LABEL_LIST)
.orderIndependent()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.nonconfigurable(
"special attribute integrated more deeply into Bazel's core logic"))
.add(
@@ -275,12 +275,12 @@
.add(attr("features", STRING_LIST).orderIndependent())
.add(
attr(":action_listener", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(ACTION_LISTENER))
.add(
attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST)
.allowedRuleClasses(EnvironmentRule.RULE_NAME)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.NO_FILE)
.dontCheckConstraints()
.nonconfigurable(
@@ -288,7 +288,7 @@
.add(
attr(RuleClass.RESTRICTED_ENVIRONMENT_ATTR, LABEL_LIST)
.allowedRuleClasses(EnvironmentRule.RULE_NAME)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.NO_FILE)
.dontCheckConstraints()
.nonconfigurable(
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/Whitelist.java b/src/main/java/com/google/devtools/build/lib/analysis/Whitelist.java
index 122d016..fd1d560 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/Whitelist.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/Whitelist.java
@@ -47,7 +47,7 @@
public static Attribute.Builder<Label> getAttributeFromWhitelistName(String whitelistName) {
String attributeName = getAttributeNameFromWhitelistName(whitelistName);
return attr(attributeName, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.mandatoryNativeProviders(ImmutableList.of(PackageSpecificationProvider.class));
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java
index 89448d6..a0e48b3 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java
@@ -260,7 +260,7 @@
"late-bound attributes must not have a split configuration transition");
}
if (trans.equals("host")) {
- builder.cfg(HostTransition.INSTANCE);
+ builder.cfg(HostTransition.createFactory());
} else if (trans instanceof SplitTransition) {
builder.cfg((SplitTransition) trans);
} else if (trans instanceof TransitionFactory) {
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java
index b4b890c..1c23c1e 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java
@@ -172,40 +172,40 @@
// Input files for every test action
.add(
attr("$test_wrapper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(labelCache.getUnchecked(toolsRepository + "//tools/test:test_wrapper")))
.add(
attr("$xml_writer", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(labelCache.getUnchecked(toolsRepository + "//tools/test:xml_writer")))
.add(
attr("$test_runtime", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
ImmutableList.of(
labelCache.getUnchecked(toolsRepository + "//tools/test:runtime"))))
.add(
attr("$test_setup_script", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(labelCache.getUnchecked(toolsRepository + "//tools/test:test_setup")))
.add(
attr("$xml_generator_script", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(
labelCache.getUnchecked(toolsRepository + "//tools/test:test_xml_generator")))
.add(
attr("$collect_coverage_script", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(labelCache.getUnchecked(toolsRepository + "//tools/test:collect_coverage")))
// Input files for test actions collecting code coverage
.add(
attr(":coverage_support", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
BaseRuleClasses.coverageSupportAttribute(
labelCache.getUnchecked(
@@ -213,7 +213,7 @@
// Used in the one-per-build coverage report generation action.
.add(
attr(":coverage_report_generator", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
BaseRuleClasses.coverageReportGeneratorAttribute(
labelCache.getUnchecked(
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcTestRule.java
index 79ca7ac..a200c6d 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcTestRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcTestRule.java
@@ -52,7 +52,7 @@
"@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main")))
.add(
attr("$collect_cc_coverage", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/test:collect_cc_coverage")))
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
index 638ec19..f2d0fba 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
@@ -361,7 +361,7 @@
.add(attr("linkstatic", BOOLEAN).value(true))
.add(
attr("$def_parser", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(
new Attribute.ComputedDefault() {
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java
index f7adfd3..ebe7e94 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java
@@ -44,7 +44,7 @@
.setOutputToGenfiles()
.add(
attr("$genrule_setup", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel(GENRULE_SETUP_LABEL)))
// TODO(bazel-team): stamping doesn't seem to work. Fix it or remove attribute.
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaLibraryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaLibraryRule.java
index 710978a..4948fe1 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaLibraryRule.java
@@ -150,7 +150,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("exported_plugins", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedRuleClasses("java_plugin")
.allowedFileTypes())
.advertiseSkylarkProvider(SkylarkProviderIdentifier.forKey(JavaInfo.PROVIDER.getKey()))
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java
index a3cdff2..39659ba 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaRuleClasses.java
@@ -239,12 +239,12 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("plugins", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedRuleClasses("java_plugin")
.legacyAllowAnyFileType())
.add(
attr(":java_plugins", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedRuleClasses("java_plugin")
.silentRuleClassFilter()
.value(JavaSemantics.JAVA_PLUGINS))
@@ -443,7 +443,7 @@
env.getToolsLabel("//tools/jdk:no_launcher"))))
.add(
attr("$launcher", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/launcher:launcher")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java
index af0a9e8..793b827 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java
@@ -58,7 +58,7 @@
// Primarily this is intended to help test changes to Proguard.
.add(
attr(":proguard", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(JavaSemantics.PROGUARD)
.exec())
.add(attr(":extra_proguard_specs", LABEL_LIST).value(JavaSemantics.EXTRA_PROGUARD_SPECS))
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyBinaryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyBinaryRule.java
index cfa10dd..7359117 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyBinaryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyBinaryRule.java
@@ -44,13 +44,13 @@
.cfg(PyRuleClasses.VERSION_TRANSITION)
.add(
attr("$zipper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/zip:zipper")))
.addRequiredToolchains(CppRuleClasses.ccToolchainTypeAttribute(env))
.add(
attr("$launcher", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/launcher:launcher")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java
index 3909369..8caf6bf 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyRuleClasses.java
@@ -134,7 +134,7 @@
// 2to3 is itself written in Python and depends on many libraries.
.add(
attr("$python2to3", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/python:2to3")))
.setPreferredDependencyPredicate(PyRuleClasses.PYTHON_SOURCE)
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyTestRule.java
index 4c07e5a06..6317a4a 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyTestRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPyTestRule.java
@@ -42,7 +42,7 @@
.cfg(PyRuleClasses.VERSION_TRANSITION)
.add(
attr("$zipper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/zip:zipper")))
.override(
@@ -57,7 +57,7 @@
.addRequiredToolchains(CppRuleClasses.ccToolchainTypeAttribute(env))
.add(
attr("$launcher", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/launcher:launcher")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShBinaryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShBinaryRule.java
index eade8fc..153b695 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShBinaryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShBinaryRule.java
@@ -32,7 +32,7 @@
return builder
.add(
attr("$launcher", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(environment.getToolsLabel("//tools/launcher:launcher")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java
index ef5a9a0..6548ccd 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShTestRule.java
@@ -40,13 +40,13 @@
"@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main")))
.add(
attr("$launcher", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.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(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(environment.getToolsLabel("//tools/test:collect_cc_coverage")));
return builder.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java
index 6a3fd50..90eb552 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java
@@ -55,27 +55,27 @@
.validityPredicate(ANY_EDGE))
.add(
attr(AAR_EMBEDDED_JARS_EXTACTOR, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_embedded_jars_extractor")))
.add(
attr(AAR_NATIVE_LIBS_ZIP_CREATOR, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_native_libs_zip_creator")))
.add(
attr(AAR_RESOURCES_EXTRACTOR, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_resources_extractor")))
.add(
attr("$import_deps_checker", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:aar_import_deps_checker")))
.add(
attr(ZIPPER, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/zip:zipper")))
.advertiseSkylarkProvider(SkylarkProviderIdentifier.forKey(JavaInfo.PROVIDER.getKey()))
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceRule.java
index 5f94fc0..1daefdf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceRule.java
@@ -95,9 +95,10 @@
a specific device). The properties in this file will override read only
properties typically set by the emulator such as ro.product.model.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("default_properties", LABEL)
- .cfg(HostTransition.INSTANCE)
- .allowedFileTypes(JavaSemantics.PROPERTIES))
+ .add(
+ attr("default_properties", LABEL)
+ .cfg(HostTransition.createFactory())
+ .allowedFileTypes(JavaSemantics.PROPERTIES))
/* <!-- #BLAZE_RULE(android_device).ATTRIBUTE(platform_apks) -->
A list of apks to be installed on the device at boot time.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
@@ -107,53 +108,54 @@
.add(attr("pregenerate_oat_files_for_tests", BOOLEAN).value(false))
.add(
attr("$adb_static", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android:adb_static")))
- .add(attr("$adb", LABEL)
- .cfg(HostTransition.INSTANCE)
- .value(env.getToolsLabel("//tools/android:adb")))
+ .add(
+ attr("$adb", LABEL)
+ .cfg(HostTransition.createFactory())
+ .value(env.getToolsLabel("//tools/android:adb")))
.add(
attr("$emulator_arm", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android/emulator:emulator_arm")))
.add(
attr("$emulator_x86", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android/emulator:emulator_x86")))
.add(
attr("$emulator_x86_bios", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android/emulator:emulator_x86_bios")))
.add(
attr("$mksd", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android/emulator:mksd")))
.add(
attr("$empty_snapshot_fs", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android/emulator:empty_snapshot_fs")))
.add(
attr("$xvfb_support", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android/emulator:xvfb_support")))
.add(
attr("$unified_launcher", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android/emulator:unified_launcher")))
.add(
attr("$android_runtest", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:android_runtest")))
.add(
attr("$testing_shbase", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android/emulator:shbase")))
.add(
attr("$sdk_path", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android/emulator:sdk_path")))
.add(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java
index 04de0b7..1231faa 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java
@@ -31,11 +31,12 @@
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
return builder
.setUndocumented()
- .add(attr("executable", LABEL)
- .exec()
- .cfg(HostTransition.INSTANCE)
- .mandatory()
- .allowedFileTypes())
+ .add(
+ attr("executable", LABEL)
+ .exec()
+ .cfg(HostTransition.createFactory())
+ .mandatory()
+ .allowedFileTypes())
.add(attr("service_names", STRING_LIST))
.add(
attr("support_apks", LABEL_LIST)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestBaseRule.java
index 24c4dd4..d9dac93 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestBaseRule.java
@@ -52,7 +52,7 @@
attr("target_device", LABEL)
.mandatory()
.exec()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.NO_FILE)
.mandatoryProviders(
SkylarkProviderIdentifier.forKey(AndroidDeviceBrokerInfo.PROVIDER.getKey())))
@@ -72,7 +72,7 @@
.add(
attr("$test_entry_point", LABEL)
.exec()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
environment.getToolsLabel("//tools/android:instrumentation_test_entry_point")))
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
index 98b9f6d..dada320 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java
@@ -93,7 +93,7 @@
.add(
attr("exports", LABEL_LIST)
.allowedRuleClasses(AndroidRuleClasses.ALLOWED_DEPENDENCIES)
- .allowedFileTypes(/*May not have files in exports!*/)
+ .allowedFileTypes(/*May not have files in exports!*/ )
.mandatoryProviders(JavaRuleClasses.CONTAINS_JAVA_PROVIDER)
.aspect(androidNeverlinkAspect))
/* <!-- #BLAZE_RULE(android_library).ATTRIBUTE(exports_manifest) -->
@@ -112,7 +112,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("exported_plugins", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedRuleClasses("java_plugin")
.allowedFileTypes(FileTypeSet.NO_FILE))
.add(attr("alwayslink", BOOLEAN).undocumented("purely informational for now"))
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java
index f73dddc..c04786f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java
@@ -95,7 +95,7 @@
// rule so they're not defined in multiple places
.add(
attr("$android_resources_busybox", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(environment.getToolsLabel(AndroidRuleClasses.DEFAULT_RESOURCES_BUSYBOX)))
.add(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java
index df9fb65..7b778e6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java
@@ -440,11 +440,11 @@
// processed XML expressions into Java code.
.add(
attr(DataBinding.DATABINDING_ANNOTATION_PROCESSOR_ATTR, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android:databinding_annotation_processor")))
.add(
attr(DataBinding.DATABINDING_EXEC_PROCESSOR_ATTR, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:databinding_exec")))
.advertiseSkylarkProvider(
@@ -483,12 +483,12 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("plugins", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedRuleClasses("java_plugin")
.legacyAllowAnyFileType())
.add(
attr(":java_plugins", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedRuleClasses("java_plugin")
.silentRuleClassFilter()
.value(JavaSemantics.JAVA_PLUGINS))
@@ -502,16 +502,16 @@
.add(attr("javacopts", STRING_LIST))
.add(
attr("$idlclass", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:IdlClass")))
.add(
attr("$desugar_java8_extra_bootclasspath", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/android:desugar_java8_extra_bootclasspath")))
.add(
attr("$android_resources_busybox", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel(DEFAULT_RESOURCES_BUSYBOX)))
.build();
@@ -590,7 +590,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("debug_key", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.legacyAllowAnyFileType()
.value(env.getToolsLabel("//tools/android:debug_keystore")))
.add(
@@ -652,57 +652,57 @@
.add(attr(ResourceFilterFactory.DENSITIES_NAME, STRING_LIST))
.add(
attr("$build_incremental_dexmanifest", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel(BUILD_INCREMENTAL_DEXMANIFEST_LABEL)))
.add(
attr("$stubify_manifest", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel(STUBIFY_MANIFEST_LABEL)))
.add(
attr("$shuffle_jars", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:shuffle_jars")))
.add(
attr("$dexbuilder", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:dexbuilder")))
.add(
attr("$dexbuilder_after_proguard", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:dexbuilder_after_proguard")))
.add(
attr("$dexsharder", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:dexsharder")))
.add(
attr("$dexmerger", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:dexmerger")))
.add(
attr("$merge_dexzips", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:merge_dexzips")))
.add(
attr("$incremental_install", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel(INCREMENTAL_INSTALL_LABEL)))
.add(
attr("$build_split_manifest", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel(BUILD_SPLIT_MANIFEST_LABEL)))
.add(
attr("$strip_resources", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel(STRIP_RESOURCES_LABEL)))
.add(
@@ -715,7 +715,7 @@
.aspect(dexArchiveAspect, DexArchiveAspect.ONLY_DESUGAR_JAVA8))
.add(
attr("$desugar", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:desugar_java8")))
.add(
@@ -723,7 +723,7 @@
.value(env.getToolsLabel("//tools/android:java8_legacy_dex")))
.add(
attr("$build_java8_legacy_dex", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:build_java8_legacy_dex")))
.add(
@@ -831,12 +831,12 @@
.add(attr(":extra_proguard_specs", LABEL_LIST).value(JavaSemantics.EXTRA_PROGUARD_SPECS))
.add(
attr("$dex_list_obfuscator", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:dex_list_obfuscator")))
.add(
attr(":bytecode_optimizers", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(JavaSemantics.BYTECODE_OPTIMIZERS))
// We need the C++ toolchain for every sub-configuration to get the correct linker.
.add(
@@ -882,7 +882,7 @@
// deploy jar so that they can be added to the APK.
.add(
attr("$resource_extractor", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:resource_extractor")))
/* <!-- #BLAZE_RULE(android_binary).ATTRIBUTE(instruments) -->
@@ -898,7 +898,7 @@
.allowedFileTypes(NO_FILE))
.add(
attr("$instrumentation_test_check", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
new Attribute.ComputedDefault() {
@Override
@@ -911,7 +911,7 @@
.exec())
.add(
attr("$zip_filter", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/android:zip_filter")))
.removeAttribute("data")
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkBaseRule.java
index 46fb4bd..d766723 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSdkBaseRule.java
@@ -40,7 +40,7 @@
// This is the Proguard that comes from the --proguard_top attribute.
.add(
attr(":proguard", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(JavaSemantics.PROGUARD)
.exec())
// This is the Proguard in the BUILD file that contains the android_sdk rule. Used when
@@ -48,82 +48,89 @@
.add(
attr("proguard", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.add(
attr("aapt", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
- .add(attr("aapt2", LABEL).cfg(HostTransition.INSTANCE).allowedFileTypes(ANY_FILE).exec())
+ .add(
+ attr("aapt2", LABEL)
+ .cfg(HostTransition.createFactory())
+ .allowedFileTypes(ANY_FILE)
+ .exec())
.add(
attr("dx", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.add(
attr("main_dex_list_creator", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.add(
attr("adb", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.add(
attr("framework_aidl", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE))
.add(
attr("aidl", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.add(attr("aidl_lib", LABEL).allowedFileTypes(JavaSemantics.JAR))
.add(
attr("android_jar", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(JavaSemantics.JAR))
// TODO(b/67903726): Make this attribute mandatory after updating all android_sdk rules.
.add(
attr("source_properties", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE))
.add(
attr("shrinked_android_jar", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE))
- .add(attr("annotations_jar", LABEL).cfg(HostTransition.INSTANCE).allowedFileTypes(ANY_FILE))
+ .add(
+ attr("annotations_jar", LABEL)
+ .cfg(HostTransition.createFactory())
+ .allowedFileTypes(ANY_FILE))
.add(
attr("main_dex_classes", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE))
.add(
attr("apkbuilder", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.add(
attr("apksigner", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.add(
attr("zipalign", LABEL)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(ANY_FILE)
.exec())
.advertiseSkylarkProvider(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
index 1b0bf7d..f9f36ad 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
@@ -146,7 +146,7 @@
// Parse labels since we don't have RuleDefinitionEnvironment.getLabel like in a rule
.add(
attr(ASPECT_DESUGAR_PREREQ, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(
Label.parseAbsoluteUnchecked(
@@ -167,7 +167,7 @@
// Marginally improves "query2" precision for targets that disable incremental dexing
result.add(
attr(ASPECT_DEXBUILDER_PREREQ, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(Label.parseAbsoluteUnchecked(toolsRepository + "//tools/android:dexbuilder")));
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcHostToolchainAliasRule.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcHostToolchainAliasRule.java
index 7134678..bc737b7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcHostToolchainAliasRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcHostToolchainAliasRule.java
@@ -33,6 +33,6 @@
@Override
protected Attribute.Builder<Label> makeAttribute(RuleDefinitionEnvironment environment) {
Attribute.Builder<Label> builder = super.makeAttribute(environment);
- return builder.cfg(HostTransition.INSTANCE);
+ return builder.cfg(HostTransition.createFactory());
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainRule.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainRule.java
index fa4d571..6e6bdfe 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainRule.java
@@ -161,7 +161,7 @@
.add(
attr("all_files", LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.mandatory())
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(compiler_files) -->
Collection of all cc_toolchain artifacts required for compile actions.
@@ -173,7 +173,7 @@
.add(
attr("compiler_files", LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.mandatory())
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(compiler_files_without_includes) -->
Collection of all cc_toolchain artifacts required for compile actions in case when
@@ -182,14 +182,14 @@
.add(
attr("compiler_files_without_includes", LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE))
+ .cfg(HostTransition.createFactory()))
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(strip_files) -->
Collection of all cc_toolchain artifacts required for strip actions.
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(
attr("strip_files", LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.mandatory())
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(objcopy_files) -->
Collection of all cc_toolchain artifacts required for objcopy actions.
@@ -197,20 +197,20 @@
.add(
attr("objcopy_files", LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.mandatory())
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(as_files) -->
Currently unused (<a href="https://github.com/bazelbuild/bazel/issues/6928">#6928</a>).
<p>Collection of all cc_toolchain artifacts required for assembly actions.</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("as_files", LABEL).legacyAllowAnyFileType().cfg(HostTransition.INSTANCE))
+ .add(attr("as_files", LABEL).legacyAllowAnyFileType().cfg(HostTransition.createFactory()))
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(as_files) -->
Currently unused (<a href="https://github.com/bazelbuild/bazel/issues/6928">#6928</a>).
<p>Collection of all cc_toolchain artifacts required for archiving actions.</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("ar_files", LABEL).legacyAllowAnyFileType().cfg(HostTransition.INSTANCE))
+ .add(attr("ar_files", LABEL).legacyAllowAnyFileType().cfg(HostTransition.createFactory()))
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(linker_files) -->
Collection of all cc_toolchain artifacts required for linking actions.
@@ -220,7 +220,7 @@
.add(
attr("linker_files", LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.mandatory())
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(dwp_files) -->
Collection of all cc_toolchain artifacts required for dwp actions.
@@ -228,13 +228,16 @@
.add(
attr("dwp_files", LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.mandatory())
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(coverage_files) -->
Collection of all cc_toolchain artifacts required for coverage actions. If not specified,
all_files are used.
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("coverage_files", LABEL).legacyAllowAnyFileType().cfg(HostTransition.INSTANCE))
+ .add(
+ attr("coverage_files", LABEL)
+ .legacyAllowAnyFileType()
+ .cfg(HostTransition.createFactory()))
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(static_runtime_lib) -->
Static library artifact for the C++ runtime library (e.g. libstdc++.a).
@@ -252,7 +255,7 @@
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(module_map) -->
Module map artifact to be used for modular builds.
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("module_map", LABEL).legacyAllowAnyFileType().cfg(HostTransition.INSTANCE))
+ .add(attr("module_map", LABEL).legacyAllowAnyFileType().cfg(HostTransition.createFactory()))
/* <!-- #BLAZE_RULE(cc_toolchain).ATTRIBUTE(supports_param_files) -->
Set to True when cc_toolchain supports using param files for linking actions.
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
@@ -263,12 +266,12 @@
.add(attr("supports_header_parsing", BOOLEAN).value(false))
.add(
attr("$interface_library_builder", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/cpp:interface_library_builder")))
.add(
attr("$link_dynamic_library_tool", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/cpp:link_dynamic_library")))
.add(
@@ -276,7 +279,7 @@
.value(CppRuleClasses.ccToolchainTypeAttribute(env)))
.add(
attr(":zipper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(
LabelLateBoundDefault.fromTargetConfiguration(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
index dd9069e..6686bff 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
@@ -404,7 +404,7 @@
return builder
.add(
attr("$grep_includes", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/cpp:grep-includes")))
.build();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionRule.java b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionRule.java
index 227a52a..8915890 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionRule.java
@@ -56,59 +56,60 @@
be the root of that unified tree.
</p>
<!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("tools", LABEL_LIST).cfg(HostTransition.INSTANCE).allowedFileTypes().exec())
+ .add(
+ attr("tools", LABEL_LIST).cfg(HostTransition.createFactory()).allowedFileTypes().exec())
/*<!-- #BLAZE_RULE(extra_action).ATTRIBUTE(out_templates) -->
- A list of templates for files generated by the <code>extra_action</code> command.
- <p>
- The template can use the following variables:
- <ul>
- <li>
- $(ACTION_ID), an id uniquely identifying this <code>extra_action</code>.
- Used to generate a unique output file.
- </li>
- </ul>
- </p>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ A list of templates for files generated by the <code>extra_action</code> command.
+ <p>
+ The template can use the following variables:
+ <ul>
+ <li>
+ $(ACTION_ID), an id uniquely identifying this <code>extra_action</code>.
+ Used to generate a unique output file.
+ </li>
+ </ul>
+ </p>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("out_templates", STRING_LIST))
/*<!-- #BLAZE_RULE(extra_action).ATTRIBUTE(cmd) -->
- The command to run.
- <p>
- Like <a href="${link genrule.cmd}">genrule cmd attribute</a> with the following
- differences:
- </p>
- <ol>
- <li>
- <p>
- No heuristic label expansion. Only labels using $(location ...) are expanded.
- </p>
- </li>
- <li>
- <p>
- An additional pass is applied to the string to replace all
- occurrences of the outputs created from the <code>out_templates</code>
- attribute. All occurrences of <code>$(output <i>out_template</i>)</code>
- are replaced with the path to the file denoted by <code>label</code>.
- </p>
- <p>
- E.g. out_template <code>$(ACTION_ID).analysis</code>
- can be matched with <code>$(output $(ACTION_ID).analysis)</code>.
- </p>
- <p>
- In effect, this is the same substitution as <code>$(location)</code>
- but with a different scope.
- </p>
- </li>
- </ol>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ The command to run.
+ <p>
+ Like <a href="${link genrule.cmd}">genrule cmd attribute</a> with the following
+ differences:
+ </p>
+ <ol>
+ <li>
+ <p>
+ No heuristic label expansion. Only labels using $(location ...) are expanded.
+ </p>
+ </li>
+ <li>
+ <p>
+ An additional pass is applied to the string to replace all
+ occurrences of the outputs created from the <code>out_templates</code>
+ attribute. All occurrences of <code>$(output <i>out_template</i>)</code>
+ are replaced with the path to the file denoted by <code>label</code>.
+ </p>
+ <p>
+ E.g. out_template <code>$(ACTION_ID).analysis</code>
+ can be matched with <code>$(output $(ACTION_ID).analysis)</code>.
+ </p>
+ <p>
+ In effect, this is the same substitution as <code>$(location)</code>
+ but with a different scope.
+ </p>
+ </li>
+ </ol>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("cmd", STRING).mandatory())
/*<!-- #BLAZE_RULE(extra_action).ATTRIBUTE(requires_action_output) -->
- Indicates this <code>extra_action</code> requires the output of the
- original action to be present as input to this <code>extra_action</code>.
- <p>
- When true (default false), the extra_action can assume that the
- original action outputs are available as part of its inputs.
- </p>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ Indicates this <code>extra_action</code> requires the output of the
+ original action to be present as input to this <code>extra_action</code>.
+ <p>
+ When true (default false), the extra_action can assume that the
+ original action outputs are available as part of its inputs.
+ </p>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
.add(attr("requires_action_output", BOOLEAN))
.removeAttribute("deps")
.removeAttribute(":action_listener")
diff --git a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java
index 3534938..6a40f84 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleBaseRule.java
@@ -133,7 +133,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("tools", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.ANY_FILE))
/* <!-- #BLAZE_RULE(genrule).ATTRIBUTE(outs) -->
A list of files generated by this rule.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationRule.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationRule.java
index b114ec9..51bc4bf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationRule.java
@@ -40,7 +40,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("packages", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes()
.mandatoryNativeProviders(ImmutableList.of(PackageSpecificationProvider.class)))
/* <!-- #BLAZE_RULE(java_package_configuration).ATTRIBUTE(javacopts) -->
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuleClasses.java
index 5467c8c..9d4fdf3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuleClasses.java
@@ -102,7 +102,7 @@
return builder
.add(
attr(HOST_JAVA_RUNTIME_ATTRIBUTE_NAME, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(JavaSemantics.hostJdkAttribute(env))
.mandatoryProviders(ToolchainInfo.PROVIDER.id()))
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java
index 45cb616..172ca9d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainRule.java
@@ -107,7 +107,7 @@
.add(
attr("javac", LABEL_LIST)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.allowedFileTypes(FileTypeSet.ANY_FILE))
/* <!-- #BLAZE_RULE(java_toolchain).ATTRIBUTE(tools) -->
@@ -115,7 +115,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("tools", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.ANY_FILE))
/* <!-- #BLAZE_RULE(java_toolchain).ATTRIBUTE(javabuilder) -->
Label of the JavaBuilder deploy jar.
@@ -123,7 +123,7 @@
.add(
attr("javabuilder", LABEL_LIST)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
/* <!-- #BLAZE_RULE(java_toolchain).ATTRIBUTE(singlejar) -->
@@ -132,7 +132,7 @@
.add(
attr("singlejar", LABEL_LIST)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
@@ -143,7 +143,7 @@
attr("genclass", LABEL_LIST)
.mandatory()
.singleArtifact()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
/* <!-- #BLAZE_RULE(java_toolchain).ATTRIBUTE(resourcejar) -->
@@ -151,7 +151,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("resourcejar", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
@@ -161,7 +161,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("timezone_data", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
@@ -171,7 +171,7 @@
.add(
attr("ijar", LABEL_LIST)
.mandatory()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
/* <!-- #BLAZE_RULE(java_toolchain).ATTRIBUTE(header_compiler) -->
@@ -179,7 +179,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("header_compiler", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
@@ -191,7 +191,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("header_compiler_direct", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
/* <!-- #BLAZE_RULE(java_toolchain).ATTRIBUTE(oneversion) -->
@@ -199,7 +199,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("oneversion", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
@@ -208,7 +208,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("oneversion_whitelist", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
@@ -226,7 +226,7 @@
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("package_configuration", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes()
.mandatoryNativeProviders(ImmutableList.of(JavaPackageConfigurationProvider.class)))
.build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java
index 04b2979..c6f71a4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/ProguardLibraryRule.java
@@ -44,7 +44,7 @@
.add(attr("proguard_specs", LABEL_LIST).legacyAllowAnyFileType())
.add(
attr("$proguard_whitelister", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(
new Attribute.ComputedDefault() {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java
index a80ba1a..0b01e84 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java
@@ -120,7 +120,7 @@
.value(getProtoToolchainLabel(defaultProtoToolchainLabel)))
.add(
attr(HOST_JAVA_RUNTIME_ATTRIBUTE_NAME, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(hostJdkAttribute)
.mandatoryProviders(ToolchainInfo.PROVIDER.id()))
.add(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java
index f4ebd6b..787ea74 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java
@@ -129,7 +129,7 @@
.value(getSpeedProtoToolchainLabel(defaultSpeedProtoToolchainLabel)))
.add(
attr(HOST_JAVA_RUNTIME_ATTRIBUTE_NAME, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(hostJdkAttribute)
.mandatoryProviders(ToolchainInfo.PROVIDER.id()))
.add(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
index 041b35e..7c097fd 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
@@ -154,7 +154,7 @@
.addRequiredToolchains(ccToolchainType)
.add(
attr("$j2objc", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(
Label.parseAbsoluteUnchecked(
@@ -162,7 +162,7 @@
.add(
attr("$j2objc_wrapper", LABEL)
.allowedFileTypes(FileType.of(".py"))
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.singleArtifact()
.value(
@@ -171,7 +171,7 @@
.add(
attr("$j2objc_header_map", LABEL)
.allowedFileTypes(FileType.of(".py"))
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.singleArtifact()
.value(
@@ -179,11 +179,14 @@
toolsRepository + "//tools/j2objc:j2objc_header_map")))
.add(
attr("$jre_emul_jar", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
Label.parseAbsoluteUnchecked(
toolsRepository + "//third_party/java/j2objc:jre_emul.jar")))
- .add(attr(":dead_code_report", LABEL).cfg(HostTransition.INSTANCE).value(DEAD_CODE_REPORT))
+ .add(
+ attr(":dead_code_report", LABEL)
+ .cfg(HostTransition.createFactory())
+ .value(DEAD_CODE_REPORT))
.add(
attr("$jre_lib", LABEL)
.value(
@@ -191,12 +194,12 @@
toolsRepository + "//third_party/java/j2objc:jre_core_lib")))
.add(
attr("$xcrunwrapper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(Label.parseAbsoluteUnchecked(toolsRepository + "//tools/objc:xcrunwrapper")))
.add(
attr(ObjcRuleClasses.LIBTOOL_ATTRIBUTE, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(Label.parseAbsoluteUnchecked(toolsRepository + "//tools/objc:libtool")))
.add(
@@ -207,7 +210,7 @@
.value(AppleToolchain.getXcodeConfigLabel(toolsRepository)))
.add(
attr("$zipper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(Label.parseAbsoluteUnchecked(toolsRepository + "//tools/zip:zipper")))
.add(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
index 3275eca..15f3d9b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryRule.java
@@ -78,17 +78,17 @@
attr(PORTABLE_PROTO_FILTERS_ATTR, LABEL_LIST)
.legacyAllowAnyFileType()
.allowedRuleClasses("filegroup")
- .cfg(HostTransition.INSTANCE))
+ .cfg(HostTransition.createFactory()))
.add(
attr(PROTO_COMPILER_ATTR, LABEL)
.allowedFileTypes(FileType.of(".py"), FileType.of(".sh"))
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/objc:protobuf_compiler_wrapper")))
.add(
attr(PROTO_COMPILER_SUPPORT_ATTR, LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/objc:protobuf_compiler_support")))
.add(
attr(PROTO_LIB_ATTR, LABEL)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
index b9ced83..3edb128 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
@@ -478,12 +478,21 @@
@Override
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
return builder
- .add(attr("$plmerge", LABEL).cfg(HostTransition.INSTANCE).exec()
- .value(env.getToolsLabel("//tools/objc:plmerge")))
- .add(attr("$actoolwrapper", LABEL).cfg(HostTransition.INSTANCE).exec()
- .value(env.getToolsLabel("//tools/objc:actoolwrapper")))
- .add(attr("$ibtoolwrapper", LABEL).cfg(HostTransition.INSTANCE).exec()
- .value(env.getToolsLabel("//tools/objc:ibtoolwrapper")))
+ .add(
+ attr("$plmerge", LABEL)
+ .cfg(HostTransition.createFactory())
+ .exec()
+ .value(env.getToolsLabel("//tools/objc:plmerge")))
+ .add(
+ attr("$actoolwrapper", LABEL)
+ .cfg(HostTransition.createFactory())
+ .exec()
+ .value(env.getToolsLabel("//tools/objc:actoolwrapper")))
+ .add(
+ attr("$ibtoolwrapper", LABEL)
+ .cfg(HostTransition.createFactory())
+ .exec()
+ .value(env.getToolsLabel("//tools/objc:ibtoolwrapper")))
.build();
}
@Override
@@ -702,7 +711,7 @@
least one artifact this attribute cannot be #exec(). */
.add(
attr(HEADER_SCANNER_ATTRIBUTE, LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(
LabelLateBoundDefault.fromTargetConfiguration(
ObjcConfiguration.class,
@@ -737,8 +746,11 @@
@Override
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
return builder
- .add(attr(LIBTOOL_ATTRIBUTE, LABEL).cfg(HostTransition.INSTANCE).exec()
- .value(env.getToolsLabel("//tools/objc:libtool")))
+ .add(
+ attr(LIBTOOL_ATTRIBUTE, LABEL)
+ .cfg(HostTransition.createFactory())
+ .exec()
+ .value(env.getToolsLabel("//tools/objc:libtool")))
.build();
}
@Override
@@ -811,7 +823,7 @@
.add(
attr("$j2objc_dead_code_pruner", LABEL)
.allowedFileTypes(FileType.of(".py"))
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.singleArtifact()
.value(env.getToolsLabel("//tools/objc:j2objc_dead_code_pruner")))
@@ -819,13 +831,13 @@
.add(
attr(PROTO_COMPILER_ATTR, LABEL)
.allowedFileTypes(FileType.of(".sh"))
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/objc:protobuf_compiler_wrapper")))
.add(
attr(PROTO_COMPILER_SUPPORT_ATTR, LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/objc:protobuf_compiler_support")))
.add(
ProtoSourceFileBlacklist.blacklistFilegroupAttribute(
@@ -962,7 +974,7 @@
.add(
attr("$j2objc_dead_code_pruner", LABEL)
.allowedFileTypes(FileType.of(".py"))
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.singleArtifact()
.value(env.getToolsLabel("//tools/objc:j2objc_dead_code_pruner")))
@@ -970,13 +982,13 @@
.add(
attr(PROTO_COMPILER_ATTR, LABEL)
.allowedFileTypes(FileType.of(".sh"))
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.singleArtifact()
.value(env.getToolsLabel("//tools/objc:protobuf_compiler_wrapper")))
.add(
attr(PROTO_COMPILER_SUPPORT_ATTR, LABEL)
.legacyAllowAnyFileType()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(env.getToolsLabel("//tools/objc:protobuf_compiler_support")))
.add(
ProtoSourceFileBlacklist.blacklistFilegroupAttribute(
@@ -1111,7 +1123,7 @@
.value(ImmutableList.of(TargetDeviceFamily.IPHONE.getNameInRule())))
.add(
attr("$momcwrapper", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(env.getToolsLabel("//tools/objc:momcwrapper")))
.build();
@@ -1138,8 +1150,11 @@
@Override
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) {
return builder
- .add(attr("$xcrunwrapper", LABEL).cfg(HostTransition.INSTANCE).exec()
- .value(env.getToolsLabel("//tools/objc:xcrunwrapper")))
+ .add(
+ attr("$xcrunwrapper", LABEL)
+ .cfg(HostTransition.createFactory())
+ .exec()
+ .value(env.getToolsLabel("//tools/objc:xcrunwrapper")))
.build();
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryRule.java b/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryRule.java
index b706c01..837056f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryRule.java
@@ -52,7 +52,7 @@
.setOutputToGenfiles()
.add(
attr(":proto_compiler", LABEL)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.exec()
.value(PROTO_COMPILER))
/* <!-- #BLAZE_RULE(proto_library).ATTRIBUTE(deps) -->
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainRule.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainRule.java
index 335a4d9..6c64b90 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainRule.java
@@ -52,7 +52,7 @@
passed to the proto-compiler:
<code>--plugin=protoc-gen-PLUGIN=<executable>.</code>
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("plugin", LABEL).exec().cfg(HostTransition.INSTANCE).allowedFileTypes())
+ .add(attr("plugin", LABEL).exec().cfg(HostTransition.createFactory()).allowedFileTypes())
/* <!-- #BLAZE_RULE(proto_lang_toolchain).ATTRIBUTE(runtime) -->
A language-specific library that the generated code is compiled against.
@@ -72,7 +72,6 @@
.allowedFileTypes()
.mandatoryNativeProviders(
ImmutableList.<Class<? extends TransitiveInfoProvider>>of(FileProvider.class)))
-
.advertiseProvider(ProtoLangToolchainProvider.class)
.removeAttribute("data")
.removeAttribute("deps")
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileBlacklist.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileBlacklist.java
index e298392..0824e55 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileBlacklist.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileBlacklist.java
@@ -124,7 +124,7 @@
public static Attribute.Builder<List<Label>> blacklistFilegroupAttribute(
String attributeName, List<Label> blacklistFileGroups) {
return attr(attributeName, LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(blacklistFileGroups);
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
index b0f440a..a26e17f 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
@@ -493,7 +493,7 @@
.aspect(AspectThatRegistersAction.INSTANCE))
.add(
attr(":action_listener", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.value(ACTION_LISTENER)));
public static class AspectThatRegistersAction extends NativeAspectClass
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/test/TestTrimmingTransitionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/test/TestTrimmingTransitionTest.java
index 7ba5f6e..ab7de92 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/test/TestTrimmingTransitionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/test/TestTrimmingTransitionTest.java
@@ -83,7 +83,7 @@
"native_test",
attr("deps", LABEL_LIST).allowedFileTypes(),
attr("host_deps", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes());
private static final RuleDefinition NATIVE_LIB_RULE =
@@ -94,7 +94,7 @@
"native_lib",
attr("deps", LABEL_LIST).allowedFileTypes(),
attr("host_deps", LABEL_LIST)
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.allowedFileTypes());
@Before
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java b/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java
index c38eea0..c2cb9e1 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java
@@ -63,7 +63,7 @@
attr("tags", STRING_LIST).nonconfigurable("test"),
attr("visibility", NODEP_LABEL_LIST)
.orderIndependent()
- .cfg(HostTransition.INSTANCE)
+ .cfg(HostTransition.createFactory())
.nonconfigurable("test"),
attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST)
.allowedFileTypes(FileTypeSet.NO_FILE)
diff --git a/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java b/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java
index 2211e573..b0320d2 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java
@@ -98,10 +98,12 @@
@Test
public void testDoublePropertySet() {
- Attribute.Builder<String> builder = attr("x", STRING).mandatory()
- .cfg(HostTransition.INSTANCE)
- .undocumented("")
- .value("y");
+ Attribute.Builder<String> builder =
+ attr("x", STRING)
+ .mandatory()
+ .cfg(HostTransition.createFactory())
+ .undocumented("")
+ .value("y");
try {
builder.mandatory();
fail();
@@ -109,7 +111,7 @@
// expected
}
try {
- builder.cfg(HostTransition.INSTANCE);
+ builder.cfg(HostTransition.createFactory());
fail();
} catch (IllegalStateException expected) {
// expected
@@ -298,7 +300,8 @@
@Test
public void testHostTransition() throws Exception {
- Attribute attr = attr("foo", LABEL).cfg(HostTransition.INSTANCE).allowedFileTypes().build();
+ Attribute attr =
+ attr("foo", LABEL).cfg(HostTransition.createFactory()).allowedFileTypes().build();
assertThat(attr.hasHostConfigurationTransition()).isTrue();
assertThat(attr.hasSplitConfigurationTransition()).isFalse();
}
diff --git a/src/test/java/com/google/devtools/build/lib/query2/engine/ConfiguredTargetQueryTest.java b/src/test/java/com/google/devtools/build/lib/query2/engine/ConfiguredTargetQueryTest.java
index d8c9ad8..0432f54 100644
--- a/src/test/java/com/google/devtools/build/lib/query2/engine/ConfiguredTargetQueryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/query2/engine/ConfiguredTargetQueryTest.java
@@ -194,7 +194,7 @@
"rule_with_host_dep",
attr("host_dep", LABEL)
.allowedFileTypes(FileTypeSet.ANY_FILE)
- .cfg(HostTransition.INSTANCE),
+ .cfg(HostTransition.createFactory()),
attr("$impl_dep", LABEL)
.allowedFileTypes(FileTypeSet.ANY_FILE)
.value(Label.parseAbsoluteUnchecked("//test:other")));
@@ -269,7 +269,7 @@
attr("target", LABEL).allowedFileTypes(FileTypeSet.ANY_FILE),
attr("host", LABEL)
.allowedFileTypes(FileTypeSet.ANY_FILE)
- .cfg(HostTransition.INSTANCE),
+ .cfg(HostTransition.createFactory()),
attr("deps", BuildType.LABEL_LIST).allowedFileTypes(FileTypeSet.ANY_FILE));
MockRule simpleRule =
() ->