From f34458b65f6ac8605f29f8773e43c545578b1f91 Mon Sep 17 00:00:00 2001 From: plf Date: Fri, 31 May 2019 01:21:04 -0700 Subject: [PATCH] C++: Flips incompatible_depset_for_libraries_to_link_getter Testing downstream works https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/994 upb breakage is unrelated. Filed https://github.com/protocolbuffers/upb/issues/174 just in case. GH issue: #8118 Please do not rollback, fix is very easy following instructions in GH issue. RELNOTES:none PiperOrigin-RevId: 250844223 --- .../build/lib/packages/StarlarkSemanticsOptions.java | 2 +- .../devtools/build/lib/syntax/StarlarkSemantics.java | 2 +- .../devtools/build/lib/rules/cpp/SkylarkCcCommonTest.java | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) 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 ab878fc6964881..eeaa816633589e 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 @@ -600,7 +600,7 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl @Option( name = "incompatible_depset_for_libraries_to_link_getter", - defaultValue = "false", + defaultValue = "true", documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS, effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, metadataTags = { 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 b8763973e3ab0f..2acf95506ae958 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 @@ -259,7 +259,7 @@ public static Builder builderWithDefaults() { .incompatibleStringJoinRequiresStrings(true) .internalSkylarkFlagTestCanary(false) .incompatibleDoNotSplitLinkingCmdline(true) - .incompatibleDepsetForLibrariesToLinkGetter(false) + .incompatibleDepsetForLibrariesToLinkGetter(true) .build(); /** Builder for {@link StarlarkSemantics}. All fields are mandatory. */ diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/SkylarkCcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/SkylarkCcCommonTest.java index 2a2a4eead524ce..ced60083fa03a6 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/SkylarkCcCommonTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/SkylarkCcCommonTest.java @@ -63,6 +63,7 @@ import com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.ToolPath; import com.google.protobuf.TextFormat; import java.io.IOException; +import java.util.Collection; import java.util.List; import org.junit.Before; import org.junit.Test; @@ -1212,6 +1213,7 @@ private void doTestCcLinkingContext( List dynamicLibraryList) throws Exception { useConfiguration("--features=-supports_interface_shared_libraries"); + setSkylarkSemanticsOptions("--incompatible_depset_for_libraries_to_link_getter"); setUpCcLinkingContextTest(); ConfiguredTarget a = getConfiguredTarget("//a:a"); @@ -1229,8 +1231,9 @@ private void doTestCcLinkingContext( .collect(ImmutableList.toImmutableList())) .containsExactly("b.lds", "d.lds"); @SuppressWarnings("unchecked") - SkylarkList librariesToLink = - (SkylarkList) info.getValue("libraries_to_link", SkylarkList.class); + Collection librariesToLink = + info.getValue("libraries_to_link", SkylarkNestedSet.class) + .toCollection(LibraryToLink.class); assertThat( librariesToLink.stream() .filter(x -> x.getStaticLibrary() != null)