blob: 641c1b57fab961a54369807ebd6f5c4e26d3b895 [file] [log] [blame] [edit]
# 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 = {}):
_maybe(
http_archive,
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
],
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
)
_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",
)
if go_sdk:
go_repository_cache(
name = "bazel_gazelle_go_repository_cache",
go_sdk_name = go_sdk,
go_env = go_env,
)
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_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,
)
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:/wpuwyWvp46gZfQCmbR+4SI5ne7IjRUM5lsXTzpAeWM=",
version = "v0.0.0-20240827154017-dd10159baa91",
)
_maybe(
go_repository,
name = "com_github_bazelbuild_rules_go",
importpath = "github.com/bazelbuild/rules_go",
sum = "h1:CTefzjN/D3Cdn3rkrM6qMWuQj59OBcuOjyIp3m4hZ7s=",
version = "v0.46.0",
)
_maybe(
go_repository,
name = "com_github_bmatcuk_doublestar_v4",
importpath = "github.com/bmatcuk/doublestar/v4",
sum = "h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=",
version = "v4.6.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:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=",
version = "v1.5.3",
)
_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 = "net_starlark_go",
importpath = "go.starlark.net",
sum = "h1:xwwDQW5We85NaTk2APgoN9202w/l0DVGp+GZMfsrh7s=",
version = "v0.0.0-20210223155950-e043a3d3c984",
)
_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:pnP7OclFFFgFi4VHQDQDaoXUVauOFyktqTsqqgzFKbc=",
version = "v1.40.1",
)
_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:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA=",
version = "v1.3.0",
)
_maybe(
go_repository,
name = "org_golang_google_protobuf",
importpath = "google.golang.org/protobuf",
sum = "h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=",
version = "v1.33.0",
)
_maybe(
go_repository,
name = "org_golang_x_mod",
importpath = "golang.org/x/mod",
sum = "h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=",
version = "v0.20.0",
)
_maybe(
go_repository,
name = "org_golang_x_net",
importpath = "golang.org/x/net",
sum = "h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=",
version = "v0.18.0",
)
_maybe(
go_repository,
name = "org_golang_x_sync",
importpath = "golang.org/x/sync",
sum = "h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=",
version = "v0.8.0",
)
_maybe(
go_repository,
name = "org_golang_x_sys",
importpath = "golang.org/x/sys",
sum = "h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=",
version = "v0.25.0",
)
_maybe(
go_repository,
name = "org_golang_x_text",
importpath = "golang.org/x/text",
sum = "h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=",
version = "v0.14.0",
)
_maybe(
go_repository,
name = "org_golang_x_tools",
importpath = "golang.org/x/tools",
sum = "h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=",
version = "v0.15.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)