diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingContext.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingContext.java index 5e420f3ede1aa0..38ac1f43bddf90 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingContext.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingContext.java @@ -30,7 +30,6 @@ import com.google.devtools.build.lib.packages.SymbolGenerator; import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions; import com.google.devtools.build.lib.starlarkbuildapi.cpp.CcLinkingContextApi; -import com.google.devtools.build.lib.starlarkbuildapi.cpp.ExtraLinkTimeLibraryApi; import com.google.devtools.build.lib.starlarkbuildapi.cpp.LinkerInputApi; import com.google.devtools.build.lib.starlarkbuildapi.cpp.LinkstampApi; import com.google.devtools.build.lib.util.Fingerprint; @@ -498,22 +497,6 @@ public Depset getStarlarkNonCodeInputs() { return Depset.of(Artifact.TYPE, getNonCodeInputs()); } - @Override - public ExtraLinkTimeLibraryApi getGoLinkCArchiveForStarlark(StarlarkThread thread) - throws EvalException { - CcModule.checkPrivateStarlarkificationAllowlist(thread); - ExtraLinkTimeLibrary goLinkCArchive = null; - if (extraLinkTimeLibraries != null) { - for (ExtraLinkTimeLibrary extraLibrary : extraLinkTimeLibraries.getExtraLibraries()) { - if (goLinkCArchive != null) { - throw new EvalException("multiple GoLinkCArchive entries in go_link_c_archive"); - } - goLinkCArchive = extraLibrary; - } - } - return goLinkCArchive; - } - public NestedSet getUserLinkFlags() { NestedSetBuilder userLinkFlags = NestedSetBuilder.linkOrder(); for (LinkerInput linkerInput : linkerInputs.toList()) { diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcLinkingContextApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcLinkingContextApi.java index 52c49543156eb1..4069dd8e73d492 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcLinkingContextApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/cpp/CcLinkingContextApi.java @@ -18,7 +18,6 @@ import com.google.devtools.build.lib.collect.nestedset.Depset; import com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions; import com.google.devtools.build.lib.starlarkbuildapi.FileApi; -import javax.annotation.Nullable; import net.starlark.java.annot.StarlarkBuiltin; import net.starlark.java.annot.StarlarkMethod; import net.starlark.java.eval.EvalException; @@ -72,14 +71,6 @@ public interface CcLinkingContextApi extends StarlarkValu @StarlarkMethod(name = "linkstamps", documented = false, useStarlarkThread = true) Depset getLinkstampsForStarlark(StarlarkThread thread) throws EvalException; - @StarlarkMethod( - name = "go_link_c_archive", - documented = false, - allowReturnNones = true, - useStarlarkThread = true) - @Nullable - ExtraLinkTimeLibraryApi getGoLinkCArchiveForStarlark(StarlarkThread thread) throws EvalException; - @StarlarkMethod(name = "extra_link_time_libraries", documented = false, useStarlarkThread = true) public Object getExtraLinkTimeLibrariesForStarlark(StarlarkThread thread) throws EvalException; } diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java index 51a4a411cddc44..a4ae92fbcfa0cd 100755 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java @@ -7461,36 +7461,6 @@ public void testExpandedLinkstampApiRaisesError() throws Exception { } } - @Test - public void testExtraLinkTimeLibraryApiRaisesError() throws Exception { - scratch.file( - "b/BUILD", - "load('//b:rule.bzl', 'cc_rule')", - "cc_library(name='cc_dep', srcs=['cc_dep.cc'])", - "cc_rule(name='foo', cc_dep=':cc_dep')"); - ImmutableList calls = - ImmutableList.of( - "cc_common.create_linking_context(linker_inputs=depset([]), go_link_c_archive=None)", - "linking_context.go_link_c_archive()"); - for (String call : calls) { - scratch.overwriteFile( - "b/rule.bzl", - "def _impl(ctx):", - " linking_context = ctx.attr.cc_dep[CcInfo].linking_context", - " " + call, - " return [DefaultInfo()]", - "cc_rule = rule(", - " implementation = _impl,", - " attrs = { ", - " 'cc_dep': attr.label(),", - " },", - ")"); - invalidatePackages(); - AssertionError e = assertThrows(AssertionError.class, () -> getConfiguredTarget("//b:foo")); - assertThat(e).hasMessageThat().contains("Rule in 'b' cannot use private API"); - } - } - @Test public void testVariableExtensionCompileApi() throws Exception { createFilesForTestingCompilation(