blob: 780420a5a0730a863d67eba33e1bcd220c64db3a [file] [log] [blame]
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def maybe(repo_rule, name, **kwargs):
"""Defines a repository if it does not already exist.
"""
if name not in native.existing_rules():
repo_rule(name = name, **kwargs)
def github_archive(name, repo_name, commit, sha256 = None, kind = "zip"):
"""Defines a GitHub commit-based repository rule."""
project = repo_name[repo_name.index("/"):]
http_archive(
name = name,
sha256 = sha256,
strip_prefix = "{project}-{commit}".format(project = project, commit = commit),
urls = [u.format(commit = commit, repo_name = repo_name, kind = kind) for u in [
"https://mirror.bazel.build/github.com/{repo_name}/archive/{commit}.{kind}",
"https://github.com/{repo_name}/archive/{commit}.{kind}",
]],
)
def kythe_rule_repositories():
"""Defines external repositories for Kythe Bazel rules.
These repositories must be loaded before calling external.bzl%kythe_dependencies.
"""
maybe(
http_archive,
name = "bazel_skylib",
sha256 = "e5d90f0ec952883d56747b7604e2a15ee36e288bb556c3d0ed33e818a4d971f2",
strip_prefix = "bazel-skylib-1.0.2",
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/1.0.2.tar.gz"],
)
maybe(
http_archive,
name = "io_bazel_rules_go",
sha256 = "e5de048e72612598c45f564202f6a3c74616be4ffd2dbd6f7bc75045f8ecbdce",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.23.4/rules_go-v0.23.4.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.23.4/rules_go-v0.23.4.tar.gz",
],
)
maybe(
http_archive,
name = "rules_cc",
sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec",
strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz",
"https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz",
],
)
maybe(
http_archive,
name = "rules_java",
url = "https://github.com/bazelbuild/rules_java/archive/973a93dd2d698929264d1028836f6b9cc60ff817.zip",
sha256 = "a6cb0dbe343b67c7d4f3f11a68e327acdfc71fee1e17affa4e605129fc56bb15",
strip_prefix = "rules_java-973a93dd2d698929264d1028836f6b9cc60ff817",
)
maybe(
http_archive,
name = "rules_proto",
sha256 = "e4fe70af52135d2ee592a07f916e6e1fc7c94cf8786c15e8c0d0f08b1fe5ea16",
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
url = "https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.zip",
)
maybe(
http_archive,
name = "bazel_gazelle",
sha256 = "bfd86b3cbe855d6c16c6fce60d76bd51f5c8dbc9cfcaef7a2bb5c1aafd0710e8",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.0/bazel-gazelle-v0.21.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.0/bazel-gazelle-v0.21.0.tar.gz",
],
)
maybe(
http_archive,
name = "build_bazel_rules_nodejs",
sha256 = "d0c4bb8b902c1658f42eb5563809c70a06e46015d64057d25560b0eb4bdc9007",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.5.0/rules_nodejs-1.5.0.tar.gz"],
)
maybe(
http_archive,
name = "rules_jvm_external",
sha256 = "e5b97a31a3e8feed91636f42e19b11c49487b85e5de2f387c999ea14d77c7f45",
strip_prefix = "rules_jvm_external-2.9",
urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/2.9.zip"],
)
maybe(
http_archive,
name = "rules_python",
sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6",
strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz",
"https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz",
],
)
maybe(
http_archive,
name = "io_bazel_rules_rust",
sha256 = "0a38be61514ed6364d60324486a2748653689c02dafff0cd8e3c9840b04008fe",
strip_prefix = "rules_rust-3dffbabb3ab65a41056228b5c387d4b78331eaec",
urls = [
"https://github.com/bazelbuild/rules_rust/archive/3dffbabb3ab65a41056228b5c387d4b78331eaec.tar.gz",
],
)