Skip to content

Commit

Permalink
[6.2.0]Expose cc_proto_aspect as a toplevel symbol. (bazelbuild#17980)
Browse files Browse the repository at this point in the history
* Expose cc_proto_aspect as a toplevel symbol.

PiperOrigin-RevId: 520619683
Change-Id: Ief39fdc3ea9083c22fbf12d2b4ba79482c3c16bf

* Update CcRules.java

* Revert change

* Revert change

* Revert

* Update exports.bzl

---------

Co-authored-by: Googler <gnish@google.com>
Co-authored-by: keertk <keerthanakumar@google.com>
  • Loading branch information
3 people committed Apr 6, 2023
1 parent 41cfc6c commit 6e18829
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void init(ConfiguredRuleClassProvider.Builder builder) {
GraphNodeAspect graphNodeAspect = new GraphNodeAspect();
builder.addConfigurationFragment(CppConfiguration.class);
builder.addStarlarkAccessibleTopLevels("CcSharedLibraryInfo", Starlark.NONE);
builder.addStarlarkAccessibleTopLevels("cc_proto_aspect", Starlark.NONE);
builder.addBuildInfoFactory(new CppBuildInfo());

builder.addNativeAspectClass(graphNodeAspect);
Expand Down
7 changes: 5 additions & 2 deletions src/main/starlark/builtins_bzl/bazel/exports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
load("@_builtins//:common/java/java_library.bzl", "java_library")
load("@_builtins//:common/java/java_plugin.bzl", "java_plugin")
load("@_builtins//:common/java/proto/java_proto_library.bzl", "java_proto_library")
load("@_builtins//:common/cc/cc_proto_library.bzl", "cc_proto_library")
load("@_builtins//:common/cc/cc_proto_library.bzl", "cc_proto_aspect", "cc_proto_library")

exported_toplevels = {
"cc_proto_aspect": cc_proto_aspect
}

exported_toplevels = {}
exported_rules = {
"java_library": java_library,
"java_plugin": java_plugin,
Expand Down
4 changes: 2 additions & 2 deletions src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def _aspect_impl(target, ctx):
providers.append(header_provider)
return providers

_cc_proto_aspect = aspect(
cc_proto_aspect = aspect(
implementation = _aspect_impl,
attr_aspects = ["deps"],
fragments = ["cpp", "proto"],
Expand Down Expand Up @@ -290,7 +290,7 @@ cc_proto_library = rule(
implementation = _impl,
attrs = {
"deps": attr.label_list(
aspects = [_cc_proto_aspect],
aspects = [cc_proto_aspect],
allow_rules = ["proto_library"],
allow_files = False,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class CcProtoLibraryTest extends BuildViewTestCase {
private final StarlarkAspectClass starlarkCcProtoAspect =
new StarlarkAspectClass(
Label.parseAbsoluteUnchecked("@_builtins//:common/cc/cc_proto_library.bzl"),
"_cc_proto_aspect");
"cc_proto_aspect");

@Before
public void setUp() throws Exception {
Expand Down

0 comments on commit 6e18829

Please sign in to comment.