forked from bazel-contrib/rules_go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
143 lines (131 loc) · 3.83 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
load(
"@io_bazel_rules_go//go/private:tools/lines_sorted_test.bzl",
"lines_sorted_test",
)
load(
"@io_bazel_rules_go//go/private:rules/nogo.bzl",
"nogo",
)
load(
"@io_bazel_rules_go//go/private:rules/info.bzl",
"go_info",
)
load(
"@io_bazel_rules_go//go:def.bzl",
"TOOLS_NOGO",
)
load(
"@io_bazel_rules_go//go/private:context.bzl",
"cgo_context_data",
"cgo_context_data_proxy",
"go_config",
"go_context_data",
)
load(
"@io_bazel_rules_go//go/private:rules/stdlib.bzl",
"stdlib",
)
stdlib(
name = "stdlib",
cgo_context_data = select({
"//go/platform:internal_cgo_off": None,
"//conditions:default": ":cgo_context_data",
}),
visibility = ["//visibility:public"],
)
# default_nogo is the nogo target that nogo references by default. It
# does not analyze anything, which means no binary is built or run
# at compile time.
nogo(
name = "default_nogo",
visibility = ["//visibility:public"],
)
# tools_nogo includes all of the analysis passes in
# golang.org/x/tools/go/analysis/passes.
# This is not backward compatible, so use caution when depending on this --
# new analyses may discover issues in existing builds.
nogo(
name = "tools_nogo",
visibility = ["//visibility:public"],
deps = TOOLS_NOGO,
)
# go_context_data collects build options and is depended on by all Go targets.
# It may depend on cgo_context_data if CGo isn't disabled.
go_context_data(
name = "go_context_data",
cgo_context_data = select({
"//go/platform:internal_cgo_off": None,
"//conditions:default": ":cgo_context_data",
}),
coverdata = "//go/tools/coverdata",
go_config = ":go_config",
nogo = "@io_bazel_rules_nogo//:nogo",
stdlib = ":stdlib",
visibility = ["//visibility:public"],
)
# cgo_context_data collects information about the C/C++ toolchain.
# go_context_data depends if cgo is enabled in the target configuration.
cgo_context_data(
name = "cgo_context_data",
visibility = ["//visibility:private"],
)
# cgo_context_data_proxy depends on cgo_context_data if cgo is enabled and
# forwards its provider. Rule attributes may depend on this, since they cannot
# use select.
cgo_context_data_proxy(
name = "cgo_context_data_proxy",
actual = select({
"//go/platform:internal_cgo_off": None,
"//conditions:default": ":cgo_context_data",
}),
visibility = ["//visibility:public"],
)
# go_config collects information about build settings in the current
# configuration. go_context_data depends on this so that rules don't need
# to depend on all build settings directly.
go_config(
name = "go_config",
debug = "//go/config:debug",
gotags = "//go/config:tags",
linkmode = "//go/config:linkmode",
msan = "//go/config:msan",
pure = "//go/config:pure",
race = "//go/config:race",
stamp = select({
"//go/private:stamp": True,
"//conditions:default": False,
}),
static = "//go/config:static",
strip = "//go/config:strip",
visibility = ["//visibility:public"],
)
lines_sorted_test(
name = "contributors_sorted_test",
size = "small",
cmd = "grep -v '^#' $< | grep -v '^$$' >$@",
error_message = "Contributors must be sorted by first name",
file = "CONTRIBUTORS",
)
lines_sorted_test(
name = "authors_sorted_test",
size = "small",
cmd = "grep -v '^#' $< | grep -v '^$$' >$@",
error_message = "Authors must be sorted by first name",
file = "AUTHORS",
)
# This could be any file, used as an anchor point for the directory in tests
exports_files(["AUTHORS"])
go_info()
filegroup(
name = "all_files",
testonly = True,
srcs = [
"BUILD.bazel",
"WORKSPACE",
"//extras:all_files",
"//go:all_files",
"//proto:all_files",
"//third_party:all_files",
],
visibility = ["//visibility:public"],
)