Skip to content

Commit 44a63eb

Browse files
authored
build: cleanup Bazel rules for dependencies. (#233)
No updates or functional changes. Signed-off-by: Piotr Sikora <[email protected]>
1 parent a4c273c commit 44a63eb

File tree

3 files changed

+142
-104
lines changed

3 files changed

+142
-104
lines changed

WORKSPACE

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ proxy_wasm_cpp_host_repositories()
77
load("@proxy_wasm_cpp_host//bazel:dependencies.bzl", "proxy_wasm_cpp_host_dependencies")
88

99
proxy_wasm_cpp_host_dependencies()
10-
11-
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
12-
13-
rules_foreign_cc_dependencies()

bazel/dependencies.bzl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
1616
load("@proxy_wasm_cpp_host//bazel/cargo/wasmsign:crates.bzl", "wasmsign_fetch_remote_crates")
1717
load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime:crates.bzl", "wasmtime_fetch_remote_crates")
18+
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
1819
load("@rules_python//python:pip.bzl", "pip_install")
1920
load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set")
2021

2122
def proxy_wasm_cpp_host_dependencies():
22-
protobuf_deps()
23+
# Bazel extensions.
24+
25+
rules_foreign_cc_dependencies()
2326

2427
rust_repositories()
2528
rust_repository_set(
@@ -29,11 +32,20 @@ def proxy_wasm_cpp_host_dependencies():
2932
version = "1.57.0",
3033
)
3134

35+
# Core dependencies.
36+
37+
protobuf_deps()
38+
3239
wasmsign_fetch_remote_crates()
33-
wasmtime_fetch_remote_crates()
40+
41+
# V8 dependencies.
3442

3543
pip_install(
3644
name = "v8_python_deps",
3745
extra_pip_args = ["--require-hashes"],
3846
requirements = "@v8//:bazel/requirements.txt",
3947
)
48+
49+
# Wasmtime dependencies.
50+
51+
wasmtime_fetch_remote_crates()

bazel/repositories.bzl

Lines changed: 128 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,134 @@
1414

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

1819
def proxy_wasm_cpp_host_repositories():
19-
http_archive(
20-
name = "proxy_wasm_cpp_sdk",
21-
sha256 = "c57de2425b5c61d7f630c5061e319b4557ae1f1c7526e5a51c33dc1299471b08",
22-
strip_prefix = "proxy-wasm-cpp-sdk-fd0be8405db25de0264bdb78fae3a82668c03782",
23-
urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/fd0be8405db25de0264bdb78fae3a82668c03782.tar.gz"],
20+
# Bazel extensions.
21+
22+
maybe(
23+
http_archive,
24+
name = "bazel_skylib",
25+
urls = [
26+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
27+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
28+
],
29+
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
30+
)
31+
32+
maybe(
33+
http_archive,
34+
name = "rules_foreign_cc",
35+
sha256 = "d54742ffbdc6924f222d2179f0e10e911c5c659c4ae74158e9fe827aad862ac6",
36+
strip_prefix = "rules_foreign_cc-0.2.0",
37+
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.2.0.tar.gz",
38+
)
39+
40+
maybe(
41+
http_archive,
42+
name = "rules_python",
43+
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
44+
strip_prefix = "rules_python-0.6.0",
45+
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
2446
)
2547

26-
http_archive(
48+
maybe(
49+
http_archive,
50+
name = "rules_rust",
51+
sha256 = "8a2052e8ec707aa04a6b9e72bfc67fea44e915ecab1d2d0a4835ad51c2410c36",
52+
strip_prefix = "rules_rust-b16c26ba5faf1c58ebe94582afd20567ce676e6d",
53+
# NOTE: Update Rust version for Linux/s390x in bazel/dependencies.bzl.
54+
url = "https://github.com/bazelbuild/rules_rust/archive/b16c26ba5faf1c58ebe94582afd20567ce676e6d.tar.gz",
55+
)
56+
57+
# Core.
58+
59+
maybe(
60+
http_archive,
2761
name = "boringssl",
2862
# 2022-01-10 (master-with-bazel)
2963
sha256 = "a530919e3141d00d593a0d74cd0f9f88707e35ec58bb62245968fec16cb9257f",
3064
strip_prefix = "boringssl-9420fb54116466923afa1f34a23dd8a4a7ddb69d",
3165
urls = ["https://github.com/google/boringssl/archive/9420fb54116466923afa1f34a23dd8a4a7ddb69d.tar.gz"],
3266
)
3367

34-
http_archive(
68+
maybe(
69+
http_archive,
3570
name = "com_google_googletest",
3671
sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb",
3772
strip_prefix = "googletest-release-1.10.0",
3873
urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"],
3974
)
4075

41-
http_archive(
76+
maybe(
77+
http_archive,
4278
name = "com_google_protobuf",
4379
sha256 = "77ad26d3f65222fd96ccc18b055632b0bfedf295cb748b712a98ba1ac0b704b2",
4480
strip_prefix = "protobuf-3.17.3",
4581
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz",
4682
)
4783

48-
http_archive(
49-
name = "llvm13",
50-
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm13.BUILD",
51-
sha256 = "408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020",
52-
strip_prefix = "llvm-13.0.0.src",
53-
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-13.0.0.src.tar.xz",
84+
maybe(
85+
http_archive,
86+
name = "proxy_wasm_cpp_sdk",
87+
sha256 = "c57de2425b5c61d7f630c5061e319b4557ae1f1c7526e5a51c33dc1299471b08",
88+
strip_prefix = "proxy-wasm-cpp-sdk-fd0be8405db25de0264bdb78fae3a82668c03782",
89+
urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/fd0be8405db25de0264bdb78fae3a82668c03782.tar.gz"],
90+
)
91+
92+
# V8 with dependencies.
93+
94+
maybe(
95+
git_repository,
96+
name = "v8",
97+
# 9.9.115.3
98+
commit = "90f089d97b6e4146ad106eee1829d86ad6392027",
99+
remote = "https://chromium.googlesource.com/v8/v8",
100+
shallow_since = "1643043727 +0000",
101+
)
102+
103+
native.bind(
104+
name = "wee8",
105+
actual = "@v8//:wee8",
106+
)
107+
108+
maybe(
109+
new_git_repository,
110+
name = "com_googlesource_chromium_base_trace_event_common",
111+
build_file = "@v8//:bazel/BUILD.trace_event_common",
112+
commit = "7f36dbc19d31e2aad895c60261ca8f726442bfbb",
113+
remote = "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
114+
shallow_since = "1635355186 -0700",
115+
)
116+
117+
native.bind(
118+
name = "base_trace_event_common",
119+
actual = "@com_googlesource_chromium_base_trace_event_common//:trace_event_common",
54120
)
55121

56-
http_archive(
122+
maybe(
123+
new_git_repository,
124+
name = "com_googlesource_chromium_zlib",
125+
build_file = "@v8//:bazel/BUILD.zlib",
126+
commit = "fc5cfd78a357d5bb7735a58f383634faaafe706a",
127+
remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git",
128+
shallow_since = "1642005087 -0800",
129+
)
130+
131+
native.bind(
132+
name = "zlib",
133+
actual = "@com_googlesource_chromium_zlib//:zlib",
134+
)
135+
136+
native.bind(
137+
name = "zlib_compression_utils",
138+
actual = "@com_googlesource_chromium_zlib//:zlib_compression_utils",
139+
)
140+
141+
# WAMR with dependencies.
142+
143+
maybe(
144+
http_archive,
57145
name = "com_github_bytecodealliance_wasm_micro_runtime",
58146
build_file = "@proxy_wasm_cpp_host//bazel/external:wamr.BUILD",
59147
# WAMR-01-18-2022
@@ -67,15 +155,28 @@ def proxy_wasm_cpp_host_repositories():
67155
actual = "@com_github_bytecodealliance_wasm_micro_runtime//:wamr_lib",
68156
)
69157

70-
http_archive(
158+
maybe(
159+
http_archive,
160+
name = "llvm13",
161+
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm13.BUILD",
162+
sha256 = "408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020",
163+
strip_prefix = "llvm-13.0.0.src",
164+
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-13.0.0.src.tar.xz",
165+
)
166+
167+
# Wasmtime with dependencies.
168+
169+
maybe(
170+
http_archive,
71171
name = "com_github_bytecodealliance_wasmtime",
72172
build_file = "@proxy_wasm_cpp_host//bazel/external:wasmtime.BUILD",
73173
sha256 = "c59a2aa110b25921d370944287cd97205c73cf3dc76776c5b3551135c1e42ddc",
74174
strip_prefix = "wasmtime-0.33.0",
75175
url = "https://github.com/bytecodealliance/wasmtime/archive/v0.33.0.tar.gz",
76176
)
77177

78-
http_archive(
178+
maybe(
179+
http_archive,
79180
name = "com_github_webassembly_wasm_c_api",
80181
build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD",
81182
sha256 = "c774044f51431429e878bd1b9e2a4e38932f861f9211df72f75e9427eb6b8d32",
@@ -88,30 +189,10 @@ def proxy_wasm_cpp_host_repositories():
88189
actual = "@com_github_webassembly_wasm_c_api//:wasmtime_lib",
89190
)
90191

91-
http_archive(
92-
name = "rules_rust",
93-
sha256 = "8a2052e8ec707aa04a6b9e72bfc67fea44e915ecab1d2d0a4835ad51c2410c36",
94-
strip_prefix = "rules_rust-b16c26ba5faf1c58ebe94582afd20567ce676e6d",
95-
# NOTE: Update Rust version for Linux/s390x in bazel/dependencies.bzl.
96-
url = "https://github.com/bazelbuild/rules_rust/archive/b16c26ba5faf1c58ebe94582afd20567ce676e6d.tar.gz",
97-
)
98-
99-
http_archive(
100-
name = "rules_foreign_cc",
101-
sha256 = "d54742ffbdc6924f222d2179f0e10e911c5c659c4ae74158e9fe827aad862ac6",
102-
strip_prefix = "rules_foreign_cc-0.2.0",
103-
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.2.0.tar.gz",
104-
)
105-
106-
http_archive(
107-
name = "llvm",
108-
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm.BUILD",
109-
sha256 = "7d9a8405f557cefc5a21bf5672af73903b64749d9bc3a50322239f56f34ffddf",
110-
strip_prefix = "llvm-12.0.1.src",
111-
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/llvm-12.0.1.src.tar.xz",
112-
)
192+
# WAVM with dependencies.
113193

114-
http_archive(
194+
maybe(
195+
http_archive,
115196
name = "com_github_wavm_wavm",
116197
build_file = "@proxy_wasm_cpp_host//bazel/external:wavm.BUILD",
117198
sha256 = "bf2b2aec8a4c6a5413081c0527cb40dd16cb67e9c74a91f8a82fe1cf27a3c5d5",
@@ -126,62 +207,11 @@ def proxy_wasm_cpp_host_repositories():
126207
actual = "@com_github_wavm_wavm//:wavm_lib",
127208
)
128209

129-
git_repository(
130-
name = "v8",
131-
# 9.9.115.3
132-
commit = "90f089d97b6e4146ad106eee1829d86ad6392027",
133-
remote = "https://chromium.googlesource.com/v8/v8",
134-
shallow_since = "1643043727 +0000",
135-
)
136-
137-
native.bind(
138-
name = "wee8",
139-
actual = "@v8//:wee8",
140-
)
141-
142-
new_git_repository(
143-
name = "com_googlesource_chromium_base_trace_event_common",
144-
build_file = "@v8//:bazel/BUILD.trace_event_common",
145-
commit = "7f36dbc19d31e2aad895c60261ca8f726442bfbb",
146-
remote = "https://chromium.googlesource.com/chromium/src/base/trace_event/common.git",
147-
shallow_since = "1635355186 -0700",
148-
)
149-
150-
native.bind(
151-
name = "base_trace_event_common",
152-
actual = "@com_googlesource_chromium_base_trace_event_common//:trace_event_common",
153-
)
154-
155-
new_git_repository(
156-
name = "com_googlesource_chromium_zlib",
157-
build_file = "@v8//:bazel/BUILD.zlib",
158-
commit = "fc5cfd78a357d5bb7735a58f383634faaafe706a",
159-
remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git",
160-
shallow_since = "1642005087 -0800",
161-
)
162-
163-
native.bind(
164-
name = "zlib",
165-
actual = "@com_googlesource_chromium_zlib//:zlib",
166-
)
167-
168-
native.bind(
169-
name = "zlib_compression_utils",
170-
actual = "@com_googlesource_chromium_zlib//:zlib_compression_utils",
171-
)
172-
173-
http_archive(
174-
name = "rules_python",
175-
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
176-
strip_prefix = "rules_python-0.6.0",
177-
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
178-
)
179-
180-
http_archive(
181-
name = "bazel_skylib",
182-
urls = [
183-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
184-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
185-
],
186-
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
210+
maybe(
211+
http_archive,
212+
name = "llvm",
213+
build_file = "@proxy_wasm_cpp_host//bazel/external:llvm.BUILD",
214+
sha256 = "7d9a8405f557cefc5a21bf5672af73903b64749d9bc3a50322239f56f34ffddf",
215+
strip_prefix = "llvm-12.0.1.src",
216+
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/llvm-12.0.1.src.tar.xz",
187217
)

0 commit comments

Comments
 (0)