bazel: Reorganize dependencies

Also revert the `.bazelversion` file again, as this will enforce a fixed
version, not a minimum version, which does not work well with our BazelCI.

PiperOrigin-RevId: 444178761
Change-Id: Ib6d1d126d850640ca7d692543784263790b8c418
This commit is contained in:
Christian Blichmann 2022-04-24 23:51:06 -07:00 committed by Copybara-Service
parent ff9009458c
commit 30d42a381e
3 changed files with 40 additions and 39 deletions

View File

@ -14,22 +14,25 @@
workspace(name = "com_google_sandboxed_api") workspace(name = "com_google_sandboxed_api")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//sandboxed_api/bazel:sapi_deps.bzl", "sapi_deps") load("//sandboxed_api/bazel:sapi_deps.bzl", "sapi_deps")
load(
"//sandboxed_api/bazel:llvm_config.bzl",
"llvm_configure",
"llvm_disable_optional_support_deps",
)
# Load common dependencies, then Protobuf's # Load Sandboxed API dependencies
sapi_deps() sapi_deps()
load("@bazel_skylib//lib:versions.bzl", "versions")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
"//sandboxed_api/bazel:llvm_config.bzl",
"llvm_disable_optional_support_deps",
)
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
versions.check(minimum_bazel_version = "5.1.0")
protobuf_deps() protobuf_deps()
llvm_disable_optional_support_deps()
# zlib, only needed for examples # zlib, only needed for examples
http_archive( http_archive(
name = "net_zlib", name = "net_zlib",
@ -49,32 +52,3 @@ http_archive(
"https://www.zlib.net/zlib-1.2.11.tar.gz", "https://www.zlib.net/zlib-1.2.11.tar.gz",
], ],
) )
# GoogleTest/GoogleMock
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "1009ce4e75a64a4e61bcb2efaa256f9d54e6a859a2985cb6fa57c06d45356866", # 2021-12-20
strip_prefix = "googletest-9a32aee22d771387c494be2d8519fbdf46a713b2",
urls = ["https://github.com/google/googletest/archive/9a32aee22d771387c494be2d8519fbdf46a713b2.zip"],
)
# Google Benchmark
maybe(
http_archive,
name = "com_google_benchmark",
sha256 = "12663580821c69f5a71217433b58e96f061570f0e18d94891b82115fcdb4284d", # 2021-12-14
strip_prefix = "benchmark-3b3de69400164013199ea448f051d94d7fc7d81f",
urls = ["https://github.com/google/benchmark/archive/3b3de69400164013199ea448f051d94d7fc7d81f.zip"],
)
# LLVM/libclang
maybe(
llvm_configure,
name = "llvm-project",
commit = "2c494f094123562275ae688bd9e946ae2a0b4f8b", # 2022-03-31
sha256 = "59b9431ae22f0ea5f2ce880925c0242b32a9e4f1ae8147deb2bb0fc19b53fa0d",
system_libraries = True, # Prefer system libraries
)
llvm_disable_optional_support_deps()

View File

@ -1 +0,0 @@
5.1.1

View File

@ -16,12 +16,13 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//sandboxed_api/bazel:llvm_config.bzl", "llvm_configure")
load("//sandboxed_api/bazel:repositories.bzl", "autotools_repository") load("//sandboxed_api/bazel:repositories.bzl", "autotools_repository")
def sapi_deps(): def sapi_deps():
"""Loads common dependencies needed to compile Sandboxed API.""" """Loads common dependencies needed to compile Sandboxed API."""
# Bazel Skylib, needed by newer Protobuf builds # Bazel Skylib
maybe( maybe(
http_archive, http_archive,
name = "bazel_skylib", name = "bazel_skylib",
@ -119,3 +120,30 @@ def sapi_deps():
strip_prefix = "libunwind-1.6.2", strip_prefix = "libunwind-1.6.2",
urls = ["https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz"], urls = ["https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz"],
) )
# GoogleTest/GoogleMock
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "1009ce4e75a64a4e61bcb2efaa256f9d54e6a859a2985cb6fa57c06d45356866", # 2021-12-20
strip_prefix = "googletest-9a32aee22d771387c494be2d8519fbdf46a713b2",
urls = ["https://github.com/google/googletest/archive/9a32aee22d771387c494be2d8519fbdf46a713b2.zip"],
)
# Google Benchmark
maybe(
http_archive,
name = "com_google_benchmark",
sha256 = "12663580821c69f5a71217433b58e96f061570f0e18d94891b82115fcdb4284d", # 2021-12-14
strip_prefix = "benchmark-3b3de69400164013199ea448f051d94d7fc7d81f",
urls = ["https://github.com/google/benchmark/archive/3b3de69400164013199ea448f051d94d7fc7d81f.zip"],
)
# LLVM/libclang
maybe(
llvm_configure,
name = "llvm-project",
commit = "2c494f094123562275ae688bd9e946ae2a0b4f8b", # 2022-03-31
sha256 = "59b9431ae22f0ea5f2ce880925c0242b32a9e4f1ae8147deb2bb0fc19b53fa0d",
system_libraries = True, # Prefer system libraries
)