Delete obsolete flag --incompatible_disable_deprecated_attr_params It is enable by default since Bazel 0.27 https://github.com/bazelbuild/bazel/issues/5818 RELNOTES: None. PiperOrigin-RevId: 317876348
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkAttrModule.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkAttrModule.java index ac859d3..610b0a7 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkAttrModule.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkAttrModule.java
@@ -157,19 +157,6 @@ builder.setPropertyFlag("MANDATORY"); } - if (containsNonNoneKey(arguments, NON_EMPTY_ARG) - && (Boolean) arguments.get(NON_EMPTY_ARG)) { - if (thread.getSemantics().incompatibleDisableDeprecatedAttrParams()) { - throw new EvalException( - null, - "'non_empty' is no longer supported. use allow_empty instead. You can use " - + "--incompatible_disable_deprecated_attr_params=false to temporarily disable this " - + "check."); - } - - builder.setPropertyFlag("NON_EMPTY"); - } - if (containsNonNoneKey(arguments, ALLOW_EMPTY_ARG) && !(Boolean) arguments.get(ALLOW_EMPTY_ARG)) { builder.setPropertyFlag("NON_EMPTY"); @@ -186,23 +173,6 @@ } } - if (containsNonNoneKey(arguments, SINGLE_FILE_ARG) - && (Boolean) arguments.get(SINGLE_FILE_ARG)) { - if (thread.getSemantics().incompatibleDisableDeprecatedAttrParams()) { - throw new EvalException( - null, - "'single_file' is no longer supported. use allow_single_file instead. You can use " - + "--incompatible_disable_deprecated_attr_params=false to temporarily disable this " - + "check."); - } - if (containsNonNoneKey(arguments, ALLOW_SINGLE_FILE_ARG)) { - throw new EvalException( - null, "Cannot specify both single_file (deprecated) and allow_single_file"); - } - - builder.setPropertyFlag("SINGLE_ARTIFACT"); - } - if (containsNonNoneKey(arguments, ALLOW_FILES_ARG) && containsNonNoneKey(arguments, ALLOW_SINGLE_FILE_ARG)) { throw new EvalException(null, "Cannot specify both allow_files and allow_single_file"); @@ -472,7 +442,6 @@ Boolean mandatory, Sequence<?> providers, Object allowRules, - Boolean singleFile, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -498,8 +467,6 @@ providers, ALLOW_RULES_ARG, allowRules, - SINGLE_FILE_ARG, - singleFile, CONFIGURATION_ARG, cfg, ASPECTS_ARG, @@ -515,7 +482,6 @@ @Override public Descriptor stringListAttribute( Boolean mandatory, - Boolean nonEmpty, Boolean allowEmpty, Sequence<?> defaultValue, String doc, @@ -529,8 +495,6 @@ defaultValue, MANDATORY_ARG, mandatory, - NON_EMPTY_ARG, - nonEmpty, ALLOW_EMPTY_ARG, allowEmpty), Type.STRING_LIST, @@ -540,7 +504,6 @@ @Override public Descriptor intListAttribute( Boolean mandatory, - Boolean nonEmpty, Boolean allowEmpty, Sequence<?> defaultValue, String doc, @@ -554,8 +517,6 @@ defaultValue, MANDATORY_ARG, mandatory, - NON_EMPTY_ARG, - nonEmpty, ALLOW_EMPTY_ARG, allowEmpty), Type.INTEGER_LIST, @@ -572,7 +533,6 @@ Sequence<?> providers, Sequence<?> flags, Boolean mandatory, - Boolean nonEmpty, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -592,8 +552,6 @@ flags, MANDATORY_ARG, mandatory, - NON_EMPTY_ARG, - nonEmpty, ALLOW_EMPTY_ARG, allowEmpty, CONFIGURATION_ARG, @@ -619,7 +577,6 @@ Sequence<?> providers, Sequence<?> flags, Boolean mandatory, - Boolean nonEmpty, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -639,8 +596,6 @@ flags, MANDATORY_ARG, mandatory, - NON_EMPTY_ARG, - nonEmpty, ALLOW_EMPTY_ARG, allowEmpty, CONFIGURATION_ARG, @@ -690,7 +645,6 @@ Boolean allowEmpty, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException { BazelStarlarkContext.from(thread).checkLoadingOrWorkspacePhase("attr.output_list"); @@ -700,8 +654,6 @@ optionMap( MANDATORY_ARG, mandatory, - NON_EMPTY_ARG, - nonEmpty, ALLOW_EMPTY_ARG, allowEmpty), BuildType.OUTPUT_LIST, @@ -714,7 +666,6 @@ Dict<?, ?> defaultValue, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException { BazelStarlarkContext.from(thread).checkLoadingOrWorkspacePhase("attr.string_dict"); @@ -725,8 +676,6 @@ defaultValue, MANDATORY_ARG, mandatory, - NON_EMPTY_ARG, - nonEmpty, ALLOW_EMPTY_ARG, allowEmpty), Type.STRING_DICT, @@ -739,7 +688,6 @@ Dict<?, ?> defaultValue, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException { BazelStarlarkContext.from(thread).checkLoadingOrWorkspacePhase("attr.string_list_dict"); @@ -750,8 +698,6 @@ defaultValue, MANDATORY_ARG, mandatory, - NON_EMPTY_ARG, - nonEmpty, ALLOW_EMPTY_ARG, allowEmpty), Type.STRING_LIST_DICT,
diff --git a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java index 30e371c..da40768 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java +++ b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java
@@ -321,20 +321,6 @@ public boolean incompatibleDisableTargetProviderFields; @Option( - name = "incompatible_disable_deprecated_attr_params", - 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, disable the deprecated parameters 'single_file' and 'non_empty' on " - + "attribute definition methods, such as attr.label().") - public boolean incompatibleDisableDeprecatedAttrParams; - - @Option( name = "incompatible_disable_depset_items", defaultValue = "false", documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS, @@ -674,7 +660,6 @@ .incompatibleDisableTargetProviderFields(incompatibleDisableTargetProviderFields) .incompatibleDisableThirdPartyLicenseChecking( incompatibleDisableThirdPartyLicenseChecking) - .incompatibleDisableDeprecatedAttrParams(incompatibleDisableDeprecatedAttrParams) .incompatibleAlwaysCheckDepsetElements(incompatibleAlwaysCheckDepsetElements) .incompatibleDisableDepsetItems(incompatibleDisableDepsetItems) .incompatibleDisallowEmptyGlob(incompatibleDisallowEmptyGlob)
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/StarlarkAttrModuleApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/StarlarkAttrModuleApi.java index 01b56f3..bfaf5cd 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/StarlarkAttrModuleApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/StarlarkAttrModuleApi.java
@@ -115,10 +115,6 @@ String MANDATORY_DOC = "If true, the value must be specified explicitly (even if it has a <code>default</code>)."; - String NON_EMPTY_ARG = "non_empty"; - String NON_EMPTY_DOC = - "True if the attribute must not be empty. Deprecated: Use <code>allow_empty</code> instead."; - String ALLOW_EMPTY_ARG = "allow_empty"; String ALLOW_EMPTY_DOC = "True if the attribute can be empty."; @@ -133,7 +129,6 @@ + "argument may also be a single-level list of providers, in which case it is wrapped in " + "an outer list with one element."; - String SINGLE_FILE_ARG = "single_file"; String ALLOW_SINGLE_FILE_ARG = "allow_single_file"; String VALUES_ARG = "values"; @@ -316,17 +311,6 @@ positional = false, doc = ALLOW_RULES_DOC), @Param( - name = SINGLE_FILE_ARG, - type = Boolean.class, - defaultValue = "False", - named = true, - positional = false, - doc = - "Deprecated: Use <code>allow_single_file</code> instead. " - + "If True, the label must correspond to a single " - + "<a href=\"File.html\">File</a>. " - + "Access it through <code>ctx.file.<attribute_name></code>."), - @Param( name = CONFIGURATION_ARG, type = Object.class, noneable = true, @@ -359,7 +343,6 @@ Boolean mandatory, Sequence<?> providers, Object allowRules, - Boolean singleFile, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -376,12 +359,6 @@ doc = MANDATORY_DOC, named = true), @Param( - name = NON_EMPTY_ARG, - type = Boolean.class, - defaultValue = "False", - doc = NON_EMPTY_DOC, - named = true), - @Param( name = ALLOW_EMPTY_ARG, type = Boolean.class, defaultValue = "True", @@ -406,7 +383,6 @@ useStarlarkThread = true) Descriptor stringListAttribute( Boolean mandatory, - Boolean nonEmpty, Boolean allowEmpty, Sequence<?> defaultValue, String doc, @@ -424,12 +400,6 @@ doc = MANDATORY_DOC, named = true), @Param( - name = NON_EMPTY_ARG, - type = Boolean.class, - defaultValue = "False", - doc = NON_EMPTY_DOC, - named = true), - @Param( name = ALLOW_EMPTY_ARG, type = Boolean.class, defaultValue = "True", @@ -454,7 +424,6 @@ useStarlarkThread = true) Descriptor intListAttribute( Boolean mandatory, - Boolean nonEmpty, Boolean allowEmpty, Sequence<?> defaultValue, String doc, @@ -534,13 +503,6 @@ positional = false, doc = MANDATORY_DOC), @Param( - name = NON_EMPTY_ARG, - type = Boolean.class, - defaultValue = "False", - named = true, - positional = false, - doc = NON_EMPTY_DOC), - @Param( name = CONFIGURATION_ARG, type = Object.class, noneable = true, @@ -567,7 +529,6 @@ Sequence<?> providers, Sequence<?> flags, Boolean mandatory, - Boolean nonEmpty, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -648,13 +609,6 @@ positional = false, doc = MANDATORY_DOC), @Param( - name = NON_EMPTY_ARG, - type = Boolean.class, - defaultValue = "False", - named = true, - positional = false, - doc = NON_EMPTY_DOC), - @Param( name = CONFIGURATION_ARG, type = Object.class, noneable = true, @@ -681,7 +635,6 @@ Sequence<?> providers, Sequence<?> flags, Boolean mandatory, - Boolean nonEmpty, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -764,18 +717,11 @@ defaultValue = "False", named = true, positional = false, - doc = MANDATORY_DOC), - @Param( - name = NON_EMPTY_ARG, - type = Boolean.class, - defaultValue = "False", - named = true, - positional = false, - doc = NON_EMPTY_DOC) + doc = MANDATORY_DOC) }, useStarlarkThread = true) Descriptor outputListAttribute( - Boolean allowEmpty, String doc, Boolean mandatory, Boolean nonEmpty, StarlarkThread thread) + Boolean allowEmpty, String doc, Boolean mandatory, StarlarkThread thread) throws EvalException; @StarlarkMethod( @@ -810,14 +756,7 @@ named = true, positional = false, defaultValue = "False", - doc = MANDATORY_DOC), - @Param( - name = NON_EMPTY_ARG, - type = Boolean.class, - defaultValue = "False", - named = true, - positional = false, - doc = NON_EMPTY_DOC) + doc = MANDATORY_DOC) }, useStarlarkThread = true) Descriptor stringDictAttribute( @@ -825,7 +764,6 @@ Dict<?, ?> defaultValue, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException; @@ -861,14 +799,7 @@ defaultValue = "False", named = true, positional = false, - doc = MANDATORY_DOC), - @Param( - name = NON_EMPTY_ARG, - type = Boolean.class, - defaultValue = "False", - named = true, - positional = false, - doc = NON_EMPTY_DOC) + doc = MANDATORY_DOC) }, useStarlarkThread = true) Descriptor stringListDictAttribute( @@ -876,7 +807,6 @@ Dict<?, ?> defaultValue, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException;
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java index 91d35d5..ee69211 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java
@@ -236,8 +236,6 @@ public abstract boolean incompatibleDisableThirdPartyLicenseChecking(); - public abstract boolean incompatibleDisableDeprecatedAttrParams(); - public abstract boolean incompatibleDisableDepsetItems(); public abstract boolean incompatibleDisallowEmptyGlob(); @@ -335,7 +333,6 @@ .incompatibleApplicableLicenses(false) .incompatibleDisableTargetProviderFields(false) .incompatibleDisableThirdPartyLicenseChecking(true) - .incompatibleDisableDeprecatedAttrParams(true) .incompatibleDisableDepsetItems(false) .incompatibleDisallowEmptyGlob(false) .incompatibleDisallowStructProviderSyntax(false) @@ -404,8 +401,6 @@ public abstract Builder incompatibleDisableThirdPartyLicenseChecking(boolean value); - public abstract Builder incompatibleDisableDeprecatedAttrParams(boolean value); - public abstract Builder incompatibleDisableDepsetItems(boolean value); public abstract Builder incompatibleDisallowEmptyGlob(boolean value);
diff --git a/src/main/java/com/google/devtools/build/skydoc/SkydocMain.java b/src/main/java/com/google/devtools/build/skydoc/SkydocMain.java index 173e02a..fb9ef4c 100644 --- a/src/main/java/com/google/devtools/build/skydoc/SkydocMain.java +++ b/src/main/java/com/google/devtools/build/skydoc/SkydocMain.java
@@ -194,7 +194,6 @@ .build(); parser.parseAndExitUponError(args); StarlarkSemanticsOptions semanticsOptions = parser.getOptions(StarlarkSemanticsOptions.class); - semanticsOptions.incompatibleDisableDeprecatedAttrParams = false; semanticsOptions.incompatibleNewActionsApi = false; SkydocOptions skydocOptions = parser.getOptions(SkydocOptions.class);
diff --git a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeStarlarkAttrModuleApi.java b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeStarlarkAttrModuleApi.java index 6eba2ed..0a0698c 100644 --- a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeStarlarkAttrModuleApi.java +++ b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeStarlarkAttrModuleApi.java
@@ -71,7 +71,6 @@ Boolean mandatory, Sequence<?> providers, Object allowRules, - Boolean singleFile, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -86,7 +85,6 @@ @Override public Descriptor stringListAttribute( Boolean mandatory, - Boolean nonEmpty, Boolean allowEmpty, Sequence<?> defaultList, String doc, @@ -99,7 +97,6 @@ @Override public Descriptor intListAttribute( Boolean mandatory, - Boolean nonEmpty, Boolean allowEmpty, Sequence<?> defaultList, String doc, @@ -119,7 +116,6 @@ Sequence<?> providers, Sequence<?> flags, Boolean mandatory, - Boolean nonEmpty, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -141,7 +137,6 @@ Sequence<?> providers, Sequence<?> flags, Boolean mandatory, - Boolean nonEmpty, Object cfg, Sequence<?> aspects, StarlarkThread thread) @@ -176,7 +171,6 @@ Boolean allowEmpty, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException { return new FakeDescriptor(AttributeType.OUTPUT_LIST, doc, mandatory, ImmutableList.of(), ""); @@ -188,7 +182,6 @@ Dict<?, ?> defaultO, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException { return new FakeDescriptor( @@ -201,7 +194,6 @@ Dict<?, ?> defaultO, String doc, Boolean mandatory, - Boolean nonEmpty, StarlarkThread thread) throws EvalException { return new FakeDescriptor(
diff --git a/src/test/java/com/google/devtools/build/lib/packages/StarlarkSemanticsConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/StarlarkSemanticsConsistencyTest.java index 0d5730b..3b1aeb2 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/StarlarkSemanticsConsistencyTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/StarlarkSemanticsConsistencyTest.java
@@ -142,7 +142,6 @@ "--incompatible_applicable_licenses=" + rand.nextBoolean(), "--incompatible_depset_for_libraries_to_link_getter=" + rand.nextBoolean(), "--incompatible_disable_target_provider_fields=" + rand.nextBoolean(), - "--incompatible_disable_deprecated_attr_params=" + rand.nextBoolean(), "--incompatible_disable_depset_items=" + rand.nextBoolean(), "--incompatible_disable_third_party_license_checking=" + rand.nextBoolean(), "--incompatible_disallow_empty_glob=" + rand.nextBoolean(), @@ -194,7 +193,6 @@ .incompatibleApplicableLicenses(rand.nextBoolean()) .incompatibleDepsetForLibrariesToLinkGetter(rand.nextBoolean()) .incompatibleDisableTargetProviderFields(rand.nextBoolean()) - .incompatibleDisableDeprecatedAttrParams(rand.nextBoolean()) .incompatibleDisableDepsetItems(rand.nextBoolean()) .incompatibleDisableThirdPartyLicenseChecking(rand.nextBoolean()) .incompatibleDisallowEmptyGlob(rand.nextBoolean())
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleClassFunctionsTest.java index 7d2de2d..dadd537 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleClassFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleClassFunctionsTest.java
@@ -269,26 +269,6 @@ } @Test - public void testDisableDeprecatedParams() throws Exception { - setStarlarkSemanticsOptions("--incompatible_disable_deprecated_attr_params=true"); - - // Verify 'single_file' deprecation. - EvalException expected = - assertThrows(EvalException.class, () -> ev.eval("attr.label(single_file = True)")); - assertThat(expected).hasMessageThat().contains( - "'single_file' is no longer supported. use allow_single_file instead."); - Attribute attr = buildAttribute("a1", "attr.label(allow_single_file = ['.xml'])"); - assertThat(attr.isSingleArtifact()).isTrue(); - - // Verify 'non_empty' deprecation. - expected = assertThrows(EvalException.class, () -> ev.eval("attr.string_list(non_empty=True)")); - assertThat(expected).hasMessageThat().contains( - "'non_empty' is no longer supported. use allow_empty instead."); - attr = buildAttribute("a2", "attr.string_list(allow_empty=False)"); - assertThat(attr.isNonEmpty()).isTrue(); - } - - @Test public void testAttrAllowedSingleFileTypesWrongType() throws Exception { ev.checkEvalErrorContains( "allow_single_file should be a boolean or a string list", @@ -617,15 +597,6 @@ } @Test - public void testAttrNonEmpty() throws Exception { - setStarlarkSemanticsOptions("--incompatible_disable_deprecated_attr_params=false"); - - Attribute attr = buildAttribute("a1", "attr.string_list(non_empty=True)"); - assertThat(attr.isNonEmpty()).isTrue(); - assertThat(attr.isMandatory()).isFalse(); - } - - @Test public void testAttrAllowEmpty() throws Exception { Attribute attr = buildAttribute("a1", "attr.string_list(allow_empty=False)"); assertThat(attr.isNonEmpty()).isTrue(); @@ -733,9 +704,6 @@ "attr.label(default=f)", "attr.label_list(default=f)", "attr.label_keyed_string_dict(default=f)"); - // Note: the default parameter of attr.output{,_list} is deprecated - // (see --incompatible_no_output_attr_default) - // For all other attribute types, the default value may not be a function. // // (This is a regression test for github.com/bazelbuild/bazel/issues/9463.
diff --git a/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java b/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java index ad9bd95..c054324 100644 --- a/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java +++ b/src/test/java/com/google/devtools/build/skydoc/SkydocTest.java
@@ -112,7 +112,7 @@ " doc = 'This is my rule. It does stuff.',", " implementation = rule_impl,", " attrs = {", - " 'a': attr.label(mandatory=True, allow_files=True, single_file=True),", + " 'a': attr.label(mandatory=True, allow_single_file=True),", " 'b': attr.string_dict(mandatory=True),", " 'c': attr.output(mandatory=True),", " 'd': attr.bool(default=False, mandatory=False),",