Skip to content

Commit 54ffea0

Browse files
committed
Delete --incompatible_allow_tags_propagation
This was flipped in bazel 7.0.0
1 parent 6d2f838 commit 54ffea0

File tree

13 files changed

+44
-284
lines changed

13 files changed

+44
-284
lines changed

src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,6 @@ private static ImmutableSet<ConfiguredTargetAndData> getDirectPrerequisites(
283283
.collect(toImmutableSet());
284284
}
285285

286-
public boolean isAllowTagsPropagation() {
287-
return getAnalysisEnvironment()
288-
.getStarlarkSemantics()
289-
.getBool(BuildLanguageOptions.INCOMPATIBLE_ALLOW_TAGS_PROPAGATION);
290-
}
291-
292286
/**
293287
* If this {@code RuleContext} is for rule evaluation, returns the attribute-based prerequisites
294288
* of the rule and if it is for aspect evaluation, it returns the merged prerequisites of the rule

src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -813,10 +813,7 @@ private void registerStarlarkAction(
813813
}
814814

815815
ImmutableMap<String, String> executionInfo =
816-
TargetUtils.getFilteredExecutionInfo(
817-
executionRequirementsUnchecked,
818-
ruleContext.getRule(),
819-
getSemantics().getBool(BuildLanguageOptions.INCOMPATIBLE_ALLOW_TAGS_PROPAGATION));
816+
TargetUtils.getFilteredExecutionInfo(executionRequirementsUnchecked, ruleContext.getRule());
820817
builder.setExecutionInfo(executionInfo);
821818

822819
String execGroup = determineExecGroup(ruleContext, execGroupUnchecked, toolchainUnchecked);
@@ -1061,10 +1058,7 @@ public void mapDirectory(
10611058
.getConfiguration()
10621059
.modifiedExecutionInfo(
10631060
TargetUtils.getFilteredExecutionInfo(
1064-
executionRequirementsUnchecked,
1065-
ruleContext.getRule(),
1066-
getSemantics()
1067-
.getBool(BuildLanguageOptions.INCOMPATIBLE_ALLOW_TAGS_PROPAGATION)),
1061+
executionRequirementsUnchecked, ruleContext.getRule()),
10681062
mnemonic);
10691063

10701064
ActionEnvironment actionEnv =

src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ public static class BuildGraveyardOptions extends OptionsBase {
180180
help = "This option is deprecated and has no effect.")
181181
public String targetPlatformFallback;
182182

183+
@Option(
184+
name = "incompatible_allow_tags_propagation",
185+
oldName = "experimental_allow_tags_propagation",
186+
defaultValue = "true",
187+
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
188+
effectTags = {OptionEffectTag.NO_OP},
189+
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
190+
help = "Deprecated. No-op.")
191+
public boolean allowTagsPropagation;
192+
183193
@Option(
184194
name = "incompatible_auto_configure_host_platform",
185195
defaultValue = "true",

src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -252,23 +252,6 @@ public static Map<String, String> getExecutionInfo(Rule rule) {
252252
return ImmutableMap.copyOf(map);
253253
}
254254

255-
/**
256-
* Returns the execution info from the tags declared on the target. These include only some tags
257-
* {@link #legalExecInfoKeys} as keys with empty values.
258-
*
259-
* @param rule a rule instance to get tags from
260-
* @param allowTagsPropagation if set to true, tags will be propagated from a target to the
261-
* actions' execution requirements, for more details {@see
262-
* BuildLanguageOptions#experimentalAllowTagsPropagation}
263-
*/
264-
public static ImmutableMap<String, String> getExecutionInfo(
265-
Rule rule, boolean allowTagsPropagation) {
266-
if (allowTagsPropagation) {
267-
return ImmutableMap.copyOf(getExecutionInfo(rule));
268-
} else {
269-
return ImmutableMap.of();
270-
}
271-
}
272255

