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 ], 68) 69 70bzl_library( 71 name = "go_toolchain", 72 srcs = ["go_toolchain.bzl"], 73 visibility = [ 74 "//extras:__pkg__", # Manually added 75 "//go:__subpackages__", 76 ], 77 deps = [ 78 "//go/private:platforms", 79 "//go/private:providers", 80 "//go/private/actions:archive", 81 "//go/private/actions:binary", 82 "//go/private/actions:link", 83 "//go/private/actions:stdlib", 84 "@bazel_skylib//lib:selects", 85 ], 86) 87 88bzl_library( 89 name = "repositories", 90 srcs = ["repositories.bzl"], 91 visibility = ["//go:__subpackages__"], 92 # Don't list dependency on @bazel_tools//tools/build_defs/repo:http.bzl 93 deps = [ 94 ":common", 95 ":nogo", 96 "//go/private/skylib/lib:versions", 97 "//proto:gogo", 98 ], # keep 99) 100 101bzl_library( 102 name = "sdk", 103 srcs = ["sdk.bzl"], 104 visibility = ["//go:__subpackages__"], 105 deps = [ 106 "//go/private:common", 107 "//go/private:nogo", 108 "//go/private:platforms", 109 "//go/private/skylib/lib:versions", 110 ], 111) 112 113bzl_library( 114 name = "common", 115 srcs = ["common.bzl"], 116 visibility = ["//go:__subpackages__"], 117) 118 119bzl_library( 120 name = "mode", 121 srcs = ["mode.bzl"], 122 visibility = ["//go:__subpackages__"], 123) 124 125bzl_library( 126 name = "nogo", 127 srcs = ["nogo.bzl"], 128 visibility = ["//go:__subpackages__"], 129) 130 131bzl_library( 132 name = "platforms", 133 srcs = ["platforms.bzl"], 134 visibility = ["//go:__subpackages__"], 135) 136 137bzl_library( 138 name = "providers", 139 srcs = ["providers.bzl"], 140 visibility = [ 141 "//extras:__pkg__", 142 "//go:__subpackages__", 143 "//proto:__pkg__", # keep 144 ], 145) 146 147bzl_library( 148 name = "rpath", 149 srcs = ["rpath.bzl"], 150 visibility = [ 151 "//docs:__subpackages__", 152 "//go:__subpackages__", 153 ], 154) 155 156# Usually false. This is only true when we are building nogo itself in which 157# because that rule uses an incoming transition to switch this to true. 158bool_setting( 159 name = "bootstrap_nogo", 160 build_setting_default = False, 161 visibility = ["//visibility:public"], 162) 163 164# Usually true. The entire toolchain gets nogo to use in builds via the 165# go_context_data rule, which has an incoming transition that flips this flag 166# to true. This will only be false in host mode (which disallows any 167# transitions) or accessing nogo without going through go_context_data (which 168# does not happen in rules_go and does not seem to be useful). 169bool_setting( 170 name = "request_nogo", 171 build_setting_default = False, 172 visibility = ["//visibility:public"], 173) 174 175# Controls whether nogo alias will reference a noop or the configured nogo. 176# This *MUST* default to the noop to allow for tools to be built in the 177# deprecated "host" mode. Host mode cannot perform configuration transitions 178# so it cannot avoid circular dependencies. Therefore the default must work 179# without performing any transitions. The tradeoff is that nogo analysis is not 180# performed for any target built in host mode - this is not as bad as it seems 181# as most tools can (and should) use "exec" configuration instead of host which 182# does support transitions. 183config_setting( 184 name = "nogo_active", 185 flag_values = { 186 ":bootstrap_nogo": "False", 187 ":request_nogo": "True", 188 }, 189 visibility = ["//visibility:public"], 190) 191 192bool_setting( 193 name = "always_true", 194 build_setting_default = True, 195 visibility = ["//visibility:public"], 196) 197 198# Only used by //:go_config. 199config_setting( 200 name = "is_compilation_mode_dbg", 201 values = { 202 "compilation_mode": "dbg", 203 }, 204 visibility = ["//:__pkg__"], 205) 206