diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java index b00d76e3f2ac9f..eb13620ea90d86 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java @@ -628,7 +628,7 @@ private void registerStarlarkAction( TargetUtils.getFilteredExecutionInfo( executionRequirementsUnchecked, ruleContext.getRule(), - starlarkSemantics.incompatibleAllowTagsPropagation()); + starlarkSemantics.experimentalAllowTagsPropagation()); builder.setExecutionInfo(executionInfo); if (inputManifestsUnchecked != Runtime.NONE) { diff --git a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java index 74d9280112f968..9ae2b3de2d52b7 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java +++ b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java @@ -161,19 +161,19 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl public boolean incompatibleBzlDisallowLoadAfterStatement; @Option( - name = "incompatible_allow_tags_propagation", + name = "experimental_allow_tags_propagation", + oldName = "incompatible_allow_tags_propagation", defaultValue = "false", documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS, effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS}, metadataTags = { - OptionMetadataTag.INCOMPATIBLE_CHANGE, - OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES + OptionMetadataTag.EXPERIMENTAL, }, help = "If set to true, tags will be propagated from a target to the actions' execution" + " requirements; otherwise tags are not propagated. See" + " https://github.com/bazelbuild/bazel/issues/8830 for details.") - public boolean incompatibleAllowTagsPropagation; + public boolean experimentalAllowTagsPropagation; @Option( name = "incompatible_depset_union", @@ -655,6 +655,7 @@ public StarlarkSemantics toSkylarkSemantics() { // <== Add new options here in alphabetic order ==> .experimentalAllowIncrementalRepositoryUpdates( experimentalAllowIncrementalRepositoryUpdates) + .experimentalAllowTagsPropagation(experimentalAllowTagsPropagation) .experimentalBuildSettingApi(experimentalBuildSettingApi) .experimentalCcSkylarkApiEnabledPackages(experimentalCcSkylarkApiEnabledPackages) .experimentalEnableAndroidMigrationApis(experimentalEnableAndroidMigrationApis) @@ -700,7 +701,6 @@ public StarlarkSemantics toSkylarkSemantics() { .incompatibleRestrictStringEscapes(incompatibleRestrictStringEscapes) .incompatibleDisallowDictLookupUnhashableKeys( incompatibleDisallowDictLookupUnhashableKeys) - .incompatibleAllowTagsPropagation(incompatibleAllowTagsPropagation) .incompatibleDisallowHashingFrozenMutables(incompatibleDisallowHashingFrozenMutables) .build(); return INTERNER.intern(semantics); diff --git a/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java b/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java index 3ab123a4eaa8eb..6bf7e95f57d87e 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java +++ b/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java @@ -243,12 +243,12 @@ public static Map getExecutionInfo(Rule rule) { * {@code SkylarkDict} type, null or {@link * com.google.devtools.build.lib.syntax.Runtime#NONE} * @param rule a rule instance to get tags from - * @param incompatibleAllowTagsPropagation if set to true, tags will be propagated from a target + * @param allowTagsPropagation if set to true, tags will be propagated from a target * to the actions' execution requirements, for more details {@see - * SkylarkSematicOptions#incompatibleAllowTagsPropagation} + * SkylarkSematicOptions#experimentalAllowTagsPropagation} */ public static ImmutableMap getFilteredExecutionInfo( - Object executionRequirementsUnchecked, Rule rule, boolean incompatibleAllowTagsPropagation) + Object executionRequirementsUnchecked, Rule rule, boolean allowTagsPropagation) throws EvalException { Map checkedExecutionRequirements = TargetUtils.filter( @@ -262,7 +262,7 @@ public static ImmutableMap getFilteredExecutionInfo( // adding filtered execution requirements to the execution info map executionInfoBuilder.putAll(checkedExecutionRequirements); - if (incompatibleAllowTagsPropagation) { + if (allowTagsPropagation) { Map checkedTags = getExecutionInfo(rule); // merging filtered tags to the execution info map avoiding duplicates checkedTags.forEach(executionInfoBuilder::putIfAbsent); diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java index fad687daa8e2be..f57a4e4701d102 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java @@ -60,7 +60,7 @@ public enum FlagIdentifier { INCOMPATIBLE_OBJC_FRAMEWORK_CLEANUP(StarlarkSemantics::incompatibleObjcFrameworkCleanup), INCOMPATIBLE_DISALLOW_RULE_EXECUTION_PLATFORM_CONSTRAINTS_ALLOWED( StarlarkSemantics::incompatibleDisallowRuleExecutionPlatformConstraintsAllowed), - INCOMPATIBLE_ALLOW_TAGS_PROPAGATION(StarlarkSemantics::incompatibleAllowTagsPropagation), + INCOMPATIBLE_ALLOW_TAGS_PROPAGATION(StarlarkSemantics::experimentalAllowTagsPropagation), NONE(null); // Using a Function here makes the enum definitions far cleaner, and, since this is @@ -207,7 +207,7 @@ public boolean flagValue(FlagIdentifier flagIdentifier) { public abstract boolean incompatibleDisallowDictLookupUnhashableKeys(); - public abstract boolean incompatibleAllowTagsPropagation(); + public abstract boolean experimentalAllowTagsPropagation(); public abstract boolean incompatibleDisallowHashingFrozenMutables(); @@ -244,6 +244,7 @@ public static Builder builderWithDefaults() { public static final StarlarkSemantics DEFAULT_SEMANTICS = builder() // <== Add new options here in alphabetic order ==> + .experimentalAllowTagsPropagation(false) .experimentalBuildSettingApi(true) .experimentalCcSkylarkApiEnabledPackages(ImmutableList.of()) .experimentalAllowIncrementalRepositoryUpdates(true) @@ -286,7 +287,6 @@ public static Builder builderWithDefaults() { .incompatibleDepsetForLibrariesToLinkGetter(true) .incompatibleRestrictStringEscapes(false) .incompatibleDisallowDictLookupUnhashableKeys(false) - .incompatibleAllowTagsPropagation(false) .incompatibleDisallowHashingFrozenMutables(false) .build(); @@ -311,7 +311,7 @@ public abstract static class Builder { public abstract Builder experimentalStarlarkUnusedInputsList(boolean value); - public abstract Builder incompatibleAllowTagsPropagation(boolean value); + public abstract Builder experimentalAllowTagsPropagation(boolean value); public abstract Builder incompatibleBzlDisallowLoadAfterStatement(boolean value); diff --git a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java index c41d770813f6f4..06d256ad6b9b9c 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java @@ -183,7 +183,7 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) { .experimentalPlatformsApi(rand.nextBoolean()) .experimentalStarlarkConfigTransitions(rand.nextBoolean()) .experimentalStarlarkUnusedInputsList(rand.nextBoolean()) - .incompatibleAllowTagsPropagation(rand.nextBoolean()) + .experimentalAllowTagsPropagation(rand.nextBoolean()) .incompatibleBzlDisallowLoadAfterStatement(rand.nextBoolean()) .incompatibleDepsetForLibrariesToLinkGetter(rand.nextBoolean()) .incompatibleDepsetIsNotIterable(rand.nextBoolean())