Skip to content

Commit 4741d2f

Browse files
authored
Add Wasmtime runtime. (#73)
Signed-off-by: mathetake <takeshi@tetrate.io>
1 parent b7d3d13 commit 4741d2f

File tree

104 files changed

+8529
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+8529
-33
lines changed

BUILD

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1+
load("//:bazel/variables.bzl", "COPTS", "LINKOPTS")
2+
13
licenses(["notice"]) # Apache 2
24

35
package(default_visibility = ["//visibility:public"])
46

5-
COPTS = select({
6-
"@bazel_tools//src/conditions:windows": [
7-
"/std:c++17",
8-
"-DWITHOUT_ZLIB",
9-
],
10-
"//conditions:default": [
11-
"-std=c++17",
12-
"-DWITHOUT_ZLIB",
13-
],
14-
})
15-
167
cc_library(
178
name = "include",
189
hdrs = glob(["include/proxy-wasm/**/*.h"]),
@@ -21,6 +12,8 @@ cc_library(
2112
],
2213
)
2314

15+
# TODO(mathetkae): once other runtimes(WAVM,V8) can be linked in this repos,
16+
# use -define=wasm=v8|wavm|wasmtime and switch
2417
cc_library(
2518
name = "lib",
2619
srcs = glob(
@@ -36,27 +29,6 @@ cc_library(
3629
"@boringssl//:crypto",
3730
"@com_google_protobuf//:protobuf_lite",
3831
"@proxy_wasm_cpp_sdk//:api_lib",
39-
],
40-
)
41-
42-
cc_test(
43-
name = "wasm_vm_test",
44-
srcs = ["wasm_vm_test.cc"],
45-
copts = COPTS,
46-
deps = [
47-
":lib",
48-
"@com_google_googletest//:gtest",
49-
"@com_google_googletest//:gtest_main",
50-
],
51-
)
52-
53-
cc_test(
54-
name = "context_test",
55-
srcs = ["context_test.cc"],
56-
copts = COPTS,
57-
deps = [
58-
":include",
59-
"@com_google_googletest//:gtest",
60-
"@com_google_googletest//:gtest_main",
32+
"@wasm_c_api//:wasmtime_lib",
6133
],
6234
)

WORKSPACE

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,26 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
3131

3232
bazel_skylib_workspace()
3333

34+
# rust rules
35+
http_archive(
36+
name = "io_bazel_rules_rust",
37+
sha256 = "7401878bf966325bbec5224eeb4ff7e8762681070b401acaa168da68d383563a",
38+
strip_prefix = "rules_rust-9741a32e50a8c50c504c0931111bb6048d6d6888",
39+
url = "https://github.com/bazelbuild/rules_rust/archive/9741a32e50a8c50c504c0931111bb6048d6d6888.tar.gz",
40+
)
41+
42+
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
43+
44+
rust_repositories()
45+
46+
load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace")
47+
48+
rust_workspace()
49+
50+
load("//bazel/cargo:crates.bzl", "proxy_wasm_cpp_host_raze__fetch_remote_crates")
51+
52+
proxy_wasm_cpp_host_raze__fetch_remote_crates()
53+
3454
git_repository(
3555
name = "com_google_protobuf",
3656
commit = "655310ca192a6e3a050e0ca0b7084a2968072260",
@@ -51,3 +71,19 @@ http_archive(
5171
strip_prefix = "googletest-release-1.10.0",
5272
urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"],
5373
)
74+
75+
http_archive(
76+
name = "wasmtime",
77+
build_file = "@proxy_wasm_cpp_host//bazel/external:wasmtime.BUILD",
78+
sha256 = "7874feb1026bbef06796bd5ab80e73f15b8e83752bde8dc93994f5bc039a4952",
79+
strip_prefix = "wasmtime-0.21.0",
80+
url = "https://github.com/bytecodealliance/wasmtime/archive/v0.21.0.tar.gz",
81+
)
82+
83+
http_archive(
84+
name = "wasm_c_api",
85+
build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD",
86+
sha256 = "aea8cd095e9937f1e14f2c93e026317b197eb2345e7a817fe3932062eb7b792c",
87+
strip_prefix = "wasm-c-api-d9a80099d496b5cdba6f3fe8fc77586e0e505ddc",
88+
url = "https://github.com/WebAssembly/wasm-c-api/archive/d9a80099d496b5cdba6f3fe8fc77586e0e505ddc.tar.gz",
89+
)

bazel/cargo/BUILD.bazel

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
"""
2+
@generated
3+
cargo-raze workspace build file.
4+
5+
DO NOT EDIT! Replaced on runs of cargo-raze
6+
"""
7+
8+
package(default_visibility = ["//visibility:public"])
9+
10+
licenses([
11+
"notice", # See individual crates for specific licenses
12+
])
13+
14+
# Aliased targets
15+
alias(
16+
name = "anyhow",
17+
actual = "@proxy_wasm_cpp_host_raze___anyhow__1_0_34//:anyhow",
18+
tags = [
19+
"cargo-raze",
20+
"manual",
21+
],
22+
)
23+
24+
alias(
25+
name = "env_logger",
26+
actual = "@proxy_wasm_cpp_host_raze___env_logger__0_8_1//:env_logger",
27+
tags = [
28+
"cargo-raze",
29+
"manual",
30+
],
31+
)
32+
33+
alias(
34+
name = "indexmap",
35+
actual = "@proxy_wasm_cpp_host_raze___indexmap__1_1_0//:indexmap",
36+
tags = [
37+
"cargo-raze",
38+
"manual",
39+
],
40+
)
41+
42+
alias(
43+
name = "object",
44+
actual = "@proxy_wasm_cpp_host_raze___object__0_21_1//:object",
45+
tags = [
46+
"cargo-raze",
47+
"manual",
48+
],
49+
)
50+
51+
alias(
52+
name = "once_cell",
53+
actual = "@proxy_wasm_cpp_host_raze___once_cell__1_4_1//:once_cell",
54+
tags = [
55+
"cargo-raze",
56+
"manual",
57+
],
58+
)
59+
60+
alias(
61+
name = "wasmtime",
62+
actual = "@proxy_wasm_cpp_host_raze___wasmtime__0_21_0//:wasmtime",
63+
tags = [
64+
"cargo-raze",
65+
"manual",
66+
],
67+
)
68+
69+
alias(
70+
name = "wasmtime_c_api_macros",
71+
actual = "@proxy_wasm_cpp_host_raze___wasmtime_c_api_macros__0_19_0//:wasmtime_c_api_macros",
72+
tags = [
73+
"cargo-raze",
74+
"manual",
75+
],
76+
)

0 commit comments

Comments
 (0)