blob: 4947c8fcaa86b8c6acf8d1143bb68984fc654987 [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(
# TODO(shahms): Update to a release version >= 0.22.2
github_archive,
name = "io_bazel_rules_go",
repo_name = "bazelbuild/rules_go",
commit = "2a0e3a07e9ed9aa9b7afd1a222638ba52166e52d",
sha256 = "9f405b66fa5b2c5317d46ff8b0954a12961736e8e806f665521f96d90a5b58eb",
)
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",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
],
sha256 = "d8c45ee70ec39a57e7a05e5027c32b1576cc7f16d9dd37135b0eddde45cf1b10",
)
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",
],
)