From c2d50de6ce2652e7fd56170663fd11e75098f35c Mon Sep 17 00:00:00 2001 From: Googler Date: Fri, 10 Jun 2022 08:39:04 -0700 Subject: [PATCH] Expose some builtin cc starlark symbols RELNOTES: Exposed `CcSharedLibraryInfo` to Starlark builtins. PiperOrigin-RevId: 454171911 Change-Id: I3cb72086f8a48a9f6ef738304b782ab0d99109c6 --- .../com/google/devtools/build/lib/bazel/rules/CcRules.java | 2 ++ src/main/starlark/builtins_bzl/common/exports.bzl | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/CcRules.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/CcRules.java index 3833f50473cb73..cddcd34c90f8c4 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/CcRules.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/CcRules.java @@ -48,6 +48,7 @@ import com.google.devtools.build.lib.starlarkbuildapi.cpp.CcBootstrap; import com.google.devtools.build.lib.util.ResourceFileLoader; import java.io.IOException; +import net.starlark.java.eval.Starlark; /** * Rules for C++ support in Bazel. @@ -63,6 +64,7 @@ private CcRules() { public void init(ConfiguredRuleClassProvider.Builder builder) { GraphNodeAspect graphNodeAspect = new GraphNodeAspect(); builder.addConfigurationFragment(CppConfiguration.class); + builder.addStarlarkAccessibleTopLevels("CcSharedLibraryInfo", Starlark.NONE); builder.addBuildInfoFactory(new CppBuildInfo()); builder.addNativeAspectClass(graphNodeAspect); diff --git a/src/main/starlark/builtins_bzl/common/exports.bzl b/src/main/starlark/builtins_bzl/common/exports.bzl index 2ae635098b70c1..3453c72bb2feeb 100755 --- a/src/main/starlark/builtins_bzl/common/exports.bzl +++ b/src/main/starlark/builtins_bzl/common/exports.bzl @@ -17,7 +17,7 @@ load("@_builtins//:common/cc/cc_import.bzl", "cc_import") load("@_builtins//:common/cc/cc_binary_wrapper.bzl", "cc_binary") load("@_builtins//:common/cc/cc_test.bzl", cc_test = "cc_test_wrapper") -load("@_builtins//:common/cc/experimental_cc_shared_library.bzl", "cc_shared_library", "cc_shared_library_permissions") +load("@_builtins//:common/cc/experimental_cc_shared_library.bzl", "CcSharedLibraryInfo", "cc_shared_library", "cc_shared_library_permissions") load("@_builtins//:common/objc/objc_import.bzl", "objc_import") load("@_builtins//:common/objc/objc_library.bzl", "objc_library") load("@_builtins//:common/objc/apple_static_library.bzl", "apple_static_library") @@ -34,6 +34,7 @@ exported_toplevels = { # that builtins injection is working properly. Its built-in value is # "original value". "_builtins_dummy": "overridden value", + "CcSharedLibraryInfo": CcSharedLibraryInfo, "proto_common_do_not_use": proto_common_do_not_use, }