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/bazel#8021

    RELNOTES: None.
    PiperOrigin-RevId: 253049309
  • Loading branch information
Luca Di Grazia committed Sep 4, 2022
1 parent 9c87711 commit b7e4bea
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,20 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
help = "If set to true, the label argument to 'load' cannot cross a package boundary.")
public boolean incompatibleDisallowLoadLabelsToCrossPackageBoundaries;

@Option(
name = "incompatible_disallow_native_in_build_file",
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, the native module is not accessible in BUILD files. "
+ "Use for example `cc_library` instead of `native.cc_library`.")
public boolean incompatibleDisallowNativeInBuildFile;

@Option(
name = "incompatible_disallow_rule_execution_platform_constraints_allowed",
defaultValue = "False",
Expand Down Expand Up @@ -609,6 +623,7 @@ public StarlarkSemantics toSkylarkSemantics() {
.incompatibleDisallowLegacyJavaProvider(incompatibleDisallowLegacyJavaProvider)
.incompatibleDisallowLoadLabelsToCrossPackageBoundaries(
incompatibleDisallowLoadLabelsToCrossPackageBoundaries)
.incompatibleDisallowNativeInBuildFile(incompatibleDisallowNativeInBuildFile)
.incompatibleDisallowOldStyleArgsAdd(incompatibleDisallowOldStyleArgsAdd)
.incompatibleDisallowStructProviderSyntax(incompatibleDisallowStructProviderSyntax)
.incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ public boolean flagValue(FlagIdentifier flagIdentifier) {

public abstract boolean incompatibleDisallowLoadLabelsToCrossPackageBoundaries();

public abstract boolean incompatibleDisallowNativeInBuildFile();

public abstract boolean incompatibleDisallowOldStyleArgsAdd();

public abstract boolean incompatibleDisallowRuleExecutionPlatformConstraintsAllowed();
Expand Down Expand Up @@ -250,6 +252,7 @@ public static Builder builderWithDefaults() {
.incompatibleDisallowLegacyJavaProvider(false)
.incompatibleDisallowLegacyJavaInfo(false)
.incompatibleDisallowLoadLabelsToCrossPackageBoundaries(true)
.incompatibleDisallowNativeInBuildFile(true)
.incompatibleDisallowOldStyleArgsAdd(true)
.incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(false)
.incompatibleDisallowStructProviderSyntax(false)
Expand Down Expand Up @@ -319,6 +322,8 @@ public abstract static class Builder {

public abstract Builder incompatibleDisallowOldStyleArgsAdd(boolean value);

public abstract Builder incompatibleDisallowNativeInBuildFile(boolean value);

public abstract Builder incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(
boolean value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E
"--incompatible_disallow_legacy_javainfo=" + rand.nextBoolean(),
"--incompatible_disallow_legacy_java_provider=" + rand.nextBoolean(),
"--incompatible_disallow_load_labels_to_cross_package_boundaries=" + rand.nextBoolean(),
"--incompatible_disallow_native_in_build_file=" + rand.nextBoolean(),
"--incompatible_disallow_old_style_args_add=" + rand.nextBoolean(),
"--incompatible_disallow_struct_provider_syntax=" + rand.nextBoolean(),
"--incompatible_disallow_rule_execution_platform_constraints_allowed=" + rand.nextBoolean(),
Expand Down Expand Up @@ -196,6 +197,7 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
.incompatibleDisallowLegacyJavaInfo(rand.nextBoolean())
.incompatibleDisallowLegacyJavaProvider(rand.nextBoolean())
.incompatibleDisallowLoadLabelsToCrossPackageBoundaries(rand.nextBoolean())
.incompatibleDisallowNativeInBuildFile(rand.nextBoolean())
.incompatibleDisallowOldStyleArgsAdd(rand.nextBoolean())
.incompatibleDisallowStructProviderSyntax(rand.nextBoolean())
.incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(rand.nextBoolean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testExprs() throws Exception {
.testStatement("8 % 3", 2)
.testIfErrorContains("unsupported operand type(s) for %: 'int' and 'string'", "3 % 'foo'")
.testStatement("-5", -5)
.testIfErrorContains("unsupported unary operation: -string", "-'foo'");
.testIfErrorContains("unsupported operand type for -: 'string'", "-'foo'");
}

@Test
Expand Down Expand Up @@ -674,9 +674,9 @@ public void testDictKeysDuplicateKeyArgs() throws Exception {
public void testArgBothPosKey() throws Exception {
newTest()
.testIfErrorContains(
"got multiple values for keyword argument 'base', "
+ "for call to function int(x, base = unbound)",
"int('2', 3, base=3)");
"got multiple values for keyword argument 'old', for call to method "
+ "replace(old, new, maxsplit = None) of 'string'",
"'banana'.replace('a', 'o', 3, old='a')");
}

@Test
Expand Down

0 comments on commit b7e4bea

Please sign in to comment.