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

go_test: use different mnemonic for compilation #3936

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion go/private/actions/archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ load(
"cgo_configure",
)

def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_deps = None):
def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_deps = None, is_external_pkg = False):
"""See go/toolchains.rst#archive for full documentation."""

if source == None:
Expand Down Expand Up @@ -122,6 +122,7 @@ def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_d
objcxxopts = cgo.objcxxopts,
clinkopts = cgo.clinkopts,
testfilter = testfilter,
is_external_pkg = is_external_pkg,
)
else:
cgo_deps = depset()
Expand All @@ -141,6 +142,7 @@ def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_d
cgo = False,
testfilter = testfilter,
recompile_internal_deps = recompile_internal_deps,
is_external_pkg = is_external_pkg,
)

data = GoArchiveData(
Expand Down
5 changes: 3 additions & 2 deletions go/private/actions/compilepkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def emit_compilepkg(
out_cgo_export_h = None,
gc_goopts = [],
testfilter = None, # TODO: remove when test action compiles packages
recompile_internal_deps = []):
recompile_internal_deps = [],
is_external_pkg = False):
"""Compiles a complete Go package."""
if sources == None:
fail("sources is a required parameter")
Expand Down Expand Up @@ -179,7 +180,7 @@ def emit_compilepkg(
go.actions.run(
inputs = inputs,
outputs = outputs,
mnemonic = "GoCompilePkg",
mnemonic = "GoCompilePkgExternal" if is_external_pkg else "GoCompilePkg",
executable = go.toolchain._builder,
arguments = [args],
env = go.env,
Expand Down
2 changes: 1 addition & 1 deletion go/private/rules/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _go_test_impl(ctx):
x_defs = ctx.attr.x_defs,
), external_library, ctx.coverage_instrumented())
external_source, internal_archive = _recompile_external_deps(go, external_source, internal_archive, [t.label for t in ctx.attr.embed])
external_archive = go.archive(go, external_source)
external_archive = go.archive(go, external_source, is_external_pkg = True)

# now generate the main function
repo_relative_rundir = ctx.attr.rundir or ctx.label.package or "."
Expand Down