Skip to content

Commit 9cca507

Browse files
committed
Remote resolve_execution_reqs as it is no longer needed
--incompatible_allow_tags_propagation defaults to true and has for a while
1 parent b83042f commit 9cca507

File tree

8 files changed

+49
-98
lines changed

8 files changed

+49
-98
lines changed

rules/common/private/utils.bzl

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,6 @@ def safe_name(value):
173173
def _short_path(file):
174174
return file.short_path
175175

176-
# This propagates specific tags as execution requirements to be passed to an action
177-
# A fix to bazelbuild/bazel that will make this no longer necessary is underway; we can remove this once that's released and we've obtained it
178-
PROPAGATABLE_TAGS = ["no-remote", "no-cache", "no-sandbox", "no-remote-exec", "no-remote-cache"]
179-
180-
def resolve_execution_reqs(ctx, base_exec_reqs):
181-
exec_reqs = {}
182-
for tag in ctx.attr.tags:
183-
if tag in PROPAGATABLE_TAGS:
184-
exec_reqs.update({tag: "1"})
185-
exec_reqs.update(base_exec_reqs)
186-
return exec_reqs
187-
188176
def _format_resources_item(item):
189177
key, value = item
190178
return "{}:{}".format(value.path, key)
@@ -223,13 +211,10 @@ def action_singlejar(
223211
ctx.actions.run(
224212
arguments = [args],
225213
executable = ctx.executable._singlejar,
226-
execution_requirements = resolve_execution_reqs(
227-
ctx,
228-
{
229-
"supports-workers": "0",
230-
"supports-path-mapping": "1",
231-
},
232-
),
214+
execution_requirements = {
215+
"supports-workers": "0",
216+
"supports-path-mapping": "1",
217+
},
233218
inputs = all_inputs,
234219
mnemonic = _SINGLE_JAR_MNEMONIC,
235220
outputs = [output],

rules/private/phases/phase_bootstrap_compile.bzl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load("@rules_java//java/common:java_common.bzl", "java_common")
22
load(
33
"//rules/common:private/utils.bzl",
4-
_resolve_execution_reqs = "resolve_execution_reqs",
54
_strip_margin = "strip_margin",
65
)
76

@@ -121,12 +120,9 @@ def phase_bootstrap_compile(ctx, g):
121120
ctx.actions.run_shell(
122121
arguments = [args],
123122
command = command,
124-
execution_requirements = _resolve_execution_reqs(
125-
ctx,
126-
{
127-
"supports-path-mapping": "1",
128-
},
129-
),
123+
execution_requirements = {
124+
"supports-path-mapping": "1",
125+
},
130126
inputs = inputs,
131127
mnemonic = "BootstrapScalacompile",
132128
outputs = [g.classpaths.jar, tmp],

rules/private/phases/phase_coverage_jacoco.bzl

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ load(
33
_CodeCoverageConfiguration = "CodeCoverageConfiguration",
44
_JacocoInfo = "JacocoInfo",
55
)
6-
load(
7-
"@rules_scala_annex//rules/common:private/utils.bzl",
8-
_resolve_execution_reqs = "resolve_execution_reqs",
9-
)
106
load(
117
"@rules_scala_annex//rules/private:coverage_replacements_provider.bzl",
128
_coverage_replacements_provider = "coverage_replacements_provider",
@@ -34,16 +30,13 @@ def phase_coverage_jacoco(ctx, g):
3430
ctx.actions.run(
3531
arguments = [args],
3632
executable = toolchain.code_coverage_configuration.instrumentation_worker.files_to_run,
37-
execution_requirements = _resolve_execution_reqs(
38-
ctx,
39-
{
40-
"supports-multiplex-workers": "1",
41-
"supports-workers": "1",
42-
"supports-multiplex-sandboxing": "1",
43-
"supports-worker-cancellation": "1",
44-
"supports-path-mapping": "1",
45-
},
46-
),
33+
execution_requirements = {
34+
"supports-multiplex-workers": "1",
35+
"supports-workers": "1",
36+
"supports-multiplex-sandboxing": "1",
37+
"supports-worker-cancellation": "1",
38+
"supports-path-mapping": "1",
39+
},
4740
inputs = [in_out_pair[0] for in_out_pair in in_out_pairs],
4841
mnemonic = "JacocoInstrumenter",
4942
outputs = [in_out_pair[1] for in_out_pair in in_out_pairs],

rules/private/phases/phase_zinc_compile.bzl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ load(
88
_ZincDepInfo = "ZincDepInfo",
99
_ZincInfo = "ZincInfo",
1010
)
11-
load(
12-
"@rules_scala_annex//rules/common:private/utils.bzl",
13-
_resolve_execution_reqs = "resolve_execution_reqs",
14-
)
1511

1612
#
1713
# PHASE: compile
@@ -106,10 +102,7 @@ def phase_zinc_compile(ctx, g):
106102
ctx.actions.run(
107103
arguments = [args],
108104
executable = worker.files_to_run,
109-
execution_requirements = _resolve_execution_reqs(
110-
ctx,
111-
execution_requirements_tags,
112-
),
105+
execution_requirements = execution_requirements_tags,
113106
inputs = inputs,
114107
mnemonic = "ScalaCompile",
115108
outputs = outputs,

rules/private/phases/phase_zinc_depscheck.bzl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ load(
66
)
77
load(
88
"@rules_scala_annex//rules/common:private/utils.bzl",
9-
_resolve_execution_reqs = "resolve_execution_reqs",
109
_short_path = "short_path",
1110
)
1211

@@ -44,16 +43,13 @@ def phase_zinc_depscheck(ctx, g):
4443
ctx.actions.run(
4544
arguments = [deps_args],
4645
executable = deps_configuration.worker.files_to_run,
47-
execution_requirements = _resolve_execution_reqs(
48-
ctx,
49-
{
50-
"supports-multiplex-workers": "1",
51-
"supports-workers": "1",
52-
"supports-multiplex-sandboxing": "1",
53-
"supports-worker-cancellation": "1",
54-
"supports-path-mapping": "1",
55-
},
56-
),
46+
execution_requirements = {
47+
"supports-multiplex-workers": "1",
48+
"supports-workers": "1",
49+
"supports-multiplex-sandboxing": "1",
50+
"supports-worker-cancellation": "1",
51+
"supports-path-mapping": "1",
52+
},
5753
inputs = [g.compile.used],
5854
mnemonic = "ScalaCheckDeps",
5955
outputs = [deps_check],

rules/scala/private/doc.bzl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ load(
88
load(
99
"//rules/common:private/utils.bzl",
1010
_collect = "collect",
11-
_resolve_execution_reqs = "resolve_execution_reqs",
1211
_separate_src_jars_srcs_and_other = "separate_src_jars_srcs_and_other",
1312
)
1413

@@ -55,16 +54,13 @@ def scaladoc_implementation(ctx):
5554
ctx.actions.run(
5655
arguments = [args],
5756
executable = ctx.attr._runner.files_to_run,
58-
execution_requirements = _resolve_execution_reqs(
59-
ctx,
60-
{
61-
"supports-multiplex-workers": "1",
62-
"supports-workers": "1",
63-
"supports-multiplex-sandboxing": "1",
64-
"supports-worker-cancellation": "1",
65-
"supports-path-mapping": "1",
66-
},
67-
),
57+
execution_requirements = {
58+
"supports-multiplex-workers": "1",
59+
"supports-workers": "1",
60+
"supports-multiplex-sandboxing": "1",
61+
"supports-worker-cancellation": "1",
62+
"supports-path-mapping": "1",
63+
},
6864
inputs = depset(
6965
src_jars + srcs + [toolchain.zinc_configuration.compiler_bridge],
7066
transitive = [classpath, compiler_classpath],

rules/scala_proto/private/core.bzl

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load("@protobuf//bazel/common:proto_info.bzl", "ProtoInfo")
22
load(
33
"//rules/common:private/utils.bzl",
4-
_resolve_execution_reqs = "resolve_execution_reqs",
54
_safe_name = "safe_name",
65
)
76

@@ -44,16 +43,13 @@ def scala_proto_library_implementation(ctx):
4443
ctx.actions.run(
4544
arguments = [args],
4645
executable = compiler.compiler.files_to_run,
47-
execution_requirements = _resolve_execution_reqs(
48-
ctx,
49-
{
50-
"supports-multiplex-workers": supports_workers,
51-
"supports-workers": supports_workers,
52-
"supports-multiplex-sandboxing": supports_workers,
53-
"supports-worker-cancellation": supports_workers,
54-
"supports-path-mapping": supports_workers,
55-
},
56-
),
46+
execution_requirements = {
47+
"supports-multiplex-workers": supports_workers,
48+
"supports-workers": supports_workers,
49+
"supports-multiplex-sandboxing": supports_workers,
50+
"supports-worker-cancellation": supports_workers,
51+
"supports-path-mapping": supports_workers,
52+
},
5753
inputs = depset(direct = [], transitive = [transitive_sources]),
5854
mnemonic = "ScalaProtoCompile",
5955
outputs = [gendir],
@@ -71,9 +67,9 @@ def scala_proto_library_implementation(ctx):
7167
ctx.actions.run_shell(
7268
arguments = [shell_args],
7369
command = """$1 c $4 META-INF/= $(find -L $2 -type f | while read v; do echo ${v#"${2%$3}"}=$v; done)""",
74-
execution_requirements = _resolve_execution_reqs(ctx, {
70+
execution_requirements = {
7571
"supports-path-mapping": "1",
76-
}),
72+
},
7773
inputs = [gendir],
7874
mnemonic = "SrcJar",
7975
outputs = [srcjar],

rules/scalafmt/private/test.bzl

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
load(
22
"@rules_scala_annex//rules/common:private/utils.bzl",
3-
_resolve_execution_reqs = "resolve_execution_reqs",
43
_short_path = "short_path",
54
)
65

@@ -49,16 +48,13 @@ def build_format(ctx):
4948
ctx.actions.run(
5049
arguments = ["--jvm_flag=-Dfile.encoding=UTF-8", args],
5150
executable = ctx.executable._fmt,
52-
execution_requirements = _resolve_execution_reqs(
53-
ctx,
54-
{
55-
"supports-multiplex-workers": "1",
56-
"supports-workers": "1",
57-
"supports-multiplex-sandboxing": "1",
58-
"supports-worker-cancellation": "1",
59-
"supports-path-mapping": "1",
60-
},
61-
),
51+
execution_requirements = {
52+
"supports-multiplex-workers": "1",
53+
"supports-workers": "1",
54+
"supports-multiplex-sandboxing": "1",
55+
"supports-worker-cancellation": "1",
56+
"supports-path-mapping": "1",
57+
},
6258
inputs = [config, src],
6359
mnemonic = "ScalaFmt",
6460
outputs = [file],
@@ -81,9 +77,9 @@ def format_runner(ctx, manifest, files):
8177
ctx.actions.run_shell(
8278
arguments = [args],
8379
command = "cat $1 | sed -e s#%workspace%#$2# -e s#%manifest%#$3# > $4",
84-
execution_requirements = _resolve_execution_reqs(ctx, {
80+
execution_requirements = {
8581
"supports-path-mapping": "1",
86-
}),
82+
},
8783
inputs = [ctx.file._runner, manifest] + files,
8884
mnemonic = "CreateScalaFmtRunner",
8985
outputs = [ctx.outputs.scalafmt_runner],
@@ -100,9 +96,9 @@ def format_tester(ctx, manifest, files):
10096
ctx.actions.run_shell(
10197
arguments = [args],
10298
command = "cat $1 | sed -e s#%workspace%#$2# -e s#%manifest%#$3# > $4",
103-
execution_requirements = _resolve_execution_reqs(ctx, {
99+
execution_requirements = {
104100
"supports-path-mapping": "1",
105-
}),
101+
},
106102
inputs = [ctx.file._testrunner, manifest] + files,
107103
mnemonic = "CreateScalaFmtTester",
108104
outputs = [ctx.outputs.scalafmt_testrunner],

0 commit comments

Comments
 (0)