Skip to content

Commit

Permalink
Remove Universal mentions from cargo features
Browse files Browse the repository at this point in the history
  • Loading branch information
epilys committed Jul 25, 2022
1 parent c437487 commit 8264aec
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 86 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C
- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine
- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI
- #2892 Renamed `get_native_function` to `get_typed_function`, marked former as deprecated.
- [#2869](https://github.com/wasmerio/wasmer/pull/2869) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine.
- [#3029](https://github.com/wasmerio/wasmer/pull/3029) Removed Artifact, Engine traits. Renamed UniversalArtifact to Artifact, and UniversalEngine to Engine.

### Fixed
- [#2963](https://github.com/wasmerio/wasmer/pull/2963) Remove accidental dependency on libwayland and libxcb in ClI
Expand Down
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,11 @@ check-wasmer:
$(CARGO_BINARY) check $(CARGO_TARGET) --manifest-path lib/cli/Cargo.toml $(compiler_features) --bin wasmer

check-wasmer-wasm:
$(CARGO_BINARY) check --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift,universal --bin wasmer-compiler
$(CARGO_BINARY) check --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift --bin wasmer-compiler

check-capi: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) check $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml \
--no-default-features --features wat,universal,wasi,middlewares $(capi_compiler_features)
--no-default-features --features wat,compilation,wasi,middlewares $(capi_compiler_features)

build-wasmer:
$(CARGO_BINARY) build $(CARGO_TARGET) --release --manifest-path lib/cli/Cargo.toml $(compiler_features) --bin wasmer
Expand All @@ -371,7 +371,7 @@ bench:
$(CARGO_BINARY) bench $(CARGO_TARGET) $(compiler_features)

build-wasmer-wasm:
$(CARGO_BINARY) build --release --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift,universal --bin wasmer-compiler
$(CARGO_BINARY) build --release --manifest-path lib/cli-compiler/Cargo.toml --target wasm32-wasi --features singlepass,cranelift --bin wasmer-compiler

# For best results ensure the release profile looks like the following
# in Cargo.toml:
Expand Down Expand Up @@ -421,46 +421,46 @@ build-docs-capi: capi-setup
# when generating the documentation, we rename it to its
# crate's name. Then we restore the lib's name.
sed "$(SEDI)" -e 's/name = "wasmer" # ##lib.name##/name = "wasmer_c_api" # ##lib.name##/' lib/c-api/Cargo.toml
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) doc $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,cranelift,wasi
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) doc $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,compilation,cranelift,wasi
sed "$(SEDI)" -e 's/name = "wasmer_c_api" # ##lib.name##/name = "wasmer" # ##lib.name##/' lib/c-api/Cargo.toml

build-capi: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,wasi,middlewares $(capi_compiler_features)
--no-default-features --features wat,compilation,wasi,middlewares $(capi_compiler_features)

build-capi-singlepass: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,singlepass,wasi,middlewares
--no-default-features --features wat,compilation,singlepass,wasi,middlewares

build-capi-singlepass-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,singlepass,wasi,middlewares
--no-default-features --features wat,compilation,singlepass,wasi,middlewares

build-capi-cranelift: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,cranelift,wasi,middlewares
--no-default-features --features wat,compilation,cranelift,wasi,middlewares

build-capi-cranelift-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,cranelift,wasi,middlewares
--no-default-features --features wat,compilation,cranelift,wasi,middlewares

build-capi-llvm: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,llvm,wasi,middlewares
--no-default-features --features wat,compilation,llvm,wasi,middlewares

build-capi-llvm-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,llvm,wasi,middlewares
--no-default-features --features wat,compilation,llvm,wasi,middlewares

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

build-capi-headless-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features universal,wasi
--no-default-features --features compilation,wasi

build-capi-headless-all: capi-setup
RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features universal,wasi
--no-default-features --features compilation,wasi

build-capi-headless-ios: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo lipo --manifest-path lib/c-api/Cargo.toml --release \
Expand Down Expand Up @@ -520,7 +520,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_BINARY) test $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features wat,universal,wasi,middlewares $(capi_compiler_features) -- --nocapture
--no-default-features --features wat,compilation,wasi,middlewares $(capi_compiler_features) -- --nocapture

