Skip to content

Commit

Permalink
Expose proto generated sources via OutputGroup (#1827)
Browse files Browse the repository at this point in the history
* Expose go_proto_library generated sources via "go_generated_srcs" OutputGroup.
* Rename cgo target to avoid invalid characters.
  • Loading branch information
ceason authored and jayconrod committed Nov 28, 2018
1 parent 3f51f3f commit 45e26a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go/private/rules/cgo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def setup_cgo_library(name, srcs, cdeps, copts, cxxopts, cppopts, clinkopts, obj
cgo_mode_info[cgo_info_name] = _encode_cgo_mode(goos, goarch, race = False, msan = True)

# Collect everything in a single embedable, aspect-friendly library.
cgo_embed_name = name + "%cgo_embed"
cgo_embed_name = name + "__cgo_embed"
_cgo_select_embed(
name = cgo_embed_name,
info = cgo_mode_info,
Expand Down
30 changes: 15 additions & 15 deletions proto/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ def _go_proto_library_impl(ctx):
srcs = go_srcs,
)
source = go.library_to_source(go, ctx.attr, library, False)
if not valid_archive:
return [library, source]
archive = go.archive(go, source)
return [
library,
source,
archive,
DefaultInfo(
files = depset([archive.data.file]),
runfiles = archive.runfiles,
),
OutputGroupInfo(
compilation_outputs = [archive.data.file],
),
]
providers = [library, source]
output_groups = {
"go_generated_srcs": go_srcs,
}
if valid_archive:
archive = go.archive(go, source)
output_groups["compilation_outputs"] = [archive.data.file]
providers.extend([
archive,
DefaultInfo(
files = depset([archive.data.file]),
runfiles = archive.runfiles,
),
])
return providers + [OutputGroupInfo(**output_groups)]

go_proto_library = go_rule(
_go_proto_library_impl,
Expand Down

0 comments on commit 45e26a2

Please sign in to comment.