Skip to content

Commit

Permalink
Remove --incompatible_disallow_data_transition flag
Browse files Browse the repository at this point in the history
#6153

RELNOTES: None.
PiperOrigin-RevId: 240442015
  • Loading branch information
laurentlb authored and copybara-github committed Mar 26, 2019
1 parent 2ea81ac commit d576ed0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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'.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -560,7 +548,6 @@ public StarlarkSemantics toSkylarkSemantics() {
.incompatibleDisableThirdPartyLicenseChecking(incompatibleDisableThirdPartyLicenseChecking)
.incompatibleDisableDeprecatedAttrParams(incompatibleDisableDeprecatedAttrParams)
.incompatibleDisableObjcProviderResources(incompatibleDisableObjcProviderResources)
.incompatibleDisallowDataTransition(incompatibleDisallowDataTransition)
.incompatibleDisallowDictPlus(incompatibleDisallowDictPlus)
.incompatibleDisallowFileType(incompatibleDisallowFileType)
.incompatibleDisallowLegacyJavaInfo(incompatibleDisallowLegacyJavaInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -214,7 +212,6 @@ public static Builder builderWithDefaults() {
.incompatibleDisableThirdPartyLicenseChecking(false)
.incompatibleDisableDeprecatedAttrParams(false)
.incompatibleDisableObjcProviderResources(false)
.incompatibleDisallowDataTransition(true)
.incompatibleDisallowDictPlus(true)
.incompatibleDisallowFileType(true)
.incompatibleDisallowLegacyJavaProvider(false)
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d576ed0

Please sign in to comment.