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 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
7 changes: 7 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ jobs:
fail-fast: false
matrix:
include:
- name: 'NullVM on Linux/x86_64'
engine: 'null'
os: ubuntu-20.04
arch: x86_64
action: test
flags: --config=gcc
- name: 'V8 on Linux/x86_64'
engine: 'v8'
repo: 'v8'
Expand Down Expand Up @@ -245,6 +251,7 @@ jobs:
//test/...

- name: Bazel build/test (signed Wasm module)
if: ${{ matrix.engine != 'null' }}
run: >
${{ matrix.run_under }}
bazel ${{ matrix.action }}
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_engine_null",
"proxy_wasm_select_engine_v8",
"proxy_wasm_select_engine_wamr",
"proxy_wasm_select_engine_wasmtime",
Expand Down Expand Up @@ -202,8 +203,9 @@ cc_library(
name = "lib",
deps = [
":base_lib",
":null_lib",
] + proxy_wasm_select_engine_v8(
] + proxy_wasm_select_engine_null(
[":null_lib"],
) + proxy_wasm_select_engine_v8(
[":v8_lib"],
) + proxy_wasm_select_engine_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 = "engine_null",
values = {"define": "engine=null"},
)

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

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

def proxy_wasm_select_engine_null(xs):
return select({
"@proxy_wasm_cpp_host//bazel:engine_null": xs,
"@proxy_wasm_cpp_host//bazel:multiengine": xs,
"//conditions:default": [],
})

def proxy_wasm_select_engine_v8(xs):
return select({
"@proxy_wasm_cpp_host//bazel:engine_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_engine_null")
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_engine_null(["null_vm_test.cc"]),
linkstatic = 1,
deps = [
"//:lib",
Expand Down