Skip to content

build: cleanup Bazel rules for dependencies. #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ proxy_wasm_cpp_host_repositories()
load("@proxy_wasm_cpp_host//bazel:dependencies.bzl", "proxy_wasm_cpp_host_dependencies")

proxy_wasm_cpp_host_dependencies()

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

rules_foreign_cc_dependencies()
16 changes: 14 additions & 2 deletions bazel/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@proxy_wasm_cpp_host//bazel/cargo/wasmsign:crates.bzl", "wasmsign_fetch_remote_crates")
load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime:crates.bzl", "wasmtime_fetch_remote_crates")
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
load("@rules_python//python:pip.bzl", "pip_install")
load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set")

def proxy_wasm_cpp_host_dependencies():
protobuf_deps()
# Bazel extensions.

rules_foreign_cc_dependencies()

rust_repositories()
rust_repository_set(
Expand All @@ -29,11 +32,20 @@ def proxy_wasm_cpp_host_dependencies():
version = "1.57.0",
)

# Core dependencies.

protobuf_deps()

wasmsign_fetch_remote_crates()
wasmtime_fetch_remote_crates()

# V8 dependencies.

pip_install(
name = "v8_python_deps",
extra_pip_args = ["--require-hashes"],
requirements = "@v8//:bazel/requirements.txt",
)

# Wasmtime dependencies.

wasmtime_fetch_remote_crates()
226 changes: 128 additions & 98 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,134 @@

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def proxy_wasm_cpp_host_repositories():
http_archive(
name = "proxy_wasm_cpp_sdk",
sha256 = "c57de2425b5c61d7f630c5061e319b4557ae1f1c7526e5a51c33dc1299471b08",
strip_prefix = "proxy-wasm-cpp-sdk-fd0be8405db25de0264bdb78fae3a82668c03782",
urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/fd0be8405db25de0264bdb78fae3a82668c03782.tar.gz"],
# Bazel extensions.

maybe(
http_archive,
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
],
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
)

maybe(
http_archive,
name = "rules_foreign_cc",
sha256 = "d54742ffbdc6924f222d2179f0e10e911c5c659c4ae74158e9fe827aad862ac6",
strip_prefix = "rules_foreign_cc-0.2.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.2.0.tar.gz",
)

maybe(
http_archive,
name = "rules_python",
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
strip_prefix = "rules_python-0.6.0",
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
)

