blob: 799561cfc2c2f21d2f45e65d433a5b2c6e54f735 [file]
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
)
load(
"//internal:go_repository.bzl",
_go_repository = "go_repository",
)
load(
"//internal:go_repository_cache.bzl",
"go_repository_cache",
)
load(
"//internal:go_repository_config.bzl",
"go_repository_config",
)
load(
"//internal:go_repository_tools.bzl",
"go_repository_tools",
)
load(
"//internal:is_bazel_module.bzl",
"is_bazel_module",
)
# Re-export go_repository . Users should get it from this file.
go_repository = _go_repository
def gazelle_dependencies(
go_sdk = "",
go_repository_default_config = "@//:WORKSPACE",
go_env = {},
go_env_inherit = []):
_maybe(
http_archive,
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
],
sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
)
_maybe(
http_archive,
name = "rules_license",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz",
"https://github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz",
],
sha256 = "26d4021f6898e23b82ef953078389dd49ac2b5618ac564ade4ef87cced147b38",
)
_maybe(
http_archive,
name = "package_metadata",
urls = [
"https://mirror.bazel.build/github.com/bazel-contrib/supply-chain/releases/download/v0.0.5/supply-chain-v0.0.5.tar.gz",
"https://github.com/bazel-contrib/supply-chain/releases/download/v0.0.5/supply-chain-v0.0.5.tar.gz",
],
sha256 = "49ed11e5d6b752c55fa539cbb10b2736974f347b081d7bd500a80dacb7dbec06",
strip_prefix = "supply-chain-0.0.5/metadata",
)
# We are not able to call rules_shell's dependency macros without introducing new levels of
# such macros to gazelle. With Bazel < 8, rules_shell forwards to the native sh_* rules, so
# its dependencies are not needed. With Bazel 8, rules_shell is automatically loaded by Bazel.
_maybe(
http_archive,
name = "rules_shell",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_shell/releases/download/v0.3.0/rules_shell-v0.3.0.tar.gz",
"https://github.com/bazelbuild/rules_shell/releases/download/v0.3.0/rules_shell-v0.3.0.tar.gz",
],
sha256 = "d8cd4a3a91fc1dc68d4c7d6b655f09def109f7186437e3f50a9b60ab436a0c53",
strip_prefix = "rules_shell-0.3.0",
)
if go_sdk:
go_repository_cache(
name = "bazel_gazelle_go_repository_cache",
go_sdk_name = go_sdk,
go_env = go_env,
go_env_inherit = go_env_inherit,
)
else:
go_sdk_info = {}
for name, r in native.existing_rules().items():
# match internal rule names but don't reference them directly.
# New rules may be added in the future, and they might be
# renamed (_go_download_sdk => go_download_sdk).
if name != "go_sdk" and ("go_" not in r["kind"] or "_sdk" not in r["kind"]):
continue
if r.get("goos", "") and r.get("goarch", ""):
platform = r["goos"] + "_" + r["goarch"]
else:
platform = "host"
go_sdk_info[name] = platform
go_repository_cache(
name = "bazel_gazelle_go_repository_cache",
go_sdk_info = go_sdk_info,
go_env = go_env,
go_env_inherit = go_env_inherit,
)
go_repository_tools(
name = "bazel_gazelle_go_repository_tools",
go_cache = "@bazel_gazelle_go_repository_cache//:go.env",
)
go_repository_config(
name = "bazel_gazelle_go_repository_config",
config = go_repository_default_config,
go_env = go_env,
go_env_inherit = go_env_inherit,
)
is_bazel_module(
name = "bazel_gazelle_is_bazel_module",
is_bazel_module = False,
)
_maybe(
go_repository,
name = "com_github_bazelbuild_buildtools",
importpath = "github.com/bazelbuild/buildtools",
sum = "h1:njQAmjTv/YHRm/0Lfv9DXHFZ4MdT2IA/RKHTnqZkgDw=",
version = "v0.0.0-20250930140053-2eb4fccefb52",
)
_maybe(
go_repository,
name = "com_github_bazelbuild_rules_go",
importpath = "github.com/bazelbuild/rules_go",
sum = "h1:RLhOwYIqeMgBpKelHEWTfIPjA37so3oa/rX+/qqq/P4=",
version = "v0.59.0",
)
_maybe(
go_repository,
name = "com_github_bmatcuk_doublestar_v4",
importpath = "github.com/bmatcuk/doublestar/v4",
sum = "h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE=",
version = "v4.9.1",
)
_maybe(
go_repository,
name = "com_github_fsnotify_fsnotify",
importpath = "github.com/fsnotify/fsnotify",
sum = "h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=",
version = "v1.7.0",
)
_maybe(
go_repository,
name = "com_github_gogo_protobuf",
importpath = "github.com/gogo/protobuf",
sum = "h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=",
version = "v1.3.2",
)
_maybe(
go_repository,
name = "com_github_golang_mock",
importpath = "github.com/golang/mock",
sum = "h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U=",
version = "v1.7.0-rc.1",
)
_maybe(
go_repository,
name = "com_github_golang_protobuf",
importpath = "github.com/golang/protobuf",
sum = "h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=",
version = "v1.5.4",
)
_maybe(
go_repository,
name = "com_github_google_go_cmp",
importpath = "github.com/google/go-cmp",
sum = "h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=",
version = "v0.6.0",
)
_maybe(
go_repository,
name = "com_github_pmezard_go_difflib",
importpath = "github.com/pmezard/go-difflib",
sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
version = "v1.0.0",
)
_maybe(
go_repository,
name = "org_golang_google_genproto",
importpath = "google.golang.org/genproto",
sum = "h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=",
version = "v0.0.0-20200526211855-cb27e3aa2013",
)
_maybe(
go_repository,
name = "org_golang_google_grpc",
importpath = "google.golang.org/grpc",
sum = "h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8=",
version = "v1.67.3",
)
_maybe(
go_repository,
name = "org_golang_google_grpc_cmd_protoc_gen_go_grpc",
importpath = "google.golang.org/grpc/cmd/protoc-gen-go-grpc",
sum = "h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A=",
version = "v1.5.1",
)
_maybe(
go_repository,
name = "org_golang_google_protobuf",
importpath = "google.golang.org/protobuf",
sum = "h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=",
version = "v1.36.3",
)
_maybe(
go_repository,
name = "org_golang_x_mod",
importpath = "golang.org/x/mod",
sum = "h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=",
version = "v0.23.0",
)
_maybe(
go_repository,
name = "org_golang_x_net",
importpath = "golang.org/x/net",
sum = "h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=",
version = "v0.35.0",
)
_maybe(
go_repository,
name = "org_golang_x_sync",
importpath = "golang.org/x/sync",
sum = "h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=",
version = "v0.11.0",
)
_maybe(
go_repository,
name = "org_golang_x_sys",
importpath = "golang.org/x/sys",
sum = "h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=",
version = "v0.30.0",
)
_maybe(
go_repository,
name = "org_golang_x_text",
importpath = "golang.org/x/text",
sum = "h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=",
version = "v0.22.0",
)
_maybe(
go_repository,
name = "org_golang_x_tools",
importpath = "golang.org/x/tools",
sum = "h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=",
version = "v0.30.0",
)
_maybe(
go_repository,
name = "org_golang_x_tools_go_vcs",
importpath = "golang.org/x/tools/go/vcs",
sum = "h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4=",
version = "v0.1.0-deprecated",
)
def _maybe(repo_rule, name, **kwargs):
if name not in native.existing_rules():
repo_rule(name = name, **kwargs)