273256
/**
274257
* Returns the execution info, obtained from the rule's tags and the execution requirements
@@ -278,13 +261,9 @@ public static ImmutableMap<String, String> getExecutionInfo(
278261
* @param executionRequirementsUnchecked execution_requirements of a rule, expected to be of a
279262
* {@code Dict<String, String>} type, null or Starlark None.
280263
* @param rule a rule instance to get tags from
281-
* @param allowTagsPropagation if set to true, tags will be propagated from a target to the
282-
* actions' execution requirements, for more details {@see
283-
* StarlarkSematicOptions#experimentalAllowTagsPropagation}
284264
*/
285265
public static ImmutableSortedMap<String, String> getFilteredExecutionInfo(
286-
@Nullable Object executionRequirementsUnchecked, Rule rule, boolean allowTagsPropagation)
287-
throws EvalException {
266+
@Nullable Object executionRequirementsUnchecked, Rule rule) throws EvalException {
288267
Map<String, String> executionInfo =
289268
executionRequirementsUnchecked == null
290269
? ImmutableMap.of()
@@ -295,12 +274,10 @@ public static ImmutableSortedMap<String, String> getFilteredExecutionInfo(
295274
String.class,
296275
"execution_requirements"));
297276

298-
if (allowTagsPropagation) {
299-
executionInfo = new HashMap<>(executionInfo); // Make mutable.
300-
Map<String, String> checkedTags = getExecutionInfo(rule);
301-
// merging filtered tags to the execution info map avoiding duplicates
302-
checkedTags.forEach(executionInfo::putIfAbsent);
303-
}
277+
executionInfo = new HashMap<>(executionInfo); // Make mutable.
278+
Map<String, String> checkedTags = getExecutionInfo(rule);
279+
// merging filtered tags to the execution info map avoiding duplicates
280+
checkedTags.forEach(executionInfo::putIfAbsent);
304281

305282
return ImmutableSortedMap.copyOf(executionInfo);
306283
}

src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -391,21 +391,6 @@ public final class BuildLanguageOptions extends OptionsBase {
391391
+ "directory.")
392392
public boolean experimentalSiblingRepositoryLayout;
393393