test-capi-integration-%:
# Test the Wasmer C API tests for C
Expand Down Expand Up @@ -713,4 +713,4 @@ install-local: package

test-minimal-versions:
rm -f Cargo.lock
cargo +nightly build --tests -Z minimal-versions --all-features
cargo +nightly build --tests -Z minimal-versions --all-features
12 changes: 6 additions & 6 deletions lib/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ core = ["hashbrown"]

# Features for `sys`.
sys = []
sys-default = ["sys", "wat", "default-cranelift", "default-universal"]
sys-default = ["sys", "wat", "default-cranelift", "default-engine_compilation"]
# - Compilers.
compiler = [
"sys",
Expand All @@ -104,16 +104,16 @@ default-cranelift = ["default-compiler", "cranelift"]
default-llvm = ["default-compiler", "llvm"]
# - Engines.
engine = ["sys"]
universal = [
engine_compilation = [
"engine", "wasmer-compiler/engine_compilation"
]
default-engine = []
default-universal = [
default-engine_compilation = [
"default-engine",
"universal",
"engine_compilation",
]
# - Deprecated features.
jit = ["universal"]
jit = ["engine_compilation"]

# Features for `js`.
js = ["wasm-bindgen", "js-sys"]
Expand All @@ -124,4 +124,4 @@ wasm-types-polyfill = ["js", "wasmparser"]
js-serializable-module = []

[package.metadata.docs.rs]
features = ["compiler", "core", "cranelift", "default-compiler", "default-engine", "engine", "jit", "native", "singlepass", "sys", "sys-default", "universal"]
features = ["compiler", "core", "cranelift", "default-compiler", "default-engine", "engine", "jit", "native", "singlepass", "sys", "sys-default", "engine_compilation"]
8 changes: 1 addition & 7 deletions lib/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ fn main() -> anyhow::Result<()> {

Wasmer is not only fast, but also designed to be *highly customizable*:

* **Pluggable engines** — An engine is responsible to drive the
compilation process and to store the generated executable code
somewhere, either:
* in-memory (with [`wasmer-engine-universal`]),

* **Pluggable compilers** — A compiler is used by an engine to
* **Pluggable compilers** — A compiler is used by the engine to
transform WebAssembly into executable code:
* [`wasmer-compiler-singlepass`] provides a fast compilation-time
but an unoptimized runtime speed,
Expand Down Expand Up @@ -94,7 +89,6 @@ more](https://wasmerio.github.io/wasmer/crates/doc/wasmer/).

Made with ❤️ by the Wasmer team, for the community

[`wasmer-engine-universal`]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-universal
[`wasmer-compiler-singlepass`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-singlepass
[`wasmer-compiler-cranelift`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-cranelift
[`wasmer-compiler-llvm`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler-llvm
30 changes: 8 additions & 22 deletions lib/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@
//!
//! Wasmer is not only fast, but also designed to be *highly customizable*:
//!
//! * **Pluggable engines** — An engine is responsible to drive the
//! compilation process and to store the generated executable code
//! somewhere, either:
//! * in-memory (with [`wasmer-engine-universal`]),
//!
//! * **Pluggable compilers** — A compiler is used by an engine to
//! * **Pluggable compilers** — A compiler is used by the engine to
//! transform WebAssembly into executable code:
//! * [`wasmer-compiler-singlepass`] provides a fast compilation-time
//! but an unoptimized runtime speed,
Expand Down Expand Up @@ -243,15 +238,15 @@
//! - [`wasmer-wasi`] for running Wasm modules compiled to the WASI ABI.
//!
//! The Wasmer project has two major abstractions:
//! 1. [Engines][wasmer-engine],
//! 1. [Engine][wasmer-compiler],
//! 2. [Compilers][wasmer-compiler].
//!
//! These two abstractions have multiple options that can be enabled
//! with features.
//!
//! ## Engines
//! ## Engine
//!
//! An engine is a system that uses a compiler to make a WebAssembly
//! The engine is a system that uses a compiler to make a WebAssembly
//! module executable.
//!
//! ## Compilers
Expand Down Expand Up @@ -311,10 +306,10 @@
#![cfg_attr(feature = "wat", doc = "(enabled),")]
#![cfg_attr(not(feature = "wat"), doc = "(disabled),")]
//! enables `wasmer` to parse the WebAssembly text format,
//! - `universal`
#![cfg_attr(feature = "universal", doc = "(enabled),")]
#![cfg_attr(not(feature = "universal"), doc = "(disabled),")]
//! enables [the Universal engine][`wasmer-engine-universal`].
//! - `compilation`
#![cfg_attr(feature = "compilation", doc = "(enabled),")]
#![cfg_attr(not(feature = "compilation"), doc = "(disabled),")]
//! enables compilation with the wasmer engine.
//!
//! The features that set defaults come in sets that are mutually exclusive.
//!
Expand All @@ -331,13 +326,6 @@
#![cfg_attr(feature = "default-singlepass", doc = "(enabled),")]
#![cfg_attr(not(feature = "default-singlepass"), doc = "(disabled),")]
//! set Wasmer's Singlepass compiler as the default.
//!
//! The next set is the default engine set:
//! - `default-universal`
#![cfg_attr(feature = "default-universal", doc = "(enabled),")]
#![cfg_attr(not(feature = "default-universal"), doc = "(disabled),")]
//! set the Universal engine as the default.
//!
#![cfg_attr(
feature = "js",
doc = "## Features for the `js` feature group (enabled)"
Expand Down Expand Up @@ -414,8 +402,6 @@
//! [`wasmer-cache`]: https://docs.rs/wasmer-cache/
//! [wasmer-compiler]: https://docs.rs/wasmer-compiler/
//! [`wasmer-emscripten`]: https://docs.rs/wasmer-emscripten/
//! [wasmer-engine]: https://docs.rs/wasmer-engine/
//! [`wasmer-engine-universal`]: https://docs.rs/wasmer-engine-universal/
//! [`wasmer-compiler-singlepass`]: https://docs.rs/wasmer-compiler-singlepass/
//! [`wasmer-compiler-llvm`]: https://docs.rs/wasmer-compiler-llvm/
//! [`wasmer-compiler-cranelift`]: https://docs.rs/wasmer-compiler-cranelift/
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/sys/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl Default for Store {
#[allow(unreachable_code, unused_mut)]
fn get_engine(mut config: impl CompilerConfig + 'static) -> Engine {
cfg_if::cfg_if! {
if #[cfg(feature = "default-universal")] {
if #[cfg(feature = "engine_compilation")] {
wasmer_compiler::Backend::new(config)
.engine()
} else {
Expand Down
6 changes: 3 additions & 3 deletions lib/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline-c = "0.1.5"
default = [
"wat",
"cranelift",
"universal",
"compilation",
"wasi",
"middlewares",
]
Expand All @@ -58,7 +58,7 @@ middlewares = [
"compiler",
"wasmer-middlewares",
]
universal = [
compilation = [
"wasmer-compiler/engine_compilation",
"compiler",
]
Expand All @@ -79,7 +79,7 @@ llvm = [
]

# Deprecated features.
jit = ["universal"]
jit = ["compilation"]

# TODO: Port this feature.
#emscripten = ["wasmer-emscripten"]
Expand Down
2 changes: 1 addition & 1 deletion lib/c-api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn build_wasm_c_api_headers(crate_dir: &str, out_dir: &str) {
pre_header = PRE_HEADER
);

map_feature_as_c_define!("universal", UNIVERSAL_FEATURE_AS_C_DEFINE, pre_header);
map_feature_as_c_define!("compilation", UNIVERSAL_FEATURE_AS_C_DEFINE, pre_header);
map_feature_as_c_define!("compiler", COMPILER_FEATURE_AS_C_DEFINE, pre_header);
map_feature_as_c_define!("wasi", WASI_FEATURE_AS_C_DEFINE, pre_header);
map_feature_as_c_define!("middlewares", MIDDLEWARES_FEATURE_AS_C_DEFINE, pre_header);
Expand Down
22 changes: 11 additions & 11 deletions lib/c-api/src/wasm_c_api/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::unstable::target_lexicon::wasmer_target_t;
use crate::error::update_last_error;
use cfg_if::cfg_if;
use std::sync::Arc;
#[cfg(feature = "universal")]
#[cfg(feature = "compilation")]
use wasmer_compiler::{Backend, Engine};

/// Kind of compilers that can be used by the engines.
Expand Down Expand Up @@ -69,7 +69,7 @@ pub enum wasmer_engine_t {
impl Default for wasmer_engine_t {
fn default() -> Self {
cfg_if! {
if #[cfg(feature = "universal")] {
if #[cfg(feature = "compilation")] {
Self::UNIVERSAL
} else {
compile_error!("Please enable one of the engines")
Expand Down Expand Up @@ -268,7 +268,7 @@ pub struct wasm_engine_t {
#[cfg(feature = "compiler")]
use wasmer_api::CompilerConfig;

#[cfg(all(feature = "compiler", any(feature = "universal", feature = "dylib")))]
#[cfg(all(feature = "compiler", any(feature = "compilation", feature = "dylib")))]
fn get_default_compiler_config() -> Box<dyn CompilerConfig> {
cfg_if! {
if #[cfg(feature = "cranelift")] {
Expand All @@ -284,7 +284,7 @@ fn get_default_compiler_config() -> Box<dyn CompilerConfig> {
}

cfg_if! {
if #[cfg(all(feature = "universal", feature = "compiler"))] {
if #[cfg(all(feature = "compilation", feature = "compiler"))] {
/// Creates a new Universal engine with the default compiler.
///
/// # Example
Expand All @@ -298,7 +298,7 @@ cfg_if! {
let engine: Arc<Engine> = Arc::new(Backend::new(compiler_config).engine());
Box::new(wasm_engine_t { inner: engine })
}
} else if #[cfg(feature = "universal")] {
} else if #[cfg(feature = "compilation")] {
/// Creates a new headless Universal engine.
///
/// # Example
Expand All @@ -321,7 +321,7 @@ cfg_if! {
/// cbindgen:ignore
#[no_mangle]
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
unimplemented!("No engine attached; You might want to recompile `wasmer_c_api` with for example `--feature universal`");
unimplemented!("No engine attached; You might want to recompile `wasmer_c_api` with for example `--feature compilation`");
}
}
}
Expand Down Expand Up @@ -418,9 +418,9 @@ pub extern "C" fn wasm_engine_new_with_config(
compiler_config.canonicalize_nans(true);
}

#[cfg(not(feature = "universal"))]
return return_with_error("Wasmer has not been compiled with the `universal` feature.");
#[cfg(feature = "universal")]
#[cfg(not(feature = "compilation"))]
return return_with_error("Wasmer has not been compiled with the `compilation` feature.");
#[cfg(feature = "compilation")]
let inner: Arc<Engine> =
{
let mut builder = Backend::new(compiler_config);
Expand All @@ -439,7 +439,7 @@ pub extern "C" fn wasm_engine_new_with_config(
} else {
let inner: Arc<Engine> =
cfg_if! {
if #[cfg(feature = "universal")] {
if #[cfg(feature = "compilation")] {
let mut builder = Backend::headless();

if let Some(target) = config.target {
Expand All @@ -452,7 +452,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 `universal` feature.");
return return_with_error("Wasmer has not been compiled with the `compilation` feature.");
}
};
Some(Box::new(wasm_engine_t { inner }))
Expand Down
1 change: 1 addition & 0 deletions lib/c-api/src/wasm_c_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ mod macros;
/// ```
///
/// To configure the engine, see the [`wasm_config_new`][engine::wasm_config_new].
#[cfg(feature = "compilation")]
pub mod engine;

/// cbindgen:ignore
Expand Down
4 changes: 2 additions & 2 deletions lib/c-api/src/wasm_c_api/unstable/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub extern "C" fn wasmer_is_headless() -> bool {
/// compiled library.
#[no_mangle]
pub extern "C" fn wasmer_is_engine_available(engine: wasmer_engine_t) -> bool {
matches!(engine, wasmer_engine_t::UNIVERSAL if cfg!(feature = "universal"))
matches!(engine, wasmer_engine_t::UNIVERSAL if cfg!(feature = "compilation"))
}

#[cfg(test)]
Expand Down Expand Up @@ -234,7 +234,7 @@ mod tests {
fn test_wasmer_is_engine_available() {
set_var(
"UNIVERSAL",
if cfg!(feature = "universal") {
if cfg!(feature = "compilation") {
"1"
} else {
"0"
Expand Down
Loading

0 comments on commit 8264aec

Please sign in to comment.