Skip to content

Commit

Permalink
Merge #2364
Browse files Browse the repository at this point in the history
2364: feat: Rename `wasmer-engine-object-file` to `wasmer-engine-staticlib`. r=Hywan a=Hywan

# Description

This PR renames the `wasmer-engine-object-file` crate into `wasmer-engine-staticlib`. We believe it conveys a better meaning of what it does. This PR is similar to its siblings, #2340 and #2356.

Co-authored-by: Ivan Enderlin <[email protected]>
  • Loading branch information
bors[bot] and Hywan authored May 31, 2021
2 parents c0d3a8f + 7978102 commit 7d09f94
Show file tree
Hide file tree
Showing 28 changed files with 217 additions and 210 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ wasmer-emscripten = { version = "1.0.2", path = "lib/emscripten", optional = tru
wasmer-engine = { version = "1.0.2", path = "lib/engine" }
wasmer-engine-universal = { version = "1.0.2", path = "lib/engine-universal", optional = true }
wasmer-engine-dylib = { version = "1.0.2", path = "lib/engine-dylib", optional = true }
wasmer-engine-object-file = { version = "1.0.2", path = "lib/engine-object-file", optional = true }
wasmer-engine-staticlib = { version = "1.0.2", path = "lib/engine-staticlib", optional = true }
wasmer-wasi = { version = "1.0.2", path = "lib/wasi", optional = true }
wasmer-wast = { version = "1.0.2", path = "tests/lib/wast", optional = true }
wasmer-cache = { version = "1.0.2", path = "lib/cache", optional = true }
Expand All @@ -42,7 +42,7 @@ members = [
"lib/engine",
"lib/engine-universal",
"lib/engine-dylib",
"lib/engine-object-file",
"lib/engine-staticlib",
"lib/object",
"lib/vm",
"lib/wasi",
Expand Down Expand Up @@ -83,7 +83,7 @@ default = [
"wast",
"universal",
"dylib",
"object-file",
"staticlib",
"cache",
"wasi",
"emscripten",
Expand All @@ -98,8 +98,8 @@ dylib = [
"wasmer-engine-dylib",
"engine",
]
object-file = [
"wasmer-engine-object-file",
staticlib = [
"wasmer-engine-staticlib",
"engine",
]
cache = ["wasmer-cache"]
Expand All @@ -112,7 +112,7 @@ compiler = [
"wasmer-compiler/translator",
"wasmer-engine-universal/compiler",
"wasmer-engine-dylib/compiler",
"wasmer-engine-object-file/compiler",
"wasmer-engine-staticlib/compiler",
]
singlepass = [
"wasmer-compiler-singlepass",
Expand Down
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SHELL=/bin/bash
# |------------|-----------|----------|--------------|-------|
# | Cranelift | Universal | Linux | amd64 | glibc |
# | LLVM | Dylib | Darwin | aarch64 | musl |
# | Singlepass | | Windows | | |
# | Singlepass | Staticlib | Windows | | |
# |------------|-----------|----------|--------------|-------|
#
# Here is what works and what doesn't:
Expand Down Expand Up @@ -423,15 +423,15 @@ endif

build-docs-capi: capi-setup
cd lib/c-api/doc/deprecated/ && doxygen doxyfile
RUSTFLAGS="${RUSTFLAGS}" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,object-file,dylib,cranelift,wasi $(capi_default_features)
RUSTFLAGS="${RUSTFLAGS}" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,staticlib,dylib,cranelift,wasi $(capi_default_features)

build-capi: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,dylib,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features)
--no-default-features --features deprecated,wat,universal,dylib,staticlib,wasi,middlewares $(capi_default_features) $(capi_compiler_features)

build-capi-singlepass: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,dylib,object-file,singlepass,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,staticlib,singlepass,wasi,middlewares $(capi_default_features)

build-capi-singlepass-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
Expand All @@ -441,17 +441,17 @@ build-capi-singlepass-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,dylib,singlepass,wasi,middlewares $(capi_default_features)

build-capi-singlepass-object-file: capi-setup
build-capi-singlepass-staticlib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,object-file,singlepass,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,staticlib,singlepass,wasi,middlewares $(capi_default_features)

build-capi-cranelift: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,dylib,object-file,cranelift,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,staticlib,cranelift,wasi,middlewares $(capi_default_features)

build-capi-cranelift-system-libffi: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,dylib,object-file,cranelift,wasi,middlewares,system-libffi $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,staticlib,cranelift,wasi,middlewares,system-libffi $(capi_default_features)

build-capi-cranelift-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
Expand All @@ -461,13 +461,13 @@ build-capi-cranelift-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,dylib,cranelift,wasi,middlewares $(capi_default_features)

build-capi-cranelift-object-file: capi-setup
build-capi-cranelift-staticlib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,dylib,object-file,cranelift,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,dylib,staticlib,cranelift,wasi,middlewares $(capi_default_features)

build-capi-llvm: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,dylib,object-file,llvm,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,staticlib,llvm,wasi,middlewares $(capi_default_features)

build-capi-llvm-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
Expand All @@ -477,9 +477,9 @@ build-capi-llvm-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,dylib,llvm,wasi,middlewares $(capi_default_features)

build-capi-llvm-object-file: capi-setup
build-capi-llvm-staticlib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,object-file,llvm,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,staticlib,llvm,wasi,middlewares $(capi_default_features)

# Headless (we include the minimal to be able to run)

Expand All @@ -491,13 +491,13 @@ build-capi-headless-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features dylib,wasi

build-capi-headless-object-file: capi-setup
build-capi-headless-staticlib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features object-file,wasi
--no-default-features --features staticlib,wasi

build-capi-headless-all: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features universal,dylib,object-file,wasi
--no-default-features --features universal,dylib,staticlib,wasi

###########
# Testing #
Expand Down Expand Up @@ -550,7 +550,7 @@ test-capi: build-capi package-capi $(foreach compiler_engine,$(capi_compilers_en

test-capi-crate-%:
WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-crate-//) cargo test --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,dylib,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features) -- --nocapture
--no-default-features --features deprecated,wat,universal,dylib,staticlib,wasi,middlewares $(capi_default_features) $(capi_compiler_features) -- --nocapture

test-capi-integration-%:
# Test the Wasmer C API tests for C
Expand Down
8 changes: 4 additions & 4 deletions lib/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wasmer-emscripten = { version = "1.0.2", path = "../emscripten", optional = true
wasmer-engine = { version = "1.0.2", path = "../engine" }
wasmer-engine-universal = { version = "1.0.2", path = "../engine-universal", optional = true }
wasmer-engine-dylib = { version = "1.0.2", path = "../engine-dylib", optional = true }
wasmer-engine-object-file = { version = "1.0.2", path = "../engine-object-file", optional = true }
wasmer-engine-staticlib = { version = "1.0.2", path = "../engine-staticlib", optional = true }
wasmer-middlewares = { version = "1.0.2", path = "../middlewares", optional = true }
wasmer-wasi = { version = "1.0.2", path = "../wasi", optional = true }
wasmer-types = { version = "1.0.2", path = "../types" }
Expand Down Expand Up @@ -63,15 +63,15 @@ dylib = [
"wasmer-engine-dylib",
"engine",
]
object-file = [
"wasmer-engine-object-file",
staticlib = [
"wasmer-engine-staticlib",
"engine",
]
compiler = [
"wasmer/compiler",
"wasmer-engine-universal/compiler",
"wasmer-engine-dylib/compiler",
"wasmer-engine-object-file/compiler"
"wasmer-engine-staticlib/compiler"
]
singlepass = [
"wasmer-compiler-singlepass",
Expand Down
40 changes: 20 additions & 20 deletions lib/c-api/src/wasm_c_api/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use std::sync::Arc;
use wasmer::Engine;
#[cfg(feature = "dylib")]
use wasmer_engine_dylib::Dylib;
#[cfg(feature = "object-file")]
use wasmer_engine_object_file::ObjectFile;
#[cfg(feature = "staticlib")]
use wasmer_engine_staticlib::Staticlib;
#[cfg(feature = "universal")]
use wasmer_engine_universal::Universal;

Expand Down Expand Up @@ -73,9 +73,9 @@ pub enum wasmer_engine_t {
/// [`wasmer_engine_dylib`] Rust crate.
DYLIB = 1,

/// Variant to represent the Object File engine. See the
/// [`wasmer_engine_object_file`] Rust crate.
OBJECT_FILE = 2,
/// Variant to represent the Staticlib engine. See the
/// [`wasmer_engine_staticlib`] Rust crate.
STATICLIB = 2,
}

impl Default for wasmer_engine_t {
Expand All @@ -85,8 +85,8 @@ impl Default for wasmer_engine_t {
Self::UNIVERSAL
} else if #[cfg(feature = "dylib")] {
Self::DYLIB
} else if #[cfg(feature = "object-file")] {
Self::OBJECT_FILE
} else if #[cfg(feature = "staticlib")] {
Self::STATICLIB
} else {
compile_error!("Please enable one of the engines")
}
Expand Down Expand Up @@ -359,10 +359,10 @@ cfg_if! {
Box::new(wasm_engine_t { inner: engine })
}
}
// There are currently no uses of the object-file engine + compiler from the C API.
// There are currently no uses of the Staticlib engine + compiler from the C API.
// So if we get here, we default to headless mode regardless of if `compiler` is enabled.
else if #[cfg(feature = "object-file")] {
/// Creates a new headless object-file engine.
else if #[cfg(feature = "staticlib")] {
/// Creates a new headless Staticlib engine.
///
/// # Example
///
Expand All @@ -371,7 +371,7 @@ cfg_if! {
/// cbindgen:ignore
#[no_mangle]
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(ObjectFile::headless().engine());
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(Staticlib::headless().engine());
Box::new(wasm_engine_t { inner: engine })
}
} else {
Expand Down Expand Up @@ -526,12 +526,12 @@ pub extern "C" fn wasm_engine_new_with_config(
}
}
},
wasmer_engine_t::OBJECT_FILE => {
wasmer_engine_t::STATICLIB => {
cfg_if! {
// There are currently no uses of the object-file engine + compiler from the C API.
// There are currently no uses of the Staticlib engine + compiler from the C API.
// So we run in headless mode.
if #[cfg(feature = "object-file")] {
let mut builder = ObjectFile::headless();
if #[cfg(feature = "staticlib")] {
let mut builder = Staticlib::headless();

if let Some(target) = config.target {
builder = builder.target(target.inner);
Expand All @@ -543,7 +543,7 @@ pub extern "C" fn wasm_engine_new_with_config(

Arc::new(builder.engine())
} else {
return return_with_error("Wasmer has not been compiled with the `object-file` feature.");
return return_with_error("Wasmer has not been compiled with the `staticlib` feature.");
}
}
},
Expand Down Expand Up @@ -589,10 +589,10 @@ pub extern "C" fn wasm_engine_new_with_config(
}
}
},
wasmer_engine_t::OBJECT_FILE => {
wasmer_engine_t::STATICLIB => {
cfg_if! {
if #[cfg(feature = "object-file")] {
let mut builder = ObjectFile::headless();
if #[cfg(feature = "staticlib")] {
let mut builder = Staticlib::headless();

if let Some(target) = config.target {
builder = builder.target(target.inner);
Expand All @@ -604,7 +604,7 @@ pub extern "C" fn wasm_engine_new_with_config(

Arc::new(builder.engine())
} else {
return return_with_error("Wasmer has not been compiled with the `object-file` feature.");
return return_with_error("Wasmer has not been compiled with the `staticlib` feature.");
}
}
},
Expand Down
10 changes: 5 additions & 5 deletions lib/c-api/src/wasm_c_api/unstable/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub extern "C" fn wasmer_is_engine_available(engine: wasmer_engine_t) -> bool {
match engine {
wasmer_engine_t::UNIVERSAL if cfg!(feature = "universal") => true,
wasmer_engine_t::DYLIB if cfg!(feature = "dylib") => true,
wasmer_engine_t::OBJECT_FILE if cfg!(feature = "object-file") => true,
wasmer_engine_t::STATICLIB if cfg!(feature = "staticlib") => true,
_ => false,
}
}
Expand Down Expand Up @@ -243,8 +243,8 @@ mod tests {
);
set_var("DYLIB", if cfg!(feature = "dylib") { "1" } else { "0" });
set_var(
"OBJECT_FILE",
if cfg!(feature = "object-file") {
"STATICLIB",
if cfg!(feature = "staticlib") {
"1"
} else {
"0"
Expand All @@ -258,7 +258,7 @@ mod tests {
int main() {
assert(wasmer_is_engine_available(UNIVERSAL) == (getenv("UNIVERSAL")[0] == '1'));
assert(wasmer_is_engine_available(DYLIB) == (getenv("DYLIB")[0] == '1'));
assert(wasmer_is_engine_available(OBJECT_FILE) == (getenv("OBJECT_FILE")[0] == '1'));
assert(wasmer_is_engine_available(STATICLIB) == (getenv("STATICLIB")[0] == '1'));

return 0;
}
Expand All @@ -267,6 +267,6 @@ mod tests {

remove_var("UNIVERSAL");
remove_var("DYLIB");
remove_var("OBJECT_FILE");
remove_var("STATICLIB");
}
}
2 changes: 1 addition & 1 deletion lib/c-api/wasmer_wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ typedef enum wasmer_compiler_t {
typedef enum wasmer_engine_t {
UNIVERSAL = 0,
DYLIB = 1,
OBJECT_FILE = 2,
STATICLIB = 2,
} wasmer_engine_t;

typedef enum wasmer_parser_operator_t {
Expand Down
Loading

0 comments on commit 7d09f94

Please sign in to comment.