Skip to content

Commit 0a5b7e7

Browse files
bigelephant29fmeum
authored andcommitted
Deprecate the experimental_action_resource_set flag.
PiperOrigin-RevId: 715819891 Change-Id: I1c2e582a3d4c6e87e5c76837abb7a175eed3e850 (cherry picked from commit c570f97)
1 parent 38dbf04 commit 0a5b7e7

File tree

6 files changed

+21
-43
lines changed

6 files changed

+21
-43
lines changed

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -866,8 +866,7 @@ && getSemantics()
866866
builder.setShadowedAction(Optional.of((Action) shadowedActionUnchecked));
867867
}
868868

869-
if (getSemantics().getBool(BuildLanguageOptions.EXPERIMENTAL_ACTION_RESOURCE_SET)
870-
&& resourceSetUnchecked != Starlark.NONE) {
869+
if (resourceSetUnchecked != Starlark.NONE) {
871870
validateResourceSetBuilder(resourceSetUnchecked);
872871
builder.setResources(
873872
new StarlarkActionResourceSetBuilder(

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

+8
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,14 @@ public static final class AllCommandGraveyardOptions extends OptionsBase {
480480
effectTags = {OptionEffectTag.UNKNOWN},
481481
help = "Do not use.")
482482
public String javaOptimizationMode;
483+
484+
@Option(
485+
name = "experimental_action_resource_set",
486+
defaultValue = "true",
487+
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
488+
effectTags = {OptionEffectTag.NO_OP},
489+
help = "No-op.")
490+
public boolean experimentalActionResourceSet;
483491
}
484492

485493
@Override

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

-16
Original file line numberDiff line numberDiff line change
@@ -439,20 +439,6 @@ public final class BuildLanguageOptions extends OptionsBase {
439439
+ " https://github.com/bazelbuild/bazel/issues/8830 for details.")
440440
public boolean experimentalAllowTagsPropagation;
441441

442-
@Option(
443-
name = "experimental_action_resource_set",
444-
defaultValue = "true",
445-
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
446-
effectTags = {OptionEffectTag.EXECUTION, OptionEffectTag.BUILD_FILE_SEMANTICS},
447-
metadataTags = {
448-
OptionMetadataTag.EXPERIMENTAL,
449-
},
450-
help =
451-
"If set to true, ctx.actions.run() and ctx.actions.run_shell() accept a resource_set"
452-
+ " parameter for local execution. Otherwise it will default to 250 MB for memory"
453-
+ " and 1 cpu.")
454-
public boolean experimentalActionResourceSet;
455-
456442
@Option(
457443
name = "incompatible_struct_has_no_methods",
458444
defaultValue = "false",
@@ -861,7 +847,6 @@ public StarlarkSemantics toStarlarkSemantics() {
861847
.setBool(
862848
INCOMPATIBLE_EXISTING_RULES_IMMUTABLE_VIEW, incompatibleExistingRulesImmutableView)
863849
.setBool(INCOMPATIBLE_NO_IMPLICIT_WATCH_LABEL, incompatibleNoImplicitWatchLabel)
864-
.setBool(EXPERIMENTAL_ACTION_RESOURCE_SET, experimentalActionResourceSet)
865850
.setBool(EXPERIMENTAL_GOOGLE_LEGACY_API, experimentalGoogleLegacyApi)
866851
.setBool(EXPERIMENTAL_PLATFORMS_API, experimentalPlatformsApi)
867852
.setBool(EXPERIMENTAL_CC_SHARED_LIBRARY, experimentalCcSharedLibrary)
@@ -982,7 +967,6 @@ public StarlarkSemantics toStarlarkSemantics() {
982967
public static final String EXPERIMENTAL_REPO_REMOTE_EXEC = "-experimental_repo_remote_exec";
983968
public static final String EXPERIMENTAL_SIBLING_REPOSITORY_LAYOUT =
984969
"-experimental_sibling_repository_layout";
985-
public static final String EXPERIMENTAL_ACTION_RESOURCE_SET = "+experimental_action_resource_set";
986970
public static final String INCOMPATIBLE_ALWAYS_CHECK_DEPSET_ELEMENTS =
987971
"+incompatible_always_check_depset_elements";
988972
public static final String INCOMPATIBLE_DEPSET_FOR_LIBRARIES_TO_LINK_GETTER =

src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,9 @@ void write(FileApi output, Object content, Boolean isExecutable)
514514
+ " action. The returned dictionary may contain the following entries, each of"
515515
+ " which may be a float or an int:<ul><li>\"cpu\": number of CPUs; default"
516516
+ " 1<li>\"memory\": in MB; default 250<li>\"local_test\": number of local"
517-
+ " tests; default 1</ul><p>If this parameter is set to <code>None</code> or if"
518-
+ " <code>--experimental_action_resource_set</code> is false, the default"
519-
+ " values are used.<p>The callback must be top-level (lambda and nested"
520-
+ " functions aren't allowed)."),
517+
+ " tests; default 1</ul><p>If this parameter is set to <code>None</code> , the"
518+
+ " default values are used.<p>The callback must be top-level (lambda and"
519+
+ " nested functions aren't allowed)."),
521520
@Param(
522521
name = "toolchain",
523522
allowedTypes = {

src/test/java/com/google/devtools/build/lib/packages/semantics/ConsistencyTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ private static BuildLanguageOptions buildRandomOptions(Random rand) throws Excep
137137
"--incompatible_allow_tags_propagation=" + rand.nextBoolean(), // flag, Java names differ
138138
"--experimental_cc_shared_library=" + rand.nextBoolean(),
139139
"--experimental_repo_remote_exec=" + rand.nextBoolean(),
140-
"--experimental_action_resource_set=" + rand.nextBoolean(),
141140
"--incompatible_always_check_depset_elements=" + rand.nextBoolean(),
142141
"--incompatible_depset_for_libraries_to_link_getter=" + rand.nextBoolean(),
143142
"--incompatible_disable_target_provider_fields=" + rand.nextBoolean(),
@@ -187,7 +186,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
187186
.setBool(BuildLanguageOptions.INCOMPATIBLE_ALLOW_TAGS_PROPAGATION, rand.nextBoolean())
188187
.setBool(BuildLanguageOptions.EXPERIMENTAL_CC_SHARED_LIBRARY, rand.nextBoolean())
189188
.setBool(BuildLanguageOptions.EXPERIMENTAL_REPO_REMOTE_EXEC, rand.nextBoolean())
190-
.setBool(BuildLanguageOptions.EXPERIMENTAL_ACTION_RESOURCE_SET, rand.nextBoolean())
191189
.setBool(BuildLanguageOptions.INCOMPATIBLE_ALWAYS_CHECK_DEPSET_ELEMENTS, rand.nextBoolean())
192190
.setBool(
193191
BuildLanguageOptions.INCOMPATIBLE_DEPSET_FOR_LIBRARIES_TO_LINK_GETTER,

src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleContextTest.java

+9-19
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public void testPackageBoundaryError_externalRepository_boundary() throws Except
392392
.build());
393393
scratch.file("BUILD", "cc_library(name = 'cclib',", " srcs = ['r/my_sub_lib.h'])");
394394
invalidatePackages(
395-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
395+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
396396
reporter.removeHandler(failFastHandler);
397397
getConfiguredTarget("//:cclib");
398398
assertContainsEvent(
@@ -413,7 +413,7 @@ public void testPackageBoundaryError_externalRepository_entirelyInside() throws
413413
.add("local_repository(name='r', path='/r')")
414414
.build());
415415
invalidatePackages(
416-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
416+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
417417
reporter.removeHandler(failFastHandler);
418418
getConfiguredTarget("@r//:cclib");
419419
assertContainsEvent(
@@ -688,7 +688,6 @@ public void testCreateStarlarkActionArgumentsWithUnusedInputsList() throws Excep
688688

689689
@Test
690690
public void testCreateStarlarkActionArgumentsWithResourceSet_success() throws Exception {
691-
setBuildLanguageOptions("--experimental_action_resource_set");
692691
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
693692
setRuleContext(ruleContext);
694693

@@ -714,8 +713,7 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_success() throws Ex
714713
}
715714

716715
@Test
717-
public void testCreateStarlarkActionArgumentsWithResourceSet_flagDisabled() throws Exception {
718-
setBuildLanguageOptions("--noexperimental_action_resource_set");
716+
public void testCreateStarlarkActionArgumentsWithResourceSet_noneResourceSet() throws Exception {
719717
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
720718
setRuleContext(ruleContext);
721719

@@ -727,7 +725,7 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_flagDisabled() thro
727725
"ruleContext.actions.run(",
728726
" inputs = ruleContext.files.srcs,",
729727
" outputs = ruleContext.files.srcs,",
730-
" resource_set = get_resources,",
728+
" resource_set = None,",
731729
" executable = 'executable')");
732730
StarlarkAction action =
733731
(StarlarkAction)
@@ -740,7 +738,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_flagDisabled() thro
740738

741739
@Test
742740
public void testCreateStarlarkActionArgumentsWithResourceSet_lambdaForbidden() throws Exception {
743-
setBuildLanguageOptions("--experimental_action_resource_set");
744741
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
745742
setRuleContext(ruleContext);
746743

@@ -761,7 +758,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_lambdaForbidden() t
761758

762759
@Test
763760
public void testCreateStarlarkActionArgumentsWithResourceSet_illegalResource() throws Exception {
764-
setBuildLanguageOptions("--experimental_action_resource_set");
765761
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
766762
setRuleContext(ruleContext);
767763

@@ -787,7 +783,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_illegalResource() t
787783

788784
@Test
789785
public void testCreateStarlarkActionArgumentsWithResourceSet_defaultValue() throws Exception {
790-
setBuildLanguageOptions("--experimental_action_resource_set");
791786
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
792787
setRuleContext(ruleContext);
793788

@@ -810,7 +805,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_defaultValue() thro
810805

811806
@Test
812807
public void testCreateStarlarkActionArgumentsWithResourceSet_intDict() throws Exception {
813-
setBuildLanguageOptions("--experimental_action_resource_set");
814808
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
815809
setRuleContext(ruleContext);
816810

@@ -833,7 +827,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_intDict() throws Ex
833827

834828
@Test
835829
public void testCreateStarlarkActionArgumentsWithResourceSet_notDict() throws Exception {
836-
setBuildLanguageOptions("--experimental_action_resource_set");
837830
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
838831
setRuleContext(ruleContext);
839832

@@ -859,7 +852,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_notDict() throws Ex
859852

860853
@Test
861854
public void testCreateStarlarkActionArgumentsWithResourceSet_wrongDict() throws Exception {
862-
setBuildLanguageOptions("--experimental_action_resource_set");
863855
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
864856
setRuleContext(ruleContext);
865857

@@ -886,7 +878,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_wrongDict() throws
886878
@Test
887879
public void testCreateStarlarkActionArgumentsWithResourceSet_incorrectSignature()
888880
throws Exception {
889-
setBuildLanguageOptions("--experimental_action_resource_set");
890881
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
891882
setRuleContext(ruleContext);
892883

@@ -1083,7 +1074,6 @@ public void testDeriveTreeArtifactNextToSibling() throws Exception {
10831074
assertThat(artifact.isTreeArtifact()).isTrue();
10841075
}
10851076

1086-
10871077
@Test
10881078
public void testParamFileSuffix() throws Exception {
10891079
setRuleContext(createRuleContext("//foo:foo"));
@@ -1637,7 +1627,7 @@ public void testRelativeLabelInExternalRepository() throws Exception {
16371627
.build());
16381628

16391629
invalidatePackages(
1640-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
1630+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
16411631
setRuleContext(createRuleContext("@r//a:r"));
16421632
Label depLabel = (Label) ev.eval("ruleContext.attr.internal_dep.label");
16431633
assertThat(depLabel).isEqualTo(Label.parseCanonical("//:dep"));
@@ -1648,7 +1638,7 @@ public void testExternalWorkspaceLoad() throws Exception {
16481638
// RepositoryDelegatorFunction deletes and creates symlink for the repository and as such is not
16491639
// safe to execute in parallel. Disable checks with package loader to avoid parallel
16501640
// evaluations.
1651-
initializeSkyframeExecutor(/*doPackageLoadingChecks=*/ false);
1641+
initializeSkyframeExecutor(/* doPackageLoadingChecks= */ false);
16521642
scratch.file(
16531643
"/r1/BUILD",
16541644
"filegroup(name = 'test',",
@@ -1680,7 +1670,7 @@ public void testExternalWorkspaceLoad() throws Exception {
16801670
.build());
16811671

16821672
invalidatePackages(
1683-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
1673+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
16841674
assertThat(getConfiguredTarget("@r1//:test")).isNotNull();
16851675
}
16861676

@@ -1702,7 +1692,7 @@ public void testLoadBlockRepositoryRedefinition() throws Exception {
17021692
.build());
17031693

17041694
invalidatePackages(
1705-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
1695+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
17061696
assertThat(
17071697
(List)
17081698
getConfiguredTargetAndData("@foo//:baz")
@@ -1723,7 +1713,7 @@ public void testLoadBlockRepositoryRedefinition() throws Exception {
17231713
.add("local_repository(name = 'foo', path = '/baz')")
17241714
.build());
17251715

1726-
invalidatePackages(/*alsoConfigs=*/ false); // Repository shuffling messes with toolchains.
1716+
invalidatePackages(/* alsoConfigs= */ false); // Repository shuffling messes with toolchains.
17271717
assertThrows(Exception.class, () -> createRuleContext("@foo//:baz"));
17281718
assertContainsEvent(
17291719
"Cannot redefine repository after any load statement in the WORKSPACE file "

0 commit comments

Comments
 (0)