Skip to content

Commit e38c8ce

Browse files
authored
chore: bump rules_python and rules_fuzzing (#404)
Upgrade rules_python (0.34.0) and rules_fuzzing (0.5.2) This requires extracting WORKSPACE phases into more phases: - dependencies -- py_repositories() and toolchains - dependencies_python() -- pip_parse module loading - dependencies_import() -- python/fuzzing/other deps The new structure roughly matches Envoy WORKSPACE: - envoy_dependencies() - envoy_dependencies_extra() -- not needed here - envoy_python_dependencies() - envoy_dependency_imports() Signed-off-by: Martijn Stevenson <[email protected]>
1 parent e1f2d62 commit e38c8ce

File tree

6 files changed

+100
-22
lines changed

6 files changed

+100
-22
lines changed

WORKSPACE

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ load("@proxy_wasm_cpp_host//bazel:dependencies.bzl", "proxy_wasm_cpp_host_depend
88

99
proxy_wasm_cpp_host_dependencies()
1010

11+
load("@proxy_wasm_cpp_host//bazel:dependencies_python.bzl", "proxy_wasm_cpp_host_dependencies_python")
12+
13+
proxy_wasm_cpp_host_dependencies_python()
14+
15+
load("@proxy_wasm_cpp_host//bazel:dependencies_import.bzl", "proxy_wasm_cpp_host_dependencies_import")
16+
17+
proxy_wasm_cpp_host_dependencies_import()
18+
1119
load("@proxy_wasm_cpp_sdk//bazel:repositories.bzl", "proxy_wasm_cpp_sdk_repositories")
1220

1321
proxy_wasm_cpp_sdk_repositories()

bazel/dependencies.bzl

+6-16
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,18 @@ load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_to
1616
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
1717
load("@proxy_wasm_cpp_host//bazel/cargo/wasmsign/remote:crates.bzl", wasmsign_crate_repositories = "crate_repositories")
1818
load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime/remote:crates.bzl", wasmtime_crate_repositories = "crate_repositories")
19-
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
20-
load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init")
21-
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
22-
load("@rules_python//python:pip.bzl", "pip_install")
19+
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
2320
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
2421
load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set")
2522

2623
def proxy_wasm_cpp_host_dependencies():
2724
# Bazel extensions.
2825

29-
rules_foreign_cc_dependencies()
30-
31-
rules_fuzzing_dependencies()
32-
rules_fuzzing_init()
26+
py_repositories()
27+
python_register_toolchains(
28+
name = "python_3_9",
29+
python_version = "3.9",
30+
)
3331

3432
rust_repositories()
3533
rust_repository_set(
@@ -68,14 +66,6 @@ def proxy_wasm_cpp_host_dependencies():
6866

6967
protobuf_deps()
7068

71-
# V8 dependencies.
72-
73-
pip_install(
74-
name = "v8_python_deps",
75-
extra_pip_args = ["--require-hashes"],
76-
requirements = "@v8//:bazel/requirements.txt",
77-
)
78-
7969
# Wasmtime dependencies.
8070

8171
wasmtime_crate_repositories()

bazel/dependencies_import.bzl

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("@fuzzing_py_deps//:requirements.bzl", pip_fuzzing_dependencies = "install_deps")
16+
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
17+
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
18+
load("@v8_python_deps//:requirements.bzl", pip_v8_dependencies = "install_deps")
19+
20+
def proxy_wasm_cpp_host_dependencies_import():
21+
rules_foreign_cc_dependencies()
22+
rules_fuzzing_dependencies()
23+
24+
pip_fuzzing_dependencies()
25+
pip_v8_dependencies()

bazel/dependencies_python.bzl

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init")
16+
load("@rules_python//python:pip.bzl", "pip_parse")
17+
18+
def proxy_wasm_cpp_host_dependencies_python():
19+
# NOTE: this loads @fuzzing_py_deps via pip_parse
20+
rules_fuzzing_init()
21+
22+
# V8 dependencies.
23+
pip_parse(
24+
name = "v8_python_deps",
25+
extra_pip_args = ["--require-hashes"],
26+
requirements_lock = "@v8//:bazel/requirements.txt",
27+
)

bazel/external/v8.patch

+20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 1. Disable pointer compression (limits the maximum number of WasmVMs).
22
# 2. Don't expose Wasm C API (only Wasm C++ API).
33
# 3. Fix gcc build error by disabling nonnull warning.
4+
# 4. Allow compiling v8 on macOS 10.15 to 13.0. TODO(dio): Will remove this patch when https://bugs.chromium.org/p/v8/issues/detail?id=13428 is fixed.
45

56
diff --git a/BUILD.bazel b/BUILD.bazel
67
index 4e89f90e7e..3fcb38b3f3 100644
@@ -27,6 +28,25 @@ index e957c0fad3..063627b72b 100644
2728
# Use GNU dialect, because GCC doesn't allow using
2829
# ##__VA_ARGS__ when in standards-conforming mode.
2930
"-std=gnu++17",
31+
@@ -151,6 +152,18 @@ def _default_args():
32+
"-fno-integrated-as",
33+
],
34+
"//conditions:default": [],
35+
+ }) + select({
36+
+ "@v8//bazel/config:is_macos": [
37+
+ # The clang available on macOS catalina has a warning that isn't clean on v8 code.
38+
+ "-Wno-range-loop-analysis",
39+
+
40+
+ # To supress warning on deprecated declaration on v8 code. For example:
41+
+ # external/v8/src/base/platform/platform-darwin.cc:56:22: 'getsectdatafromheader_64'
42+
+ # is deprecated: first deprecated in macOS 13.0.
43+
+ # https://bugs.chromium.org/p/v8/issues/detail?id=13428.
44+
+ "-Wno-deprecated-declarations",
45+
+ ],
46+
+ "//conditions:default": [],
47+
}),
48+
includes = ["include"],
49+
linkopts = select({
3050
diff --git a/src/wasm/c-api.cc b/src/wasm/c-api.cc
3151
index 4473e205c0..65a6ec7e1d 100644
3252
--- a/src/wasm/c-api.cc

bazel/repositories.bzl

+14-6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ def proxy_wasm_cpp_host_repositories():
4040
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
4141
)
4242

43+
maybe(
44+
http_archive,
45+
name = "rules_cc",
46+
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
47+
strip_prefix = "rules_cc-0.0.9",
48+
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
49+
)
50+
4351
maybe(
4452
http_archive,
4553
name = "bazel_clang_tidy",
@@ -69,17 +77,17 @@ def proxy_wasm_cpp_host_repositories():
6977
maybe(
7078
http_archive,
7179
name = "rules_fuzzing",
72-
sha256 = "23bb074064c6f488d12044934ab1b0631e8e6898d5cf2f6bde087adb01111573",
73-
strip_prefix = "rules_fuzzing-0.3.1",
74-
url = "https://github.com/bazelbuild/rules_fuzzing/archive/v0.3.1.zip",
80+
sha256 = "3ec0eee05b243552cc4a784b30323d088bf73cb2177ddda02c827e68981933f1",
81+
strip_prefix = "rules_fuzzing-0.5.2",
82+
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.5.2.tar.gz"],
7583
)
7684

7785
maybe(
7886
http_archive,
7987
name = "rules_python",
80-
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
81-
strip_prefix = "rules_python-0.6.0",
82-
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
88+
sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
89+
strip_prefix = "rules_python-0.34.0",
90+
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
8391
)
8492

8593
maybe(

0 commit comments

Comments
 (0)