-
-
Notifications
You must be signed in to change notification settings - Fork 661
/
BUILD.bazel
39 lines (37 loc) · 1.64 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
load("//go:def.bzl", "go_binary", "go_library")
load(":aspect.bzl", "bazel_supports_canonical_label_literals")
go_library(
name = "gopackagesdriver_lib",
srcs = [
"bazel.go",
"bazel_json_builder.go",
"build_context.go",
"driver_request.go",
"flatpackage.go",
"json_packages_driver.go",
"main.go",
"packageregistry.go",
"utils.go",
],
importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver",
visibility = ["//visibility:private"],
)
go_binary(
name = "gopackagesdriver",
embed = [":gopackagesdriver_lib"],
x_defs = {
# Determine the name of the rules_go repository as we need to specify it when invoking the
# aspect.
# If canonical label literals are supported, we can use a canonical label literal (starting
# with @@) to pass the repository_name() through repo mapping unchanged.
# If canonical label literals are not supported, then bzlmod is certainly not enabled and
# we can assume that the repository name is not affected by repo mappings.
# If run in the rules_go repo itself, repository_name() returns "@", which is equivalent to
# "@io_bazel_rules_go" since Bazel 6:
# https://github.com/bazelbuild/bazel/commit/7694cf75e6366b92e3905c2ad60234cda57627ee
# TODO: Once we drop support for Bazel 5, we can remove the feature detection logic and
# use "@" + repository_name().
"rulesGoRepositoryName": "@" + repository_name() if bazel_supports_canonical_label_literals() else repository_name(),
},
visibility = ["//visibility:public"],
)