Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup _merge_embed #4048

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,16 @@ def _merge_embed(source, embed):
source["x_defs"].update(s.x_defs)
source["gc_goopts"] = source["gc_goopts"] + s.gc_goopts
source["runfiles"] = source["runfiles"].merge(s.runfiles)
if s.cgo and source["cgo"]:
fail("multiple libraries with cgo enabled")
source["cgo"] = source["cgo"] or s.cgo
source["cdeps"] = source["cdeps"] or s.cdeps
source["cppopts"] = source["cppopts"] or s.cppopts
source["copts"] = source["copts"] or s.copts
source["cxxopts"] = source["cxxopts"] or s.cxxopts
source["clinkopts"] = source["clinkopts"] or s.clinkopts

if s.cgo:
if source["cgo"]:
fail("multiple libraries with cgo enabled")
source["cgo"] = s.cgo
source["cdeps"] = s.cdeps
source["cppopts"] = s.cppopts
source["copts"] = s.copts
source["cxxopts"] = s.cxxopts
source["clinkopts"] = s.clinkopts

def _dedup_archives(archives):
"""Returns a list of archives without duplicate import paths.
Expand Down Expand Up @@ -258,9 +260,7 @@ def _library_to_source(go, attr, library, coverage_instrumented):
srcs = attr_srcs + generated_srcs
embedsrcs = [f for t in getattr(attr, "embedsrcs", []) for f in as_iterable(t.files)]
attr_deps = getattr(attr, "deps", [])
generated_deps = getattr(library, "deps", [])
deps = attr_deps + generated_deps
deps = [get_archive(dep) for dep in deps]
deps = [get_archive(dep) for dep in attr_deps]
fmeum marked this conversation as resolved.
Show resolved Hide resolved
source = {
"library": library,
"mode": go.mode,
Expand Down