Skip to content

Commit

Permalink
go_test: use different mnemonic for compilation (#3936)
Browse files Browse the repository at this point in the history
Closes #3935
  • Loading branch information
sluongng committed May 7, 2024
1 parent 35b7f07 commit 6a05f8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
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

0 comments on commit 6a05f8d

Please sign in to comment.