github.com/0xKiwi/rules_go@v0.24.3/go/def.bzl (about) 1 # Copyright 2014 The Bazel Authors. All rights reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 """Public definitions for Go rules. 16 17 All public Go rules, providers, and other definitions are imported and 18 re-exported in this file. This allows the real location of definitions 19 to change for easier maintenance. 20 21 Definitions outside this file are private unless otherwise noted, and 22 may change without notice. 23 """ 24 25 load( 26 "@io_bazel_rules_go//go/private:context.bzl", 27 _go_context = "go_context", 28 ) 29 load( 30 "@io_bazel_rules_go//go/private:providers.bzl", 31 _GoArchive = "GoArchive", 32 _GoArchiveData = "GoArchiveData", 33 _GoLibrary = "GoLibrary", 34 _GoPath = "GoPath", 35 _GoSDK = "GoSDK", 36 _GoSource = "GoSource", 37 ) 38 load( 39 "@io_bazel_rules_go//go/private:rules/sdk.bzl", 40 _go_sdk = "go_sdk", 41 ) 42 load( 43 "@io_bazel_rules_go//go/private:go_toolchain.bzl", 44 _declare_toolchains = "declare_toolchains", 45 _go_toolchain = "go_toolchain", 46 ) 47 load( 48 "@io_bazel_rules_go//go/private:rules/wrappers.bzl", 49 _go_binary_macro = "go_binary_macro", 50 _go_library_macro = "go_library_macro", 51 _go_test_macro = "go_test_macro", 52 ) 53 load( 54 "@io_bazel_rules_go//go/private:rules/source.bzl", 55 _go_source = "go_source", 56 ) 57 load( 58 "@io_bazel_rules_go//extras:embed_data.bzl", 59 _go_embed_data = "go_embed_data", 60 ) 61 load( 62 "@io_bazel_rules_go//go/private:tools/path.bzl", 63 _go_path = "go_path", 64 ) 65 load( 66 "@io_bazel_rules_go//go/private:rules/rule.bzl", 67 _go_rule = "go_rule", 68 ) 69 load( 70 "@io_bazel_rules_go//go/private:rules/library.bzl", 71 _go_tool_library = "go_tool_library", 72 ) 73 load( 74 "@io_bazel_rules_go//go/private:rules/nogo.bzl", 75 _nogo = "nogo_wrapper", 76 ) 77 78 # TOOLS_NOGO is a list of all analysis passes in 79 # golang.org/x/tools/go/analysis/passes. 80 # This is not backward compatible, so use caution when depending on this -- 81 # new analyses may discover issues in existing builds. 82 TOOLS_NOGO = [ 83 "@org_golang_x_tools//go/analysis/passes/asmdecl:go_tool_library", 84 "@org_golang_x_tools//go/analysis/passes/assign:go_tool_library", 85 "@org_golang_x_tools//go/analysis/passes/atomic:go_tool_library", 86 "@org_golang_x_tools//go/analysis/passes/atomicalign:go_tool_library", 87 "@org_golang_x_tools//go/analysis/passes/bools:go_tool_library", 88 "@org_golang_x_tools//go/analysis/passes/buildssa:go_tool_library", 89 "@org_golang_x_tools//go/analysis/passes/buildtag:go_tool_library", 90 # TODO(#2396): pass raw cgo sources to cgocall and re-enable. 91 # "@org_golang_x_tools//go/analysis/passes/cgocall:go_tool_library", 92 "@org_golang_x_tools//go/analysis/passes/composite:go_tool_library", 93 "@org_golang_x_tools//go/analysis/passes/copylock:go_tool_library", 94 "@org_golang_x_tools//go/analysis/passes/ctrlflow:go_tool_library", 95 "@org_golang_x_tools//go/analysis/passes/deepequalerrors:go_tool_library", 96 "@org_golang_x_tools//go/analysis/passes/errorsas:go_tool_library", 97 "@org_golang_x_tools//go/analysis/passes/findcall:go_tool_library", 98 "@org_golang_x_tools//go/analysis/passes/httpresponse:go_tool_library", 99 "@org_golang_x_tools//go/analysis/passes/ifaceassert:go_tool_library", 100 "@org_golang_x_tools//go/analysis/passes/inspect:go_tool_library", 101 "@org_golang_x_tools//go/analysis/passes/loopclosure:go_tool_library", 102 "@org_golang_x_tools//go/analysis/passes/lostcancel:go_tool_library", 103 "@org_golang_x_tools//go/analysis/passes/nilfunc:go_tool_library", 104 "@org_golang_x_tools//go/analysis/passes/nilness:go_tool_library", 105 "@org_golang_x_tools//go/analysis/passes/pkgfact:go_tool_library", 106 "@org_golang_x_tools//go/analysis/passes/printf:go_tool_library", 107 "@org_golang_x_tools//go/analysis/passes/shadow:go_tool_library", 108 "@org_golang_x_tools//go/analysis/passes/shift:go_tool_library", 109 "@org_golang_x_tools//go/analysis/passes/sortslice:go_tool_library", 110 "@org_golang_x_tools//go/analysis/passes/stdmethods:go_tool_library", 111 "@org_golang_x_tools//go/analysis/passes/stringintconv:go_tool_library", 112 "@org_golang_x_tools//go/analysis/passes/structtag:go_tool_library", 113 "@org_golang_x_tools//go/analysis/passes/testinggoroutine:go_tool_library", 114 "@org_golang_x_tools//go/analysis/passes/tests:go_tool_library", 115 "@org_golang_x_tools//go/analysis/passes/unmarshal:go_tool_library", 116 "@org_golang_x_tools//go/analysis/passes/unreachable:go_tool_library", 117 "@org_golang_x_tools//go/analysis/passes/unsafeptr:go_tool_library", 118 "@org_golang_x_tools//go/analysis/passes/unusedresult:go_tool_library", 119 ] 120 121 # Current version or next version to be tagged. Gazelle and other tools may 122 # check this to determine compatibility. 123 RULES_GO_VERSION = "0.24.3" 124 125 declare_toolchains = _declare_toolchains 126 go_context = _go_context 127 go_embed_data = _go_embed_data 128 go_sdk = _go_sdk 129 go_tool_library = _go_tool_library 130 go_toolchain = _go_toolchain 131 nogo = _nogo 132 133 # See go/providers.rst#GoLibrary for full documentation. 134 GoLibrary = _GoLibrary 135 136 # See go/providers.rst#GoSource for full documentation. 137 GoSource = _GoSource 138 139 # See go/providers.rst#GoPath for full documentation. 140 GoPath = _GoPath 141 142 # See go/providers.rst#GoArchive for full documentation. 143 GoArchive = _GoArchive 144 145 # See go/providers.rst#GoArchiveData for full documentation. 146 GoArchiveData = _GoArchiveData 147 148 # See go/providers.rst#GoSDK for full documentation. 149 GoSDK = _GoSDK 150 151 # See go/core.rst#go_library for full documentation. 152 go_library = _go_library_macro 153 154 # See go/core.rst#go_binary for full documentation. 155 go_binary = _go_binary_macro 156 157 # See go/core.rst#go_test for full documentation. 158 go_test = _go_test_macro 159 160 # See go/core.rst#go_test for full documentation. 161 go_source = _go_source 162 163 # See go/core.rst#go_rule for full documentation. 164 go_rule = _go_rule 165 166 # See go/core.rst#go_path for full documentation. 167 go_path = _go_path 168 169 def go_vet_test(*args, **kwargs): 170 fail("The go_vet_test rule has been removed. Please migrate to nogo instead, which supports vet tests.") 171 172 def go_rules_dependencies(): 173 _moved("go_rules_dependencies") 174 175 def go_register_toolchains(**kwargs): 176 _moved("go_register_toolchains") 177 178 def go_download_sdk(**kwargs): 179 _moved("go_download_sdk") 180 181 def go_host_sdk(**kwargs): 182 _moved("go_host_sdk") 183 184 def go_local_sdk(**kwargs): 185 _moved("go_local_sdk") 186 187 def go_wrap_sdk(**kwargs): 188 _moved("go_wrap_sdK") 189 190 def _moved(name): 191 fail(name + " has moved. Please load from " + 192 " @io_bazel_rules_go//go:deps.bzl instead of def.bzl.")