Skip to content

Commit c570f97

Browse files
bigelephant29copybara-github
authored andcommitted
Deprecate the experimental_action_resource_set flag.
PiperOrigin-RevId: 715819891 Change-Id: I1c2e582a3d4c6e87e5c76837abb7a175eed3e850
1 parent 15f9d85 commit c570f97

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,7 @@ && getSemantics()
832832
builder.setShadowedAction(Optional.of((Action) shadowedActionUnchecked));
833833
}
834834

835-
if (getSemantics().getBool(BuildLanguageOptions.EXPERIMENTAL_ACTION_RESOURCE_SET)
836-
&& resourceSetUnchecked != Starlark.NONE) {
835+
if (resourceSetUnchecked != Starlark.NONE) {
837836
validateResourceSetBuilder(resourceSetUnchecked);
838837
builder.setResources(
839838
new StarlarkActionResourceSetBuilder(

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,14 @@ public static final class AllCommandGraveyardOptions extends OptionsBase {
579579
effectTags = {OptionEffectTag.NO_OP},
580580
help = "No-op.")
581581
public boolean incompatibleNoPackageDistribs;
582+
583+
@Option(
584+
name = "experimental_action_resource_set",
585+
defaultValue = "true",
586+
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
587+
effectTags = {OptionEffectTag.NO_OP},
588+
help = "No-op.")
589+
public boolean experimentalActionResourceSet;
582590
}
583591

584592
@Override

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -431,20 +431,6 @@ public final class BuildLanguageOptions extends OptionsBase {
431431
+ " https://github.com/bazelbuild/bazel/issues/8830 for details.")
432432
public boolean experimentalAllowTagsPropagation;
433433

434-
@Option(
435-
name = "experimental_action_resource_set",
436-
defaultValue = "true",
437-
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
438-
effectTags = {OptionEffectTag.EXECUTION, OptionEffectTag.BUILD_FILE_SEMANTICS},
439-
metadataTags = {
440-
OptionMetadataTag.EXPERIMENTAL,
441-
},
442-
help =
443-
"If set to true, ctx.actions.run() and ctx.actions.run_shell() accept a resource_set"
444-
+ " parameter for local execution. Otherwise it will default to 250 MB for memory"
445-
+ " and 1 cpu.")
446-
public boolean experimentalActionResourceSet;
447-
448434
@Option(
449435
name = "incompatible_always_check_depset_elements",
450436
defaultValue = "true",
@@ -840,7 +826,6 @@ public StarlarkSemantics toStarlarkSemantics() {
840826
.setBool(ENABLE_WORKSPACE, enableWorkspace)
841827
.setBool(EXPERIMENTAL_ISOLATED_EXTENSION_USAGES, experimentalIsolatedExtensionUsages)
842828
.setBool(INCOMPATIBLE_NO_IMPLICIT_WATCH_LABEL, incompatibleNoImplicitWatchLabel)
843-
.setBool(EXPERIMENTAL_ACTION_RESOURCE_SET, experimentalActionResourceSet)
844829
.setBool(EXPERIMENTAL_GOOGLE_LEGACY_API, experimentalGoogleLegacyApi)
845830
.setBool(EXPERIMENTAL_PLATFORMS_API, experimentalPlatformsApi)
846831
.setBool(EXPERIMENTAL_CC_SHARED_LIBRARY, experimentalCcSharedLibrary)
@@ -959,7 +944,6 @@ public StarlarkSemantics toStarlarkSemantics() {
959944
public static final String EXPERIMENTAL_REPO_REMOTE_EXEC = "-experimental_repo_remote_exec";
960945
public static final String EXPERIMENTAL_SIBLING_REPOSITORY_LAYOUT =
961946
"-experimental_sibling_repository_layout";
962-
public static final String EXPERIMENTAL_ACTION_RESOURCE_SET = "+experimental_action_resource_set";
963947
public static final String INCOMPATIBLE_ALWAYS_CHECK_DEPSET_ELEMENTS =
964948
"+incompatible_always_check_depset_elements";
965949
public static final String INCOMPATIBLE_DEPSET_FOR_LIBRARIES_TO_LINK_GETTER =

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

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

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ private static BuildLanguageOptions buildRandomOptions(Random rand) throws Excep
133133
"--incompatible_allow_tags_propagation=" + rand.nextBoolean(), // flag, Java names differ
134134
"--experimental_cc_shared_library=" + rand.nextBoolean(),
135135
"--experimental_repo_remote_exec=" + rand.nextBoolean(),
136-
"--experimental_action_resource_set=" + rand.nextBoolean(),
137136
"--experimental_dormant_deps=" + rand.nextBoolean(),
138137
"--incompatible_always_check_depset_elements=" + rand.nextBoolean(),
139138
"--incompatible_depset_for_libraries_to_link_getter=" + rand.nextBoolean(),
@@ -180,7 +179,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
180179
.setBool(BuildLanguageOptions.INCOMPATIBLE_ALLOW_TAGS_PROPAGATION, rand.nextBoolean())
181180
.setBool(BuildLanguageOptions.EXPERIMENTAL_CC_SHARED_LIBRARY, rand.nextBoolean())
182181
.setBool(BuildLanguageOptions.EXPERIMENTAL_REPO_REMOTE_EXEC, rand.nextBoolean())
183-
.setBool(BuildLanguageOptions.EXPERIMENTAL_ACTION_RESOURCE_SET, rand.nextBoolean())
184182
.setBool(BuildLanguageOptions.EXPERIMENTAL_DORMANT_DEPS, rand.nextBoolean())
185183
.setBool(BuildLanguageOptions.INCOMPATIBLE_ALWAYS_CHECK_DEPSET_ELEMENTS, rand.nextBoolean())
186184
.setBool(

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

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public void testPackageBoundaryError_externalRepository_boundary() throws Except
422422
.build());
423423
scratch.file("BUILD", "cc_library(name = 'cclib',", " srcs = ['r/my_sub_lib.h'])");
424424
invalidatePackages(
425-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
425+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
426426
reporter.removeHandler(failFastHandler);
427427
getConfiguredTarget("//:cclib");
428428
assertContainsEvent(
@@ -444,7 +444,7 @@ public void testPackageBoundaryError_externalRepository_entirelyInside() throws
444444
scratch.overwriteFile(
445445
"MODULE.bazel", "bazel_dep(name = 'r')", "local_path_override(module_name='r', path='/r')");
446446
invalidatePackages(
447-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
447+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
448448
reporter.removeHandler(failFastHandler);
449449
getConfiguredTarget("@@r+//:cclib");
450450
assertContainsEvent(
@@ -733,7 +733,6 @@ public void testCreateStarlarkActionArgumentsWithUnusedInputsList() throws Excep
733733

734734
@Test
735735
public void testCreateStarlarkActionArgumentsWithResourceSet_success() throws Exception {
736-
setBuildLanguageOptions("--experimental_action_resource_set");
737736
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
738737
setRuleContext(ruleContext);
739738

@@ -759,8 +758,7 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_success() throws Ex
759758
}
760759

761760
@Test
762-
public void testCreateStarlarkActionArgumentsWithResourceSet_flagDisabled() throws Exception {
763-
setBuildLanguageOptions("--noexperimental_action_resource_set");
761+
public void testCreateStarlarkActionArgumentsWithResourceSet_noneResourceSet() throws Exception {
764762
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
765763
setRuleContext(ruleContext);
766764

@@ -772,7 +770,7 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_flagDisabled() thro
772770
"ruleContext.actions.run(",
773771
" inputs = ruleContext.files.srcs,",
774772
" outputs = ruleContext.files.srcs,",
775-
" resource_set = get_resources,",
773+
" resource_set = None,",
776774
" executable = 'executable')");
777775
StarlarkAction action =
778776
(StarlarkAction)
@@ -785,7 +783,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_flagDisabled() thro
785783

786784
@Test
787785
public void testCreateStarlarkActionArgumentsWithResourceSet_lambdaForbidden() throws Exception {
788-
setBuildLanguageOptions("--experimental_action_resource_set");
789786
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
790787
setRuleContext(ruleContext);
791788

@@ -806,7 +803,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_lambdaForbidden() t
806803

807804
@Test
808805
public void testCreateStarlarkActionArgumentsWithResourceSet_illegalResource() throws Exception {
809-
setBuildLanguageOptions("--experimental_action_resource_set");
810806
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
811807
setRuleContext(ruleContext);
812808

@@ -832,7 +828,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_illegalResource() t
832828

833829
@Test
834830
public void testCreateStarlarkActionArgumentsWithResourceSet_defaultValue() throws Exception {
835-
setBuildLanguageOptions("--experimental_action_resource_set");
836831
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
837832
setRuleContext(ruleContext);
838833

@@ -855,7 +850,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_defaultValue() thro
855850

856851
@Test
857852
public void testCreateStarlarkActionArgumentsWithResourceSet_intDict() throws Exception {
858-
setBuildLanguageOptions("--experimental_action_resource_set");
859853
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
860854
setRuleContext(ruleContext);
861855

@@ -878,7 +872,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_intDict() throws Ex
878872

879873
@Test
880874
public void testCreateStarlarkActionArgumentsWithResourceSet_notDict() throws Exception {
881-
setBuildLanguageOptions("--experimental_action_resource_set");
882875
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
883876
setRuleContext(ruleContext);
884877

@@ -904,7 +897,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_notDict() throws Ex
904897

905898
@Test
906899
public void testCreateStarlarkActionArgumentsWithResourceSet_wrongDict() throws Exception {
907-
setBuildLanguageOptions("--experimental_action_resource_set");
908900
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
909901
setRuleContext(ruleContext);
910902

@@ -931,7 +923,6 @@ public void testCreateStarlarkActionArgumentsWithResourceSet_wrongDict() throws
931923
@Test
932924
public void testCreateStarlarkActionArgumentsWithResourceSet_incorrectSignature()
933925
throws Exception {
934-
setBuildLanguageOptions("--experimental_action_resource_set");
935926
StarlarkRuleContext ruleContext = createRuleContext("//foo:foo");
936927
setRuleContext(ruleContext);
937928

@@ -1159,7 +1150,6 @@ public void testDeriveTreeArtifactNextToSibling() throws Exception {
11591150
assertThat(artifact.isTreeArtifact()).isTrue();
11601151
}
11611152

1162-
11631153
@Test
11641154
public void testParamFileSuffix() throws Exception {
11651155
setRuleContext(createRuleContext("//foo:foo"));
@@ -1750,7 +1740,7 @@ def _impl(ctx):
17501740
"MODULE.bazel", "bazel_dep(name='r')", "local_path_override(module_name='r', path='/r')");
17511741

17521742
invalidatePackages(
1753-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
1743+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
17541744
setRuleContext(createRuleContext("@@r+//a:r"));
17551745
Label depLabel = (Label) ev.eval("ruleContext.attr.internal_dep.label");
17561746
assertThat(depLabel).isEqualTo(Label.parseCanonical("//:dep"));
@@ -1761,7 +1751,7 @@ public void testExternalWorkspaceLoad() throws Exception {
17611751
// RepositoryDelegatorFunction deletes and creates symlink for the repository and as such is not
17621752
// safe to execute in parallel. Disable checks with package loader to avoid parallel
17631753
// evaluations.
1764-
initializeSkyframeExecutor(/*doPackageLoadingChecks=*/ false);
1754+
initializeSkyframeExecutor(/* doPackageLoadingChecks= */ false);
17651755
setBuildLanguageOptions("--enable_workspace");
17661756
scratch.file(
17671757
"/r1/BUILD",
@@ -1802,7 +1792,7 @@ def other_macro(name, path):
18021792
.build());
18031793

18041794
invalidatePackages(
1805-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
1795+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
18061796
assertThat(getConfiguredTarget("@r1//:test")).isNotNull();
18071797
}
18081798

@@ -1825,7 +1815,7 @@ public void testLoadBlockRepositoryRedefinition() throws Exception {
18251815
.build());
18261816

18271817
invalidatePackages(
1828-
/*alsoConfigs=*/ false); // Repository shuffling messes with toolchain labels.
1818+
/* alsoConfigs= */ false); // Repository shuffling messes with toolchain labels.
18291819
assertThat(
18301820
(List)
18311821
getConfiguredTargetAndData("@foo//:baz")
@@ -1846,7 +1836,7 @@ public void testLoadBlockRepositoryRedefinition() throws Exception {
18461836
.add("local_repository(name = 'foo', path = '/baz')")
18471837
.build());
18481838

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

0 commit comments

Comments
 (0)