Skip to content

Rename "runtime" to "engine". #256

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 9 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
41 changes: 28 additions & 13 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load(
"@proxy_wasm_cpp_host//bazel:select.bzl",
"proxy_wasm_select_runtime_v8",
"proxy_wasm_select_runtime_wamr",
"proxy_wasm_select_runtime_wasmtime",
"proxy_wasm_select_runtime_wavm",
"proxy_wasm_select_engine_v8",
"proxy_wasm_select_engine_wamr",
"proxy_wasm_select_engine_wasmtime",
"proxy_wasm_select_engine_wavm",
)

licenses(["notice"]) # Apache 2
Expand Down Expand Up @@ -82,7 +82,10 @@ cc_library(
"include/proxy-wasm/null_vm_plugin.h",
"include/proxy-wasm/wasm_api_impl.h",
],
defines = ["PROXY_WASM_HAS_RUNTIME_NULL"],
defines = [
"PROXY_WASM_HAS_RUNTIME_NULL",
"PROXY_WASM_HOST_ENGINE_NULLVM",
],
deps = [
":headers",
"@com_google_protobuf//:protobuf_lite",
Expand All @@ -96,7 +99,10 @@ cc_library(
"src/v8/v8.cc",
],
hdrs = ["include/proxy-wasm/v8.h"],
defines = ["PROXY_WASM_HAS_RUNTIME_V8"],
defines = [
"PROXY_WASM_HAS_RUNTIME_V8",
"PROXY_WASM_HOST_ENGINE_V8",
],
deps = [
":wasm_vm_headers",
"//external:wee8",
Expand All @@ -111,7 +117,10 @@ cc_library(
"src/wamr/wamr.cc",
],
hdrs = ["include/proxy-wasm/wamr.h"],
defines = ["PROXY_WASM_HAS_RUNTIME_WAMR"],
defines = [
"PROXY_WASM_HAS_RUNTIME_WAMR",
"PROXY_WASM_HOST_ENGINE_WARM",
],
deps = [
":wasm_vm_headers",
"//external:wamr",
Expand All @@ -126,7 +135,10 @@ cc_library(
"src/wasmtime/wasmtime.cc",
],
hdrs = ["include/proxy-wasm/wasmtime.h"],
defines = ["PROXY_WASM_HAS_RUNTIME_WASMTIME"],
defines = [
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
"PROXY_WASM_HOST_ENGINE_WASMTIME",
],
deps = [
":wasm_vm_headers",
"//external:wasmtime",
Expand All @@ -144,7 +156,10 @@ cc_library(
"-Wno-non-virtual-dtor",
"-Wno-old-style-cast",
],
defines = ["PROXY_WASM_HAS_RUNTIME_WAVM"],
defines = [
"PROXY_WASM_HAS_RUNTIME_WAVM",
"PROXY_WASM_HOST_ENGINE_WAVM",
],
deps = [
":wasm_vm_headers",
"//external:wavm",
Expand All @@ -156,13 +171,13 @@ cc_library(
deps = [
":base_lib",
":null_lib",
] + proxy_wasm_select_runtime_v8(
] + proxy_wasm_select_engine_v8(
[":v8_lib"],
) + proxy_wasm_select_runtime_wamr(
) + proxy_wasm_select_engine_wamr(
[":wamr_lib"],
) + proxy_wasm_select_runtime_wasmtime(
) + proxy_wasm_select_engine_wasmtime(
[":wasmtime_lib"],
) + proxy_wasm_select_runtime_wavm(
) + proxy_wasm_select_engine_wavm(
[":wavm_lib"],
),
)
59 changes: 55 additions & 4 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,25 +1,76 @@
load("@bazel_skylib//lib:selects.bzl", "selects")

config_setting(
name = "runtime_v8",
name = "requested_engine_v8",
values = {"define": "engine=v8"},
)

config_setting(
name = "requested_runtime_v8",
values = {"define": "runtime=v8"},
)

selects.config_setting_group(
name = "engine_v8",
match_any = [
":requested_engine_v8",
":requested_runtime_v8",
],
)
config_setting(
name = "requested_engine_wamr",
values = {"define": "engine=wamr"},
)

config_setting(
name = "runtime_wamr",
name = "requested_runtime_wamr",
values = {"define": "runtime=wamr"},
)

selects.config_setting_group(
name = "engine_wamr",
match_any = [
":requested_engine_wamr",
":requested_runtime_wamr",
],
)

config_setting(
name = "runtime_wasmtime",
name = "requested_engine_wasmtime",
values = {"define": "engine=wasmtime"},
)

config_setting(
name = "requested_runtime_wasmtime",
values = {"define": "runtime=wasmtime"},
)

selects.config_setting_group(
name = "engine_wasmtime",
match_any = [
":requested_engine_wasmtime",
":requested_runtime_wasmtime",
],
)

config_setting(
name = "runtime_wavm",
name = "requested_engine_wavm",
values = {"define": "engine=wavm"},
)

config_setting(
name = "requested_runtime_wavm",
values = {"define": "runtime=wavm"},
)

selects.config_setting_group(
name = "engine_wavm",
match_any = [
":requested_engine_wavm",
":requested_runtime_wavm",
],
)

config_setting(
name = "requested_crypto_system",
values = {"define": "crypto=system"},
Expand Down
16 changes: 8 additions & 8 deletions bazel/select.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

def proxy_wasm_select_runtime_v8(xs):
def proxy_wasm_select_engine_v8(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_v8": xs,
"@proxy_wasm_cpp_host//bazel:engine_v8": xs,
"//conditions:default": [],
})

def proxy_wasm_select_runtime_wamr(xs):
def proxy_wasm_select_engine_wamr(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_wamr": xs,
"@proxy_wasm_cpp_host//bazel:engine_wamr": xs,
"//conditions:default": [],
})

def proxy_wasm_select_runtime_wasmtime(xs):
def proxy_wasm_select_engine_wasmtime(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_wasmtime": xs,
"@proxy_wasm_cpp_host//bazel:engine_wasmtime": xs,
"//conditions:default": [],
})

def proxy_wasm_select_runtime_wavm(xs):
def proxy_wasm_select_engine_wavm(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_wavm": xs,
"@proxy_wasm_cpp_host//bazel:engine_wavm": xs,
"//conditions:default": [],
})
8 changes: 4 additions & 4 deletions test/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ namespace proxy_wasm {

std::vector<std::string> getRuntimes() {
std::vector<std::string> runtimes = {
#if defined(PROXY_WASM_HAS_RUNTIME_V8)
#if defined(PROXY_WASM_HOST_ENGINE_V8)
"v8",
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WAVM)
#if defined(PROXY_WASM_HOST_ENGINE_WAVM)
"wavm",
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WASMTIME)
#if defined(PROXY_WASM_HOST_ENGINE_WASMTIME)
"wasmtime",
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WAMR)
#if defined(PROXY_WASM_HOST_ENGINE_WAMR)
"wamr",
#endif
""
Expand Down
16 changes: 8 additions & 8 deletions test/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
#include "include/proxy-wasm/context.h"
#include "include/proxy-wasm/wasm.h"

#if defined(PROXY_WASM_HAS_RUNTIME_V8)
#if defined(PROXY_WASM_HOST_ENGINE_V8)
#include "include/proxy-wasm/v8.h"
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WAVM)
#if defined(PROXY_WASM_HOST_ENGINE_WAVM)
#include "include/proxy-wasm/wavm.h"
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WASMTIME)
#if defined(PROXY_WASM_HOST_ENGINE_WASMTIME)
#include "include/proxy-wasm/wasmtime.h"
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WAMR)
#if defined(PROXY_WASM_HOST_ENGINE_WAMR)
#include "include/proxy-wasm/wamr.h"
#endif

Expand Down Expand Up @@ -76,19 +76,19 @@ class TestVM : public testing::TestWithParam<std::string> {
std::unique_ptr<proxy_wasm::WasmVm> vm;
if (runtime_ == "") {
EXPECT_TRUE(false) << "runtime must not be empty";
#if defined(PROXY_WASM_HAS_RUNTIME_V8)
#if defined(PROXY_WASM_HOST_ENGINE_V8)
} else if (runtime_ == "v8") {
vm = proxy_wasm::createV8Vm();
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WAVM)
#if defined(PROXY_WASM_HOST_ENGINE_WAVM)
} else if (runtime_ == "wavm") {
vm = proxy_wasm::createWavmVm();
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WASMTIME)
#if defined(PROXY_WASM_HOST_ENGINE_WASMTIME)
} else if (runtime_ == "wasmtime") {
vm = proxy_wasm::createWasmtimeVm();
#endif
#if defined(PROXY_WASM_HAS_RUNTIME_WAMR)
#if defined(PROXY_WASM_HOST_ENGINE_WAMR)
} else if (runtime_ == "wamr") {
vm = proxy_wasm::createWamrVm();
#endif
Expand Down