File tree 3 files changed +23
-1
lines changed
src/main/java/com/google/devtools/build/lib/bazel 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,20 @@ public static class Options extends FragmentOptions {
40
40
help = "If enabled, visibility checking also applies to toolchain implementations." )
41
41
public boolean checkVisibilityForToolchains ;
42
42
43
+ @ Option (
44
+ name = "incompatible_remove_exec_tools" ,
45
+ defaultValue = "false" ,
46
+ documentationCategory = OptionDocumentationCategory .UNCATEGORIZED ,
47
+ effectTags = {OptionEffectTag .BUILD_FILE_SEMANTICS },
48
+ metadataTags = {OptionMetadataTag .INCOMPATIBLE_CHANGE },
49
+ help = "If enabled, use of genrule's exec_tools attribute will cause an error.." )
50
+ public boolean removeExecTools ;
51
+
43
52
@ Override
44
53
public FragmentOptions getExec () {
45
54
Options exec = (Options ) getDefault ();
46
55
exec .checkVisibilityForToolchains = checkVisibilityForToolchains ;
56
+ exec .removeExecTools = removeExecTools ;
47
57
48
58
return exec ;
49
59
}
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ java_library(
18
18
"//src/main/java/com/google/devtools/build/lib/analysis:analysis_cluster" ,
19
19
"//src/main/java/com/google/devtools/build/lib/analysis:config/execution_transition_factory" ,
20
20
"//src/main/java/com/google/devtools/build/lib/analysis:rule_definition_environment" ,
21
+ "//src/main/java/com/google/devtools/build/lib/bazel:bazel_configuration" ,
21
22
"//src/main/java/com/google/devtools/build/lib/packages" ,
22
23
"//src/main/java/com/google/devtools/build/lib/rules/genrule" ,
23
24
"//src/main/java/com/google/devtools/build/lib/util:filetype" ,
Original file line number Diff line number Diff line change 16
16
17
17
import com .google .devtools .build .lib .analysis .CommandHelper ;
18
18
import com .google .devtools .build .lib .analysis .RuleContext ;
19
+ import com .google .devtools .build .lib .bazel .BazelConfiguration ;
20
+ import com .google .devtools .build .lib .packages .BuildType ;
19
21
import com .google .devtools .build .lib .packages .Type ;
20
22
import com .google .devtools .build .lib .rules .genrule .GenRuleBase ;
21
23
@@ -36,9 +38,18 @@ protected boolean isStampingEnabled(RuleContext ruleContext) {
36
38
// projects are migrated.
37
39
@ Override
38
40
protected CommandHelper .Builder commandHelperBuilder (RuleContext ruleContext ) {
41
+ BazelConfiguration .Options bazelOptions =
42
+ ruleContext .getConfiguration ().getOptions ().get (BazelConfiguration .Options .class );
43
+
44
+ if (bazelOptions .removeExecTools
45
+ && ruleContext .attributes ().has ("exec_tools" , BuildType .LABEL_LIST )
46
+ && !ruleContext .attributes ().get ("exec_tools" , BuildType .LABEL_LIST ).isEmpty ()) {
47
+ ruleContext .attributeError (
48
+ "exec_tools" , "genrule.exec_tools has been removed, use tools instead" );
49
+ }
50
+
39
51
return CommandHelper .builder (ruleContext )
40
52
.addToolDependencies ("tools" )
41
- // TODO(https://github.com/bazelbuild/bazel/issues/19132): Add an actual incompatible flag.
42
53
.addToolDependencies ("exec_tools" )
43
54
.addToolDependencies ("toolchains" );
44
55
}
You can’t perform that action at this time.
0 commit comments