Skip to content

Commit

Permalink
Remove the flag incompatible_no_kwargs_in_build_files.
Browse files Browse the repository at this point in the history
 bazelbuild#8021

RELNOTES: None.
PiperOrigin-RevId: 253049309
  • Loading branch information
laurentlb authored and siberex committed Jul 4, 2019
1 parent 20f3967 commit 0514f71
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,20 +490,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
+ "symbols introduced by load are not implicitly re-exported.")
public boolean incompatibleNoTransitiveLoads;

@Option(
name = "incompatible_no_kwargs_in_build_files",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
metadataTags = {
OptionMetadataTag.INCOMPATIBLE_CHANGE,
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
},
help =
"If set to true, *args and **kwargs are not allowed in BUILD files. See "
+ "https://github.com/bazelbuild/bazel/issues/8021")
public boolean incompatibleNoKwargsInBuildFiles;

@Option(
name = "incompatible_remap_main_repo",
defaultValue = "false",
Expand Down Expand Up @@ -645,7 +631,6 @@ public StarlarkSemantics toSkylarkSemantics() {
.incompatibleExpandDirectories(incompatibleExpandDirectories)
.incompatibleNewActionsApi(incompatibleNewActionsApi)
.incompatibleNoAttrLicense(incompatibleNoAttrLicense)
.incompatibleNoKwargsInBuildFiles(incompatibleNoKwargsInBuildFiles)
.incompatibleNoOutputAttrDefault(incompatibleNoOutputAttrDefault)
.incompatibleNoRuleOutputsParam(incompatibleNoRuleOutputsParam)
.incompatibleNoSupportToolsInActionInputs(incompatibleNoSupportToolsInActionInputs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ public boolean flagValue(FlagIdentifier flagIdentifier) {

public abstract boolean incompatibleNoAttrLicense();

public abstract boolean incompatibleNoKwargsInBuildFiles();

public abstract boolean incompatibleNoOutputAttrDefault();

public abstract boolean incompatibleNoRuleOutputsParam();
Expand Down Expand Up @@ -261,7 +259,6 @@ public static Builder builderWithDefaults() {
.incompatibleExpandDirectories(true)
.incompatibleNewActionsApi(true)
.incompatibleNoAttrLicense(true)
.incompatibleNoKwargsInBuildFiles(true)
.incompatibleNoOutputAttrDefault(true)
.incompatibleNoRuleOutputsParam(false)
.incompatibleNoSupportToolsInActionInputs(true)
Expand Down Expand Up @@ -336,8 +333,6 @@ public abstract Builder incompatibleDisallowRuleExecutionPlatformConstraintsAllo

public abstract Builder incompatibleNewActionsApi(boolean value);

public abstract Builder incompatibleNoKwargsInBuildFiles(boolean value);

public abstract Builder incompatibleNoAttrLicense(boolean value);

public abstract Builder incompatibleNoOutputAttrDefault(boolean value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,7 @@ public void visit(FuncallExpression node) {
+ "explicitly.");
}
}
if (env.getSemantics().incompatibleNoKwargsInBuildFiles()) {
super.visit(node);
}
super.visit(node);
}
};
checker.visitAll(statements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E
"--incompatible_expand_directories=" + rand.nextBoolean(),
"--incompatible_new_actions_api=" + rand.nextBoolean(),
"--incompatible_no_attr_license=" + rand.nextBoolean(),
"--incompatible_no_kwargs_in_build_files=" + rand.nextBoolean(),
"--incompatible_no_output_attr_default=" + rand.nextBoolean(),
"--incompatible_no_rule_outputs_param=" + rand.nextBoolean(),
"--incompatible_no_support_tools_in_action_inputs=" + rand.nextBoolean(),
Expand Down Expand Up @@ -206,7 +205,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
.incompatibleExpandDirectories(rand.nextBoolean())
.incompatibleNewActionsApi(rand.nextBoolean())
.incompatibleNoAttrLicense(rand.nextBoolean())
.incompatibleNoKwargsInBuildFiles(rand.nextBoolean())
.incompatibleNoOutputAttrDefault(rand.nextBoolean())
.incompatibleNoRuleOutputsParam(rand.nextBoolean())
.incompatibleNoSupportToolsInActionInputs(rand.nextBoolean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,24 +705,15 @@ public void testIfStatementForbiddenInBuild() throws Exception {
public void testKwargsForbiddenInBuild() throws Exception {
new BuildTest()
.testIfErrorContains("**kwargs arguments are not allowed in BUILD files", "print(**dict)");

new BuildTest()
.testIfErrorContains(
"**kwargs arguments are not allowed in BUILD files", "len(dict(**{'a': 1}))");
}

@Test
public void testArgsForbiddenInBuild() throws Exception {
new BuildTest()
.testIfErrorContains("*args arguments are not allowed in BUILD files", "print(*['a'])");
}

@Test
public void testIncompatibleKwargsInBuildFiles() throws Exception {
new BuildTest("--incompatible_no_kwargs_in_build_files=true")
.testIfErrorContains(
"kwargs arguments are not allowed in BUILD files", "len(dict(**{'a': 1}))");

new BuildTest("--incompatible_no_kwargs_in_build_files=false")
.testStatement("len(dict(**{'a': 1}))", 1);

new SkylarkTest("--incompatible_no_kwargs_in_build_files")
.testStatement("len(dict(**{'a': 1}))", 1);
}
}

0 comments on commit 0514f71

Please sign in to comment.