Skip to content

nullvm: don't enable NullVM by default. #251

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 16 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
14 changes: 10 additions & 4 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ jobs:
fail-fast: false
matrix:
include:
- name: 'NullVM on Linux/x86_64'
runtime: 'nullvm'
os: ubuntu-20.04
arch: x86_64
action: test
- name: 'V8 on Linux/x86_64'
runtime: 'v8'
repo: 'v8'
Expand Down Expand Up @@ -197,11 +202,12 @@ jobs:
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

- name: Set cache key
id: cache-key
if: ${{ (matrix.runtime != 'nullvm' && matrix.runtime != 'wasmtime') || startsWith(matrix.run_under, 'docker') }}
run: echo "::set-output name=uniq::$(bazel query --output build //external:${{ matrix.repo }} | grep -E 'sha256|commit' | cut -d\" -f2)"
id: cache-key

- name: Bazel cache
if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
if: ${{ (matrix.runtime != 'nullvm' && matrix.runtime != 'wasmtime') || startsWith(matrix.run_under, 'docker') }}
uses: PiotrSikora/[email protected]
with:
path: |
Expand Down Expand Up @@ -247,11 +253,11 @@ jobs:
//test:signature_util_test

- name: Skip Bazel cache update
if: ${{ github.ref != 'refs/heads/master' && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }}
if: ${{ github.ref != 'refs/heads/master' && ((matrix.runtime != 'nullvm' && matrix.runtime != 'wasmtime') || startsWith(matrix.run_under, 'docker')) }}
run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV

- name: Cleanup Bazel cache
if: ${{ github.ref == 'refs/heads/master' && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }}
if: ${{ github.ref == 'refs/heads/master' && ((matrix.runtime != 'nullvm' && matrix.runtime != 'wasmtime') || startsWith(matrix.run_under, 'docker')) }}
run: |
export OUTPUT=$(bazel info output_base)
# BoringSSL's test data (90 MiB).
Expand Down
6 changes: 4 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load(
"@proxy_wasm_cpp_host//bazel:select.bzl",
"proxy_wasm_select_runtime_nullvm",
"proxy_wasm_select_runtime_v8",
"proxy_wasm_select_runtime_wamr",
"proxy_wasm_select_runtime_wasmtime",
Expand Down Expand Up @@ -155,8 +156,9 @@ cc_library(
name = "lib",
deps = [
":base_lib",
":null_lib",
] + proxy_wasm_select_runtime_v8(
] + proxy_wasm_select_runtime_nullvm(
[":null_lib"],
) + proxy_wasm_select_runtime_v8(
[":v8_lib"],
) + proxy_wasm_select_runtime_wamr(
[":wamr_lib"],
Expand Down
5 changes: 5 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
load("@bazel_skylib//lib:selects.bzl", "selects")

config_setting(
name = "runtime_nullvm",
values = {"define": "runtime=nullvm"},
)

config_setting(
name = "runtime_v8",
values = {"define": "runtime=v8"},
Expand Down
8 changes: 5 additions & 3 deletions bazel/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ def proxy_wasm_cpp_host_dependencies():

zig_register_toolchains()

# Core dependencies.

protobuf_deps()
# Test dependencies.

wasmsign_fetch_remote_crates()

# NullVM dependencies.

protobuf_deps()

# V8 dependencies.

pip_install(
Expand Down
20 changes: 12 additions & 8 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ def proxy_wasm_cpp_host_repositories():
urls = ["https://github.com/google/boringssl/archive/eaa29f431f71b8121e1da76bcd3ddc2248238ade.tar.gz"],
)

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"],
)

# Test dependencies.

maybe(
http_archive,
name = "com_google_googletest",
Expand All @@ -81,6 +91,8 @@ def proxy_wasm_cpp_host_repositories():
urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"],
)

# NullVM dependencies.

maybe(
http_archive,
name = "com_google_protobuf",
Expand All @@ -89,14 +101,6 @@ def proxy_wasm_cpp_host_repositories():
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz",
)

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(
Expand Down
6 changes: 6 additions & 0 deletions bazel/select.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

def proxy_wasm_select_runtime_nullvm(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_nullvm": xs,
"//conditions:default": [],
})

def proxy_wasm_select_runtime_v8(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_v8": xs,
Expand Down
3 changes: 2 additions & 1 deletion test/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@proxy_wasm_cpp_host//bazel:select.bzl", "proxy_wasm_select_runtime_nullvm")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

licenses(["notice"]) # Apache 2
Expand All @@ -6,7 +7,7 @@ package(default_visibility = ["//visibility:public"])

cc_test(
name = "null_vm_test",
srcs = ["null_vm_test.cc"],
srcs = proxy_wasm_select_runtime_nullvm(["null_vm_test.cc"]),
linkstatic = 1,
deps = [
"//:lib",
Expand Down