1load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2load("@bazel_skylib//rules:common_settings.bzl", "bool_setting")
3
4filegroup(
5 name = "all_rules",
6 srcs = [
7 "//go/private/actions:all_rules",
8 "//go/private/rules:all_rules",
9 "//go/private/skylib/lib:all_rules",
10 "//go/private/tools:all_rules",
11 ] + glob(["**/*.bzl"]),
12 visibility = ["//visibility:public"],
13)
14
15filegroup(
16 name = "all_files",
17 testonly = True,
18 srcs = [
19 "//go/private/actions:all_files",
20 "//go/private/rules:all_files",
21 "//go/private/skylib/lib:all_files",
22 "//go/private/tools:all_files",
23 ] + glob(["**"]),
24 visibility = ["//visibility:public"],
25)
26
27config_setting(
28 name = "stamp",
29 values = {"stamp": "true"},
30 visibility = ["//:__pkg__"],
31)
32
33config_setting(
34 name = "is_strip_always",
35 values = {"strip": "always"},
36 visibility = ["//:__pkg__"],
37)
38
39config_setting(
40 name = "is_strip_sometimes_fastbuild",
41 values = {
42 "strip": "sometimes",
43 "compilation_mode": "fastbuild",
44 },
45 visibility = ["//:__pkg__"],
46)
47
48bzl_library(
49 name = "context",
50 srcs = ["context.bzl"],
51 visibility = [
52 "//docs:__subpackages__",
53 "//extras:__pkg__", # Manually added
54 "//go:__subpackages__",
55 ],
56 deps = [
57 ":common",
58 ":mode",
59 ":providers",
60 "//go/platform:apple",
61 "//go/private:go_toolchain",
62 "//go/private/rules:transition",
63 "@bazel_skylib//lib:paths",
64 "@bazel_skylib//rules:common_settings",
65 "@bazel_tools//tools/build_defs/cc:action_names.bzl",
66 "@bazel_tools//tools/cpp:toolchain_utils.bzl",
67 "@io_bazel_rules_go_bazel_features//:features.bzl",
68 "@io_bazel_rules_nogo//:scope.bzl",
69 ],
70)
71
72bzl_library(
73 name = "go_toolchain",
74 srcs = ["go_toolchain.bzl"],
75 visibility = [
76 "//extras:__pkg__", # Manually added
77 "//go:__subpackages__",
78 ],
79 deps = [
80 "//go/private:platforms",
81 "//go/private:providers",
82 "//go/private/actions:archive",
83 "//go/private/actions:binary",
84 "//go/private/actions:link",
85 "//go/private/actions:stdlib",
86 "@bazel_skylib//lib:selects",
87 ],
88)
89
90bzl_library(
91 name = "repositories",
92 srcs = ["repositories.bzl"],
93 visibility = ["//go:__subpackages__"],
94 # Don't list dependency on @bazel_tools//tools/build_defs/repo:http.bzl
95 deps = [
96 ":common",
97 ":nogo",
98 "//go/private/skylib/lib:versions",
99 "//proto:gogo",
100 ], # keep
101)
102
103bzl_library(
104 name = "sdk",
105 srcs = ["sdk.bzl"],
106 visibility = ["//go:__subpackages__"],
107 deps = [
108 "//go/private:common",
109 "//go/private:nogo",
110 "//go/private:platforms",
111 "//go/private/skylib/lib:versions",
112 "@bazel_tools//tools/build_defs/repo:utils.bzl",
113 ],
114)
115
116bzl_library(
117 name = "common",
118 srcs = ["common.bzl"],
119 visibility = ["//go:__subpackages__"],
120)
121
122bzl_library(
123 name = "mode",
124 srcs = ["mode.bzl"],
125 visibility = ["//go:__subpackages__"],
126)
127
128bzl_library(
129 name = "nogo",
130 srcs = ["nogo.bzl"],
131 visibility = ["//go:__subpackages__"],
132)
133
134bzl_library(
135 name = "platforms",
136 srcs = ["platforms.bzl"],
137 visibility = ["//go:__subpackages__"],
138)
139
140bzl_library(
141 name = "providers",
142 srcs = ["providers.bzl"],
143 visibility = [
144 "//extras:__pkg__",
145 "//go:__subpackages__",
146 "//proto:__pkg__", # keep
147 ],
148)
149
150bzl_library(
151 name = "rpath",
152 srcs = ["rpath.bzl"],
153 visibility = [
154 "//docs:__subpackages__",
155 "//go:__subpackages__",
156 ],
157)
158
159# Usually false. This is only true when we are building nogo itself in which
160# because that rule uses an incoming transition to switch this to true.
161bool_setting(
162 name = "bootstrap_nogo",
163 build_setting_default = False,
164 visibility = ["//visibility:public"],
165)
166
167# Usually true. The entire toolchain gets nogo to use in builds via the
168# go_context_data rule, which has an incoming transition that flips this flag
169# to true. This will only be false in host mode (which disallows any
170# transitions) or accessing nogo without going through go_context_data (which
171# does not happen in rules_go and does not seem to be useful).
172bool_setting(
173 name = "request_nogo",
174 build_setting_default = False,
175 visibility = ["//visibility:public"],
176)
177
178# Controls whether nogo alias will reference a noop or the configured nogo.
179# This *MUST* default to the noop to allow for tools to be built in the
180# deprecated "host" mode. Host mode cannot perform configuration transitions
181# so it cannot avoid circular dependencies. Therefore the default must work
182# without performing any transitions. The tradeoff is that nogo analysis is not
183# performed for any target built in host mode - this is not as bad as it seems
184# as most tools can (and should) use "exec" configuration instead of host which
185# does support transitions.
186config_setting(
187 name = "nogo_active",
188 flag_values = {
189 ":bootstrap_nogo": "False",
190 ":request_nogo": "True",
191 },
192 visibility = ["//visibility:public"],
193)
194
195bool_setting(
196 name = "always_true",
197 build_setting_default = True,
198 visibility = ["//visibility:public"],
199)
200
201# Only used by //:go_config.
202config_setting(
203 name = "is_compilation_mode_dbg",
204 values = {
205 "compilation_mode": "dbg",
206 },
207 visibility = ["//:__pkg__"],
208)
View as plain text