From d576ed0e9a8372663ae75582517bf0dfb38bb51f Mon Sep 17 00:00:00 2001 From: laurentlb Date: Tue, 26 Mar 2019 15:35:06 -0700 Subject: [PATCH] Remove `--incompatible_disallow_data_transition` flag https://github.com/bazelbuild/bazel/issues/6153 RELNOTES: None. PiperOrigin-RevId: 240442015 --- .../build/lib/analysis/skylark/SkylarkAttr.java | 15 ++------------- .../lib/packages/StarlarkSemanticsOptions.java | 13 ------------- .../build/lib/syntax/StarlarkSemantics.java | 5 ----- .../packages/SkylarkSemanticsConsistencyTest.java | 2 -- .../skylark/SkylarkRuleClassFunctionsTest.java | 10 +--------- 5 files changed, 3 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java index ee191676a61c47..ebff96a420a08a 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkAttr.java @@ -259,17 +259,7 @@ && containsNonNoneKey(arguments, ALLOW_SINGLE_FILE_ARG)) { ast.getLocation(), "late-bound attributes must not have a split configuration transition"); } - if (trans.equals("data")) { - // This used to apply the "disable LIPO" (a.k.a. "data") transition. But now that LIPO is - // turned down this is a noop. Still, there are cfg = "data"' references in the depot. So - // we have to remove them via b/28688645 before we can remove this path. - if (env.getSemantics().incompatibleDisallowDataTransition()) { - throw new EvalException(ast.getLocation(), - "Using cfg = \"data\" on an attribute is a noop and no longer supported. Please " - + "remove it. You can use --incompatible_disallow_data_transition=false to " - + "temporarily disable this check."); - } - } else if (trans.equals("host")) { + if (trans.equals("host")) { builder.cfg(HostTransition.INSTANCE); } else if (trans instanceof SplitTransition) { builder.cfg((SplitTransition) trans); @@ -293,8 +283,7 @@ && containsNonNoneKey(arguments, ALLOW_SINGLE_FILE_ARG)) { builder.cfg(new StarlarkAttributeTransitionProvider(starlarkDefinedTransition)); } else if (!trans.equals("target")) { // TODO(b/121134880): update error message when starlark build configurations is ready. - throw new EvalException( - ast.getLocation(), "cfg must be either 'data', 'host', or 'target'."); + throw new EvalException(ast.getLocation(), "cfg must be either 'host' or 'target'."); } } 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 59b63769bdb845..1a2c2e9415289b 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 @@ -251,18 +251,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl + "--check_third_party_targets_have_licenses") public boolean incompatibleDisableThirdPartyLicenseChecking; - @Option( - name = "incompatible_disallow_data_transition", - 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, rule attributes cannot set 'cfg = \"data\"', which is a noop.") - public boolean incompatibleDisallowDataTransition; - @Option( name = "incompatible_disallow_dict_plus", defaultValue = "true", @@ -560,7 +548,6 @@ public StarlarkSemantics toSkylarkSemantics() { .incompatibleDisableThirdPartyLicenseChecking(incompatibleDisableThirdPartyLicenseChecking) .incompatibleDisableDeprecatedAttrParams(incompatibleDisableDeprecatedAttrParams) .incompatibleDisableObjcProviderResources(incompatibleDisableObjcProviderResources) - .incompatibleDisallowDataTransition(incompatibleDisallowDataTransition) .incompatibleDisallowDictPlus(incompatibleDisallowDictPlus) .incompatibleDisallowFileType(incompatibleDisallowFileType) .incompatibleDisallowLegacyJavaInfo(incompatibleDisallowLegacyJavaInfo) 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 c60216d9d8f0df..abddc4f92b260f 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 @@ -140,8 +140,6 @@ public boolean flagValue(FlagIdentifier flagIdentifier) { public abstract boolean incompatibleDisableObjcProviderResources(); - public abstract boolean incompatibleDisallowDataTransition(); - public abstract boolean incompatibleDisallowDictPlus(); public abstract boolean incompatibleDisallowFileType(); @@ -214,7 +212,6 @@ public static Builder builderWithDefaults() { .incompatibleDisableThirdPartyLicenseChecking(false) .incompatibleDisableDeprecatedAttrParams(false) .incompatibleDisableObjcProviderResources(false) - .incompatibleDisallowDataTransition(true) .incompatibleDisallowDictPlus(true) .incompatibleDisallowFileType(true) .incompatibleDisallowLegacyJavaProvider(false) @@ -270,8 +267,6 @@ public abstract static class Builder { public abstract Builder incompatibleDisableObjcProviderResources(boolean value); - public abstract Builder incompatibleDisallowDataTransition(boolean value); - public abstract Builder incompatibleDisallowDictPlus(boolean value); public abstract Builder incompatibleDisallowFileType(boolean value); diff --git a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java index a7b732b1aace66..ff7874fd5f9230 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java @@ -138,7 +138,6 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E "--incompatible_disable_deprecated_attr_params=" + rand.nextBoolean(), "--incompatible_disable_objc_provider_resources=" + rand.nextBoolean(), "--incompatible_disable_third_party_license_checking=" + rand.nextBoolean(), - "--incompatible_disallow_data_transition=" + rand.nextBoolean(), "--incompatible_disallow_dict_plus=" + rand.nextBoolean(), "--incompatible_disallow_filetype=" + rand.nextBoolean(), "--incompatible_disallow_legacy_javainfo=" + rand.nextBoolean(), @@ -185,7 +184,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) { .incompatibleDisableDeprecatedAttrParams(rand.nextBoolean()) .incompatibleDisableObjcProviderResources(rand.nextBoolean()) .incompatibleDisableThirdPartyLicenseChecking(rand.nextBoolean()) - .incompatibleDisallowDataTransition(rand.nextBoolean()) .incompatibleDisallowDictPlus(rand.nextBoolean()) .incompatibleDisallowFileType(rand.nextBoolean()) .incompatibleDisallowLegacyJavaInfo(rand.nextBoolean()) diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java index f14a30319457ac..382c7bb8618559 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java @@ -594,17 +594,9 @@ public void testAttrCfgTarget() throws Exception { @Test public void incompatibleDataTransition() throws Exception { - ev = - createEvaluationTestCase( - StarlarkSemantics.DEFAULT_SEMANTICS - .toBuilder() - .incompatibleDisallowDataTransition(true) - .build()); - ev.initialize(); EvalException expected = assertThrows(EvalException.class, () -> eval("attr.label(cfg = 'data')")); - assertThat(expected).hasMessageThat().contains( - "Using cfg = \"data\" on an attribute is a noop and no longer supported"); + assertThat(expected).hasMessageThat().contains("cfg must be either 'host' or 'target'"); } @Test