Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 493604329
Change-Id: Ia1751c6f5a5ee65d4e3622da30aae30354ea9652
  • Loading branch information
c-mita authored and copybara-github committed Dec 7, 2022
1 parent 47cc11f commit 011e108
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<LinkOptions> getUserLinkFlags() {
NestedSetBuilder<LinkOptions> userLinkFlags = NestedSetBuilder.linkOrder();
for (LinkerInput linkerInput : linkerInputs.toList()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,14 +71,6 @@ public interface CcLinkingContextApi<FileT extends FileApi> 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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(
Expand Down

0 comments on commit 011e108

Please sign in to comment.