394-
@Option(
395-
name = "incompatible_allow_tags_propagation",
396-
oldName = "experimental_allow_tags_propagation",
397-
defaultValue = "true",
398-
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
399-
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
400-
metadataTags = {
401-
OptionMetadataTag.EXPERIMENTAL,
402-
},
403-
help =
404-
"If set to true, tags will be propagated from a target to the actions' execution"
405-
+ " requirements; otherwise tags are not propagated. See"
406-
+ " https://github.com/bazelbuild/bazel/issues/8830 for details.")
407-
public boolean experimentalAllowTagsPropagation;
408-
409394
@Option(
410395
name = "incompatible_always_check_depset_elements",
411396
defaultValue = "true",
@@ -876,7 +861,6 @@ private void setFlags(FlagConsumer consumer) {
876861
.setBool(
877862
INCOMPATIBLE_STOP_EXPORTING_LANGUAGE_MODULES,
878863
incompatibleStopExportingLanguageModules)
879-
.setBool(INCOMPATIBLE_ALLOW_TAGS_PROPAGATION, experimentalAllowTagsPropagation)
880864
.set(EXPERIMENTAL_BUILTINS_BZL_PATH, experimentalBuiltinsBzlPath)
881865
.set(INCOMPATIBLE_AUTOLOAD_EXTERNALLY, incompatibleAutoloadExternally)
882866
.set(REPOSITORIES_WITHOUT_AUTOLOAD, repositoriesWithoutAutoloads)
@@ -1057,8 +1041,6 @@ public FlagConsumer setBool(String key, boolean ignored) {
10571041
"-incompatible_stop_exporting_language_modules";
10581042
public static final String INCOMPATIBLE_DISABLE_AUTOLOADS_IN_MAIN_REPO =
10591043
"+incompatible_disable_autoloads_in_main_repo";
1060-
public static final String INCOMPATIBLE_ALLOW_TAGS_PROPAGATION =
1061-
"+incompatible_allow_tags_propagation";
10621044
public static final String EXPERIMENTAL_BUILTINS_DUMMY = "-experimental_builtins_dummy";
10631045
public static final String EXPERIMENTAL_BZL_VISIBILITY = "+experimental_bzl_visibility";
10641046
public static final String ALLOW_EXPERIMENTAL_LOADS = "-allow_experimental_loads";

src/main/java/com/google/devtools/build/lib/rules/cpp/CcStarlarkInternal.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,7 @@ private static CppCompileActionBuilder createCppCompileActionBuilder(
920920
.setCoptsFilter(coptsFilter)
921921
.setFeatureConfiguration(featureConfigurationForStarlark.getFeatureConfiguration())
922922
.addExecutionInfo(
923-
TargetUtils.getExecutionInfo(
924-
starlarkRuleContext.getRuleContext().getRule(),
925-
starlarkRuleContext.getRuleContext().isAllowTagsPropagation()));
923+
TargetUtils.getExecutionInfo(starlarkRuleContext.getRuleContext().getRule()));
926924
if (additionalCompilationInputs.size() > 0) {
927925
builder.addMandatoryInputs(
928926
Sequence.cast(

src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ private ImmutableMap<String, String> getExecutionInfo() throws RuleErrorExceptio
373373
getConfiguration()
374374
.modifiedExecutionInfo(
375375
modifiableExecutionInfo.buildOrThrow(), JavaCompileActionBuilder.MNEMONIC));
376-
executionInfo.putAll(
377-
TargetUtils.getExecutionInfo(ruleContext.getRule(), ruleContext.isAllowTagsPropagation()));
376+
executionInfo.putAll(TargetUtils.getExecutionInfo(ruleContext.getRule()));
378377

379378
return executionInfo.buildKeepingLast();
380379
}

src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,7 @@ public void build(JavaToolchainProvider javaToolchain)
536536
.modifiedExecutionInfo(
537537
ImmutableMap.of(ExecutionRequirements.SUPPORTS_PATH_MAPPING, "1"),
538538
JavaCompileActionBuilder.MNEMONIC));
539-
executionInfo.putAll(
540-
TargetUtils.getExecutionInfo(
541-
ruleContext.getRule(), ruleContext.isAllowTagsPropagation()));
539+
executionInfo.putAll(TargetUtils.getExecutionInfo(ruleContext.getRule()));
542540

543541
ActionOwner actionOwner =
544542
ruleContext.useAutoExecGroups()

src/main/java/com/google/devtools/build/lib/rules/java/ResourceJarActionBuilder.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,10 @@ public void build(JavaSemantics semantics, RuleContext ruleContext, String execG
117117
command.addExecPaths("--classpath_resources", classpathResources);
118118
}
119119

120-
ImmutableMap<String, String> executionInfo = EXECUTION_INFO;
121-
if (ruleContext.isAllowTagsPropagation()) {
122-
ImmutableMap.Builder<String, String> executionInfoBuilder = ImmutableMap.builder();
123-
executionInfoBuilder.putAll(EXECUTION_INFO);
124-
executionInfoBuilder.putAll(
125-
TargetUtils.getExecutionInfo(
126-
ruleContext.getRule(), ruleContext.isAllowTagsPropagation()));
127-
executionInfo = executionInfoBuilder.build();
128-
}
120+
ImmutableMap.Builder<String, String> executionInfoBuilder = ImmutableMap.builder();
121+
executionInfoBuilder.putAll(EXECUTION_INFO);
122+
executionInfoBuilder.putAll(TargetUtils.getExecutionInfo(ruleContext.getRule()));
123+
ImmutableMap<String, String> executionInfo = executionInfoBuilder.build();
129124

130125
ruleContext.registerAction(
131126
builder

src/test/java/com/google/devtools/build/lib/packages/TargetUtilsTest.java

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ public void testFilteredExecutionInfo_fromUncheckedExecRequirements() throws Exc
247247

248248
Map<String, String> execInfo =
249249
TargetUtils.getFilteredExecutionInfo(
250-
Dict.<String, String>builder().put("supports-worker", "1").buildImmutable(),
251-
noTag, /* allowTagsPropagation */
252-
true);
250+
Dict.<String, String>builder().put("supports-worker", "1").buildImmutable(), noTag);
253251
assertThat(execInfo).containsExactly("supports-worker", "1");
254252

255253
execInfo =
@@ -258,8 +256,7 @@ public void testFilteredExecutionInfo_fromUncheckedExecRequirements() throws Exc
258256
.put("some-custom-tag", "1")
259257
.put("no-cache", "1")
260258
.buildImmutable(),
261-
noTag,
262-
/* allowTagsPropagation */ true);
259+
noTag);
263260
assertThat(execInfo).containsExactly("no-cache", "1");
264261
}
265262

