Skip to content

Commit

Permalink
Delete obsolete flag --incompatible_disable_deprecated_attr_params
Browse files Browse the repository at this point in the history
It is enable by default since Bazel 0.27

#5818

RELNOTES: None.
PiperOrigin-RevId: 317876348
  • Loading branch information
laurentlb authored and copybara-github committed Jun 23, 2020
1 parent 3a3f5a8 commit 1ed9a07
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,6 @@ private static Attribute.Builder<?> createAttribute(
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");
Expand All @@ -186,23 +173,6 @@ private static Attribute.Builder<?> createAttribute(
}
}

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");
Expand Down Expand Up @@ -472,7 +442,6 @@ public Descriptor labelAttribute(
Boolean mandatory,
Sequence<?> providers,
Object allowRules,
Boolean singleFile,
Object cfg,
Sequence<?> aspects,
StarlarkThread thread)
Expand All @@ -498,8 +467,6 @@ public Descriptor labelAttribute(
providers,
ALLOW_RULES_ARG,
allowRules,
SINGLE_FILE_ARG,
singleFile,
CONFIGURATION_ARG,
cfg,
ASPECTS_ARG,
Expand All @@ -515,7 +482,6 @@ public Descriptor labelAttribute(
@Override
public Descriptor stringListAttribute(
Boolean mandatory,
Boolean nonEmpty,
Boolean allowEmpty,
Sequence<?> defaultValue,
String doc,
Expand All @@ -529,8 +495,6 @@ public Descriptor stringListAttribute(
defaultValue,
MANDATORY_ARG,
mandatory,
NON_EMPTY_ARG,
nonEmpty,
ALLOW_EMPTY_ARG,
allowEmpty),
Type.STRING_LIST,
Expand All @@ -540,7 +504,6 @@ public Descriptor stringListAttribute(
@Override
public Descriptor intListAttribute(
Boolean mandatory,
Boolean nonEmpty,
Boolean allowEmpty,
Sequence<?> defaultValue,
String doc,
Expand All @@ -554,8 +517,6 @@ public Descriptor intListAttribute(
defaultValue,
MANDATORY_ARG,
mandatory,
NON_EMPTY_ARG,
nonEmpty,
ALLOW_EMPTY_ARG,
allowEmpty),
Type.INTEGER_LIST,
Expand All @@ -572,7 +533,6 @@ public Descriptor labelListAttribute(
Sequence<?> providers,
Sequence<?> flags,
Boolean mandatory,
Boolean nonEmpty,
Object cfg,
Sequence<?> aspects,
StarlarkThread thread)
Expand All @@ -592,8 +552,6 @@ public Descriptor labelListAttribute(
flags,
MANDATORY_ARG,
mandatory,
NON_EMPTY_ARG,
nonEmpty,
ALLOW_EMPTY_ARG,
allowEmpty,
CONFIGURATION_ARG,
Expand All @@ -619,7 +577,6 @@ public Descriptor labelKeyedStringDictAttribute(
Sequence<?> providers,
Sequence<?> flags,
Boolean mandatory,
Boolean nonEmpty,
Object cfg,
Sequence<?> aspects,
StarlarkThread thread)
Expand All @@ -639,8 +596,6 @@ public Descriptor labelKeyedStringDictAttribute(
flags,
MANDATORY_ARG,
mandatory,
NON_EMPTY_ARG,
nonEmpty,
ALLOW_EMPTY_ARG,
allowEmpty,
CONFIGURATION_ARG,
Expand Down Expand Up @@ -690,7 +645,6 @@ public Descriptor outputListAttribute(
Boolean allowEmpty,
String doc,
Boolean mandatory,
Boolean nonEmpty,
StarlarkThread thread)
throws EvalException {
BazelStarlarkContext.from(thread).checkLoadingOrWorkspacePhase("attr.output_list");
Expand All @@ -700,8 +654,6 @@ public Descriptor outputListAttribute(
optionMap(
MANDATORY_ARG,
mandatory,
NON_EMPTY_ARG,
nonEmpty,
ALLOW_EMPTY_ARG,
allowEmpty),
BuildType.OUTPUT_LIST,
Expand All @@ -714,7 +666,6 @@ public Descriptor stringDictAttribute(
Dict<?, ?> defaultValue,
String doc,
Boolean mandatory,
Boolean nonEmpty,
StarlarkThread thread)
throws EvalException {
BazelStarlarkContext.from(thread).checkLoadingOrWorkspacePhase("attr.string_dict");
Expand All @@ -725,8 +676,6 @@ public Descriptor stringDictAttribute(
defaultValue,
MANDATORY_ARG,
mandatory,
NON_EMPTY_ARG,
nonEmpty,
ALLOW_EMPTY_ARG,
allowEmpty),
Type.STRING_DICT,
Expand All @@ -739,7 +688,6 @@ public Descriptor stringListDictAttribute(
Dict<?, ?> defaultValue,
String doc,
Boolean mandatory,
Boolean nonEmpty,
StarlarkThread thread)
throws EvalException {
BazelStarlarkContext.from(thread).checkLoadingOrWorkspacePhase("attr.string_list_dict");
Expand All @@ -750,8 +698,6 @@ public Descriptor stringListDictAttribute(
defaultValue,
MANDATORY_ARG,
mandatory,
NON_EMPTY_ARG,
nonEmpty,
ALLOW_EMPTY_ARG,
allowEmpty),
Type.STRING_LIST_DICT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,20 +320,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
+ "https://github.com/bazelbuild/bazel/issues/9014 for details.")
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",
Expand Down Expand Up @@ -674,7 +660,6 @@ public StarlarkSemantics toStarlarkSemantics() {
.incompatibleDisableTargetProviderFields(incompatibleDisableTargetProviderFields)
.incompatibleDisableThirdPartyLicenseChecking(
incompatibleDisableThirdPartyLicenseChecking)
.incompatibleDisableDeprecatedAttrParams(incompatibleDisableDeprecatedAttrParams)
.incompatibleAlwaysCheckDepsetElements(incompatibleAlwaysCheckDepsetElements)
.incompatibleDisableDepsetItems(incompatibleDisableDepsetItems)
.incompatibleDisallowEmptyGlob(incompatibleDisallowEmptyGlob)
Expand Down
Loading

0 comments on commit 1ed9a07

Please sign in to comment.