Skip to content

Commit

Permalink
Remove the flag incompatible_no_transitive_loads.
Browse files Browse the repository at this point in the history
#5636

RELNOTES: None.
PiperOrigin-RevId: 279183449
  • Loading branch information
laurentlb authored and copybara-github committed Nov 7, 2019
1 parent 7828dae commit cdac07f
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,20 +520,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
help = "If set to true, disables the output_group field of the 'Target' Starlark type.")
public boolean incompatibleNoTargetOutputGroup;

@Option(
name = "incompatible_no_transitive_loads",
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, only symbols explicitly defined in the file can be loaded; "
+ "symbols introduced by load are not implicitly re-exported.")
public boolean incompatibleNoTransitiveLoads;

@Option(
name = "incompatible_remap_main_repo",
defaultValue = "false",
Expand Down Expand Up @@ -683,7 +669,6 @@ public StarlarkSemantics toSkylarkSemantics() {
.incompatibleNoRuleOutputsParam(incompatibleNoRuleOutputsParam)
.incompatibleNoSupportToolsInActionInputs(incompatibleNoSupportToolsInActionInputs)
.incompatibleNoTargetOutputGroup(incompatibleNoTargetOutputGroup)
.incompatibleNoTransitiveLoads(incompatibleNoTransitiveLoads)
.incompatibleRemapMainRepo(incompatibleRemapMainRepo)
.incompatibleRemoveNativeMavenJar(incompatibleRemoveNativeMavenJar)
.incompatibleRestrictNamedParams(incompatibleRestrictNamedParams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ public boolean flagValue(FlagIdentifier flagIdentifier) {

public abstract boolean incompatibleNoTargetOutputGroup();

public abstract boolean incompatibleNoTransitiveLoads();

public abstract boolean incompatibleRemapMainRepo();

public abstract boolean incompatibleRemoveNativeMavenJar();
Expand Down Expand Up @@ -278,7 +276,6 @@ public static Builder builderWithDefaults() {
.incompatibleNoRuleOutputsParam(false)
.incompatibleNoSupportToolsInActionInputs(true)
.incompatibleNoTargetOutputGroup(true)
.incompatibleNoTransitiveLoads(true)
.incompatibleRemapMainRepo(false)
.incompatibleRemoveNativeMavenJar(false)
.incompatibleRunShellCommandString(false)
Expand Down Expand Up @@ -359,8 +356,6 @@ public abstract static class Builder {

public abstract Builder incompatibleNoTargetOutputGroup(boolean value);

public abstract Builder incompatibleNoTransitiveLoads(boolean value);

public abstract Builder incompatibleRemapMainRepo(boolean value);

public abstract Builder incompatibleRemoveNativeMavenJar(boolean value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,7 @@ public Extension(StarlarkThread thread) {
// Legacy behavior: all symbols from the global Frame are exported (including symbols
// introduced by load).
this(
ImmutableMap.copyOf(
thread.getSemantics().incompatibleNoTransitiveLoads()
? thread.globalFrame.getExportedBindings()
: thread.globalFrame.getBindings()),
ImmutableMap.copyOf(thread.globalFrame.getExportedBindings()),
thread.getTransitiveContentHashCode());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E
"--incompatible_no_rule_outputs_param=" + rand.nextBoolean(),
"--incompatible_no_support_tools_in_action_inputs=" + rand.nextBoolean(),
"--incompatible_no_target_output_group=" + rand.nextBoolean(),
"--incompatible_no_transitive_loads=" + rand.nextBoolean(),
"--incompatible_remap_main_repo=" + rand.nextBoolean(),
"--incompatible_remove_native_maven_jar=" + rand.nextBoolean(),
"--incompatible_restrict_named_params=" + rand.nextBoolean(),
Expand Down Expand Up @@ -207,7 +206,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
.incompatibleNoRuleOutputsParam(rand.nextBoolean())
.incompatibleNoSupportToolsInActionInputs(rand.nextBoolean())
.incompatibleNoTargetOutputGroup(rand.nextBoolean())
.incompatibleNoTransitiveLoads(rand.nextBoolean())
.incompatibleRemapMainRepo(rand.nextBoolean())
.incompatibleRemoveNativeMavenJar(rand.nextBoolean())
.incompatibleRestrictNamedParams(rand.nextBoolean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1663,54 +1663,6 @@ public void testRecursiveImport2() throws Exception {
+ "`-- //test/skylark:ext2.bzl");
}

@Test
public void testSymbolPropagateThroughImports() throws Exception {
setSkylarkSemanticsOptions("--incompatible_no_transitive_loads=false");
scratch.file("test/skylark/implementation.bzl", "def custom_rule_impl(ctx):", " return None");

scratch.file(
"test/skylark/extension2.bzl",
"load('//test/skylark:implementation.bzl', 'custom_rule_impl')");

scratch.file(
"test/skylark/extension1.bzl",
"load('//test/skylark:extension2.bzl', 'custom_rule_impl')",
"",
"custom_rule = rule(implementation = custom_rule_impl)");

scratch.file(
"test/skylark/BUILD",
"load('//test/skylark:extension1.bzl', 'custom_rule')",
"custom_rule(name = 'cr')");

getConfiguredTarget("//test/skylark:cr");
}

@Test
public void testSymbolDoNotPropagateThroughImports() throws Exception {
setSkylarkSemanticsOptions("--incompatible_no_transitive_loads=true");
scratch.file("test/skylark/implementation.bzl", "def custom_rule_impl(ctx):", " return None");

scratch.file(
"test/skylark/extension2.bzl",
"load('//test/skylark:implementation.bzl', 'custom_rule_impl')");

scratch.file(
"test/skylark/extension1.bzl",
"load('//test/skylark:extension2.bzl', 'custom_rule_impl')",
"",
"custom_rule = rule(implementation = custom_rule_impl)");

scratch.file(
"test/skylark/BUILD",
"load('//test/skylark:extension1.bzl', 'custom_rule')",
"custom_rule(name = 'cr')");

reporter.removeHandler(failFastHandler);
getConfiguredTarget("//test/skylark:cr");
assertContainsEvent("does not contain symbol 'custom_rule_impl'");
}

@Test
public void testLoadSymbolTypo() throws Exception {
scratch.file("test/skylark/ext1.bzl", "myvariable = 2");
Expand Down

0 comments on commit cdac07f

Please sign in to comment.