@@ -279,8 +276,7 @@ public void testFilteredExecutionInfo_fromUncheckedExecRequirements_withWorkerKe
279276
.put("supports-workers", "1")
280277
.put("worker-key-mnemonic", "MyMnemonic")
281278
.buildImmutable(),
282-
noTag, /* allowTagsPropagation */
283-
true);
279+
noTag);
284280
assertThat(execInfo)
285281
.containsExactly("supports-workers", "1", "worker-key-mnemonic", "MyMnemonic");
286282
}
@@ -296,8 +292,7 @@ public void testFilteredExecutionInfo() throws Exception {
296292
Dict.<String, String>builder().put("no-remote", "1").buildImmutable();
297293

298294
Map<String, String> execInfo =
299-
TargetUtils.getFilteredExecutionInfo(
300-
executionRequirementsUnchecked, tag1, /* allowTagsPropagation */ true);
295+
TargetUtils.getFilteredExecutionInfo(executionRequirementsUnchecked, tag1);
301296

302297
assertThat(execInfo).containsExactly("no-cache", "", "supports-workers", "", "no-remote", "1");
303298
}
@@ -313,8 +308,7 @@ public void testFilteredExecutionInfo_withDuplicateTags() throws Exception {
313308
Dict.<String, String>builder().put("no-cache", "1").buildImmutable();
314309

315310
Map<String, String> execInfo =
316-
TargetUtils.getFilteredExecutionInfo(
317-
executionRequirementsUnchecked, tag1, /* allowTagsPropagation */ true);
311+
TargetUtils.getFilteredExecutionInfo(executionRequirementsUnchecked, tag1);
318312

319313
assertThat(execInfo).containsExactly("no-cache", "1", "supports-workers", "");
320314
}
@@ -327,33 +321,13 @@ public void testFilteredExecutionInfo_withNullUncheckedExecRequirements() throws
327321
"foo_binary(name = 'tag1', srcs=['sh.sh'], tags=['supports-workers', 'no-cache'])");
328322
Rule tag1 = (Rule) getTarget("//tests:tag1");
329323

330-
Map<String, String> execInfo =
331-
TargetUtils.getFilteredExecutionInfo(null, tag1, /* allowTagsPropagation */ true);
324+
Map<String, String> execInfo = TargetUtils.getFilteredExecutionInfo(null, tag1);
332325
assertThat(execInfo).containsExactly("no-cache", "", "supports-workers", "");
333326

334-
execInfo =
335-
TargetUtils.getFilteredExecutionInfo(Starlark.NONE, tag1, /* allowTagsPropagation */ true);
327+
execInfo = TargetUtils.getFilteredExecutionInfo(Starlark.NONE, tag1);
336328
assertThat(execInfo).containsExactly("no-cache", "", "supports-workers", "");
337329
}
338330

339-
@Test
340-
public void testFilteredExecutionInfo_whenIncompatibleFlagDisabled() throws Exception {
341-
// when --incompatible_allow_tags_propagation=false
342-
scratch.file(
343-
"tests/BUILD",
344-
"load('//test_defs:foo_binary.bzl', 'foo_binary')",
345-
"foo_binary(name = 'tag1', srcs=['sh.sh'], tags=['supports-workers', 'no-cache'])");
346-
Rule tag1 = (Rule) getTarget("//tests:tag1");
347-
Dict<String, String> executionRequirementsUnchecked =
348-
Dict.<String, String>builder().put("no-remote", "1").buildImmutable();
349-
350-
Map<String, String> execInfo =
351-
TargetUtils.getFilteredExecutionInfo(
352-
executionRequirementsUnchecked, tag1, /* allowTagsPropagation */ false);
353-
354-
assertThat(execInfo).containsExactly("no-remote", "1");
355-
}
356-
357331
@Test
358332
public void testExecutionInfoMisc() throws Exception {
359333
// Migrated from a removed test class that was focused on top-level build configuration.

0 commit comments

Comments
 (0)