http_archive(
maybe(
http_archive,
name = "rules_rust",
sha256 = "8a2052e8ec707aa04a6b9e72bfc67fea44e915ecab1d2d0a4835ad51c2410c36",
strip_prefix = "rules_rust-b16c26ba5faf1c58ebe94582afd20567ce676e6d",
# NOTE: Update Rust version for Linux/s390x in bazel/dependencies.bzl.
url = "https://github.com/bazelbuild/rules_rust/archive/b16c26ba5faf1c58ebe94582afd20567ce676e6d.tar.gz",
)

# Core.

maybe(
http_archive,
name = "boringssl",
# 2022-01-10 (master-with-bazel)
sha256 = "a530919e3141d00d593a0d74cd0f9f88707e35ec58bb62245968fec16cb9257f",
strip_prefix = "boringssl-9420fb54116466923afa1f34a23dd8a4a7ddb69d",
urls = ["https://github.com/google/boringssl/archive/9420fb54116466923afa1f34a23dd8a4a7ddb69d.tar.gz"],
)

http_archive(
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb",
strip_prefix = "googletest-release-1.10.0",
urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"],
)

http_archive(
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "77ad26d3f65222fd96ccc18b055632b0bfedf295cb748b712a98ba1ac0b704b2",
strip_prefix = "protobuf-3.17.3",
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz",
)

http_archive(
name = "llvm13",
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm13.BUILD",
sha256 = "408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020",
strip_prefix = "llvm-13.0.0.src",
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-13.0.0.src.tar.xz",
maybe(
http_archive,
name = "proxy_wasm_cpp_sdk",
sha256 = "c57de2425b5c61d7f630c5061e319b4557ae1f1c7526e5a51c33dc1299471b08",
strip_prefix = "proxy-wasm-cpp-sdk-fd0be8405db25de0264bdb78fae3a82668c03782",
urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/fd0be8405db25de0264bdb78fae3a82668c03782.tar.gz"],
)

# V8 with dependencies.

maybe(
git_repository,
name = "v8",
# 9.9.115.3
commit = "90f089d97b6e4146ad106eee1829d86ad6392027",
remote = "https://chromium.googlesource.com/v8/v8",
shallow_since = "1643043727 +0000",
)

native.bind(
name = "wee8",
actual = "@v8//:wee8",
)

maybe(
new_git_repository,
name = "com_googlesource_chromium_base_trace_event_common",
build_file = "@v8//:bazel/BUILD.trace_event_common",
commit = "7f36dbc19d31e2aad895c60261ca8f726442bfbb",
remote = "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
shallow_since = "1635355186 -0700",
)

native.bind(
name = "base_trace_event_common",
actual = "@com_googlesource_chromium_base_trace_event_common//:trace_event_common",
)

http_archive(
maybe(
new_git_repository,
name = "com_googlesource_chromium_zlib",
build_file = "@v8//:bazel/BUILD.zlib",
commit = "fc5cfd78a357d5bb7735a58f383634faaafe706a",
remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git",
shallow_since = "1642005087 -0800",
)

native.bind(
name = "zlib",
actual = "@com_googlesource_chromium_zlib//:zlib",
)

native.bind(
name = "zlib_compression_utils",
actual = "@com_googlesource_chromium_zlib//:zlib_compression_utils",
)

# WAMR with dependencies.

maybe(
http_archive,
name = "com_github_bytecodealliance_wasm_micro_runtime",
build_file = "@proxy_wasm_cpp_host//bazel/external:wamr.BUILD",
# WAMR-01-18-2022
Expand All @@ -67,15 +155,28 @@ def proxy_wasm_cpp_host_repositories():
actual = "@com_github_bytecodealliance_wasm_micro_runtime//:wamr_lib",
)

http_archive(
maybe(
http_archive,
name = "llvm13",
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm13.BUILD",
sha256 = "408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020",
strip_prefix = "llvm-13.0.0.src",
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-13.0.0.src.tar.xz",
)

# Wasmtime with dependencies.

maybe(
http_archive,
name = "com_github_bytecodealliance_wasmtime",
build_file = "@proxy_wasm_cpp_host//bazel/external:wasmtime.BUILD",
sha256 = "c59a2aa110b25921d370944287cd97205c73cf3dc76776c5b3551135c1e42ddc",
strip_prefix = "wasmtime-0.33.0",
url = "https://github.com/bytecodealliance/wasmtime/archive/v0.33.0.tar.gz",
)

http_archive(
maybe(
http_archive,
name = "com_github_webassembly_wasm_c_api",
build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD",
sha256 = "c774044f51431429e878bd1b9e2a4e38932f861f9211df72f75e9427eb6b8d32",
Expand All @@ -88,30 +189,10 @@ def proxy_wasm_cpp_host_repositories():
actual = "@com_github_webassembly_wasm_c_api//:wasmtime_lib",
)

http_archive(
name = "rules_rust",
sha256 = "8a2052e8ec707aa04a6b9e72bfc67fea44e915ecab1d2d0a4835ad51c2410c36",
strip_prefix = "rules_rust-b16c26ba5faf1c58ebe94582afd20567ce676e6d",
# NOTE: Update Rust version for Linux/s390x in bazel/dependencies.bzl.
url = "https://github.com/bazelbuild/rules_rust/archive/b16c26ba5faf1c58ebe94582afd20567ce676e6d.tar.gz",
)

http_archive(
name = "rules_foreign_cc",
sha256 = "d54742ffbdc6924f222d2179f0e10e911c5c659c4ae74158e9fe827aad862ac6",
strip_prefix = "rules_foreign_cc-0.2.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.2.0.tar.gz",
)

http_archive(
name = "llvm",
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm.BUILD",
sha256 = "7d9a8405f557cefc5a21bf5672af73903b64749d9bc3a50322239f56f34ffddf",
strip_prefix = "llvm-12.0.1.src",
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/llvm-12.0.1.src.tar.xz",
)
# WAVM with dependencies.

http_archive(
maybe(
http_archive,
name = "com_github_wavm_wavm",
build_file = "@proxy_wasm_cpp_host//bazel/external:wavm.BUILD",
sha256 = "bf2b2aec8a4c6a5413081c0527cb40dd16cb67e9c74a91f8a82fe1cf27a3c5d5",
Expand All @@ -126,62 +207,11 @@ def proxy_wasm_cpp_host_repositories():
actual = "@com_github_wavm_wavm//:wavm_lib",
)

git_repository(
name = "v8",
# 9.9.115.3
commit = "90f089d97b6e4146ad106eee1829d86ad6392027",
remote = "https://chromium.googlesource.com/v8/v8",
shallow_since = "1643043727 +0000",
)

native.bind(
name = "wee8",
actual = "@v8//:wee8",
)

new_git_repository(
name = "com_googlesource_chromium_base_trace_event_common",
build_file = "@v8//:bazel/BUILD.trace_event_common",
commit = "7f36dbc19d31e2aad895c60261ca8f726442bfbb",
remote = "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
shallow_since = "1635355186 -0700",
)

native.bind(
name = "base_trace_event_common",
actual = "@com_googlesource_chromium_base_trace_event_common//:trace_event_common",
)

new_git_repository(
name = "com_googlesource_chromium_zlib",
build_file = "@v8//:bazel/BUILD.zlib",
commit = "fc5cfd78a357d5bb7735a58f383634faaafe706a",
remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git",
shallow_since = "1642005087 -0800",
)

native.bind(
name = "zlib",
actual = "@com_googlesource_chromium_zlib//:zlib",
)

native.bind(
name = "zlib_compression_utils",
actual = "@com_googlesource_chromium_zlib//:zlib_compression_utils",
)

http_archive(
name = "rules_python",
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
strip_prefix = "rules_python-0.6.0",
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
)

http_archive(
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
],
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
maybe(
http_archive,
name = "llvm",
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm.BUILD",
sha256 = "7d9a8405f557cefc5a21bf5672af73903b64749d9bc3a50322239f56f34ffddf",
strip_prefix = "llvm-12.0.1.src",
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/llvm-12.0.1.src.tar.xz",
)