blob: 7eaedbc9e84e508a7fa2e465e0b1ccebbfdf42b3 [file] [log] [blame]
# gazelle:exclude
load("//go:def.bzl", "go_binary", "go_library")
load("//go/private:common.bzl", "RULES_GO_IS_BZLMOD_REPO")
load("//go/private/rules:go_bin_for_host.bzl", "go_bin_for_host")
go_bin_for_host(
name = "go_bin_for_host",
visibility = ["//visibility:private"],
)
go_library(
name = "go_bin_runner_lib",
srcs = [
"main.go",
],
importpath = "github.com/bazelbuild/rules_go/go/tools/go_bin_runner",
visibility = ["//visibility:private"],
deps = [
"//go/runfiles",
],
)
go_binary(
name = "go_bin_runner",
# Make this binary usable as a drop-in replacement for the actual go binary with external tools.
out = select({
"@platforms//os:windows": "bin/go.exe",
"//conditions:default": "bin/go",
}),
data = [":go_bin_for_host"] + (
["@bazel_gazelle_go_repository_config//:config.json"] if RULES_GO_IS_BZLMOD_REPO else []
),
embed = [":go_bin_runner_lib"],
visibility = ["//go:__pkg__"],
x_defs = {
"GoBinRlocationPath": "$(rlocationpath :go_bin_for_host)",
"ConfigRlocationPath": "$(rlocationpath @bazel_gazelle_go_repository_config//:config.json)" if RULES_GO_IS_BZLMOD_REPO else "WORKSPACE",
},
)
filegroup(
name = "all_files",
testonly = True,
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)