Skip to content
Closed
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
3 changes: 2 additions & 1 deletion tools/bazeldefs/go.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
load("@bazel_gazelle//:def.bzl", _gazelle = "gazelle")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:shell.bzl", "shell")
load("@io_bazel_rules_go//go:def.bzl", "GoArchive", "GoLibrary", _go_binary = "go_binary", _go_context = "go_context", _go_library = "go_library", _go_path = "go_path", _go_test = "go_test")
load("@io_bazel_rules_go//go:def.bzl", "GoArchive", "GoLibrary", _go_binary = "go_binary", _go_context = "go_context", _go_library = "go_library", _go_path = "go_path", _go_reset_target = "go_reset_target", _go_test = "go_test")
load("@io_bazel_rules_go//proto:def.bzl", _go_grpc_library = "go_grpc_library", _go_proto_library = "go_proto_library")
load("//tools/bazeldefs:defs.bzl", "select_arch", "select_system")

gazelle = _gazelle

go_path = _go_path
go_reset_target = _go_reset_target
go_cov = native.genrule
cov_available = True

Expand Down
3 changes: 2 additions & 1 deletion tools/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ change for Google-internal and bazel-compatible rules.
load("//tools:arch.bzl", "arch_genrule", "arch_transition_impl")
load("//tools/bazeldefs:cc.bzl", _cc_binary = "cc_binary", _cc_flags_supplier = "cc_flags_supplier", _cc_grpc_library = "cc_grpc_library", _cc_library = "cc_library", _cc_proto_library = "cc_proto_library", _cc_test = "cc_test", _cc_toolchain = "cc_toolchain", _gbenchmark = "gbenchmark", _gbenchmark_internal = "gbenchmark_internal", _grpcpp = "grpcpp", _gtest = "gtest", _select_gtest = "select_gtest")
load("//tools/bazeldefs:defs.bzl", _BuildSettingInfo = "BuildSettingInfo", _bool_flag = "bool_flag", _bpf_program = "bpf_program", _build_test = "build_test", _bzl_library = "bzl_library", _coreutil = "coreutil", _default_net_util = "default_net_util", _more_shards = "more_shards", _most_shards = "most_shards", _proto_library = "proto_library", _select_arch = "select_arch", _select_system = "select_system", _short_path = "short_path", _version = "version")
load("//tools/bazeldefs:go.bzl", _cov_available = "cov_available", _gazelle = "gazelle", _go_binary = "go_binary", _go_binary_nogo_dep = "go_binary_nogo_dep", _go_cov = "go_cov", _go_grpc_and_proto_libraries = "go_grpc_and_proto_libraries", _go_imports = "go_imports", _go_library = "go_library", _go_path = "go_path", _go_proto_library = "go_proto_library", _go_test = "go_test", _gotsan_flag_values = "gotsan_flag_values", _gotsan_values = "gotsan_values", _select_goarch = "select_goarch", _select_goos = "select_goos")
load("//tools/bazeldefs:go.bzl", _cov_available = "cov_available", _gazelle = "gazelle", _go_binary = "go_binary", _go_binary_nogo_dep = "go_binary_nogo_dep", _go_cov = "go_cov", _go_grpc_and_proto_libraries = "go_grpc_and_proto_libraries", _go_imports = "go_imports", _go_library = "go_library", _go_path = "go_path", _go_proto_library = "go_proto_library", _go_reset_target = "go_reset_target", _go_test = "go_test", _gotsan_flag_values = "gotsan_flag_values", _gotsan_values = "gotsan_values", _select_goarch = "select_goarch", _select_goos = "select_goos")
load("//tools/bazeldefs:pkg.bzl", _pkg_deb = "pkg_deb", _pkg_tar = "pkg_tar")
load("//tools/bazeldefs:platforms.bzl", _default_platform = "default_platform", _platform_capabilities = "platform_capabilities", _platforms = "platforms", _save_restore_platforms = "save_restore_platforms")
load("//tools/bazeldefs:tags.bzl", _go_suffixes = "go_suffixes", _local_test_tags = "local_test_tags")
Expand Down Expand Up @@ -48,6 +48,7 @@ select_gtest = _select_gtest
cov_available = _cov_available
gazelle = _gazelle
go_path = _go_path
go_reset_target = _go_reset_target
go_cov = _go_cov
select_goos = _select_goos
select_goarch = _select_goarch
Expand Down
10 changes: 9 additions & 1 deletion tools/nogo/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//tools:defs.bzl", "bzl_library", "go_binary", "select_goarch", "select_goos")
load("//tools:defs.bzl", "bzl_library", "go_binary", "go_reset_target", "select_goarch", "select_goos")
load("//tools/nogo:defs.bzl", "nogo_stdlib", "nogo_target")

package(
Expand All @@ -25,6 +25,14 @@ go_binary(
deps = ["//tools/nogo/cli"],
)

# The exec transition selects the tool platform but preserves Go build modes.
# Reset those modes so that analyzed targets do not configure the analyzer.
go_reset_target(
name = "nogo_tool",
dep = ":nogo",
visibility = ["//visibility:public"],
)

bzl_library(
name = "defs_bzl",
srcs = ["defs.bzl"],
Expand Down
8 changes: 4 additions & 4 deletions tools/nogo/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ nogo_stdlib = go_rule(
implementation = _nogo_stdlib_impl,
attrs = {
"_nogo": attr.label(
default = "//tools/nogo:nogo",
default = "//tools/nogo:nogo_tool",
cfg = "exec",
),
"_target": attr.label(
Expand Down Expand Up @@ -359,7 +359,7 @@ nogo_aspect = go_rule(
],
attrs = {
"_nogo": attr.label(
default = "//tools/nogo:nogo",
default = "//tools/nogo:nogo_tool",
cfg = "exec",
),
"_target": attr.label(
Expand Down Expand Up @@ -453,7 +453,7 @@ nogo_test = rule(
doc = "Relevant src files. This is ignored except to make the nogo_test directly affected by the files.",
),
"_nogo": attr.label(
default = "//tools/nogo:nogo",
default = "//tools/nogo:nogo_tool",
cfg = "exec",
),
"_target": attr.label(
Expand Down Expand Up @@ -534,7 +534,7 @@ nogo_facts_render = go_rule(
default = False,
),
"_nogo": attr.label(
default = "//tools/nogo:nogo",
default = "//tools/nogo:nogo_tool",
cfg = "exec",
),
# See _nogo_aspect, above.
Expand Down
Loading