Skip to content

Commit

Permalink
Miscellaneous refactoring and tidy-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Feb 28, 2023
1 parent adb6989 commit 76b445b
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 141 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

41 changes: 14 additions & 27 deletions lib/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@ edition = "2018"
# `libwasmer.so`, `libwasmer.dylib`, `wasmer.dll` etc. But it creates
# a conflict with the existing `wasmer` crate, see below.
name = "wasmer" # ##lib.name##
# ^ DO NOT REMOVE, it's used the `Makefile`, see `build-docs-capi`.
# ^ DO NOT REMOVE, it's used the `Makefile`, see `build-docs-capi`.
crate-type = ["staticlib", "cdylib"] #"cdylib", "rlib", "staticlib"]

[dependencies]
# We rename `wasmer` to `wasmer-api` to avoid the conflict with this
# library name (see `[lib]`).
wasmer-api = { version = "=3.2.0-alpha.1", path = "../api", default-features = false, features = ["sys"], package = "wasmer" }
wasmer-api = { version = "=3.2.0-alpha.1", path = "../api", default-features = false, features = [
"sys",
], package = "wasmer" }
wasmer-compiler-cranelift = { version = "=3.2.0-alpha.1", path = "../compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { version = "=3.2.0-alpha.1", path = "../compiler-singlepass", optional = true }
wasmer-compiler-llvm = { version = "=3.2.0-alpha.1", path = "../compiler-llvm", optional = true }
wasmer-emscripten = { version = "=3.2.0-alpha.1", path = "../emscripten", optional = true }
wasmer-compiler = { version = "=3.2.0-alpha.1", path = "../compiler" }
wasmer-middlewares = { version = "=3.2.0-alpha.1", path = "../middlewares", optional = true }
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "../wasi", features = ["host-fs", "host-vnet"], optional = true }
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "../wasi", features = [
"host-fs",
"host-vnet",
], optional = true }
wasmer-types = { version = "=3.2.0-alpha.1", path = "../types" }
webc = { version = "5.0.0-rc.2", optional = true }
webc = { version = "5.0.0-rc.3", optional = true }
enumset = "1.0.2"
cfg-if = "1.0"
lazy_static = "1.4"
Expand All @@ -50,19 +55,10 @@ wasmer-inline-c = "0.1.1"
inline-c = "0.1.7"

[features]
default = [
"wat",
"cranelift",
"compiler",
"wasi",
"middlewares",
]
default = ["wat", "cranelift", "compiler", "wasi", "middlewares"]
wat = ["wasmer-api/wat"]
wasi = ["wasmer-wasi"]
middlewares = [
"compiler",
"wasmer-middlewares",
]
middlewares = ["compiler", "wasmer-middlewares"]
compiler = [
"wasmer-api/compiler",
"wasmer-compiler/translator",
Expand All @@ -75,18 +71,9 @@ compiler-headless = [
"wasmer-compiler/translator",
"wasmer-compiler/compiler",
]
singlepass = [
"wasmer-compiler-singlepass",
"compiler",
]
cranelift = [
"wasmer-compiler-cranelift",
"compiler",
]
llvm = [
"wasmer-compiler-llvm",
"compiler",
]
singlepass = ["wasmer-compiler-singlepass", "compiler"]
cranelift = ["wasmer-compiler-cranelift", "compiler"]
llvm = ["wasmer-compiler-llvm", "compiler"]
wasmer-artifact-load = ["wasmer-compiler/wasmer-artifact-load"]
wasmer-artifact-create = ["wasmer-compiler/wasmer-artifact-create"]
static-artifact-load = ["wasmer-compiler/static-artifact-load"]
Expand Down
117 changes: 69 additions & 48 deletions lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,30 @@ required-features = ["headless"]

[dependencies]
wasmer = { version = "=3.2.0-alpha.1", path = "../api", default-features = false }
wasmer-compiler = { version = "=3.2.0-alpha.1", path = "../compiler", features = ["compiler", ] }
wasmer-compiler = { version = "=3.2.0-alpha.1", path = "../compiler", features = [
"compiler",
] }
wasmer-compiler-cranelift = { version = "=3.2.0-alpha.1", path = "../compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { version = "=3.2.0-alpha.1", path = "../compiler-singlepass", optional = true }
wasmer-compiler-llvm = { version = "=3.2.0-alpha.1", path = "../compiler-llvm", optional = true }
wasmer-emscripten = { version = "=3.2.0-alpha.1", path = "../emscripten", optional = true }
wasmer-vm = { version = "=3.2.0-alpha.1", path = "../vm" }
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "../wasi", optional = true }
wasmer-wasi-experimental-io-devices = { version = "=3.2.0-alpha.1", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] }
wasmer-wasi-experimental-io-devices = { version = "=3.2.0-alpha.1", path = "../wasi-experimental-io-devices", optional = true, features = [
"link_external_libs",
] }
wasmer-wasi-local-networking = { version = "=3.2.0-alpha.1", path = "../wasi-local-networking", optional = true }
wasmer-wast = { version = "=3.2.0-alpha.1", path = "../../tests/lib/wast", optional = true }
wasmer-cache = { version = "=3.2.0-alpha.1", path = "../cache", optional = true }
wasmer-types = { version = "=3.2.0-alpha.1", path = "../types", features = ["enable-serde"] }
wasmer-types = { version = "=3.2.0-alpha.1", path = "../types", features = [
"enable-serde",
] }
wasmer-registry = { version = "=4.0.0", path = "../registry" }
wasmer-object = { version = "=3.2.0-alpha.1", path = "../object", optional = true }
wasmer-vfs = { version = "=3.2.0-alpha.1", path = "../vfs", default-features = false, features = ["host-fs"] }
wasmer-vnet = { version = "=3.2.0-alpha.1", path = "../vnet" }
wasmer-vfs = { version = "=3.2.0-alpha.1", path = "../vfs", default-features = false, features = [
"host-fs",
] }
wasmer-vnet = { version = "=3.2.0-alpha.1", path = "../vnet" }
wasmer-wasm-interface = { version = "3.2.0-alpha.1", path = "../wasm-interface" }
wasmparser = "0.51.4"
atty = "0.2"
Expand All @@ -58,8 +66,14 @@ cfg-if = "1.0"
fern = { version = "0.6", features = ["colored"], optional = true }
tempfile = "3"
tempdir = "0.3.7"
http_req = { version="^0.8", default-features = false, features = ["rust-tls"] }
reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls", "json", "multipart"] }
http_req = { version = "^0.8", default-features = false, features = [
"rust-tls",
] }
reqwest = { version = "^0.11", default-features = false, features = [
"rustls-tls",
"json",
"multipart",
] }
serde = { version = "1.0.147", features = ["derive"] }
dirs = { version = "4.0" }
serde_json = { version = "1.0" }
Expand All @@ -73,7 +87,7 @@ toml = "0.5.9"
url = "2.3.1"
libc = { version = "^0.2", default-features = false }
nuke-dir = { version = "0.1.0", optional = true }
webc = { version = "5.0.0-rc.2", optional = true }
webc = { version = "5.0.0-rc.3", optional = true }
isatty = "0.1.9"
dialoguer = "0.10.2"
tldextract = "0.6.0"
Expand All @@ -83,7 +97,11 @@ cargo_metadata = "0.15.2"
rusqlite = { version = "0.28.0", features = ["bundled"] }
tar = "0.4.38"
thiserror = "1.0.37"
time = { version = "0.3.17", default-features = false, features = ["parsing", "std", "formatting"] }
time = { version = "0.3.17", default-features = false, features = [
"parsing",
"std",
"formatting",
] }
log = "0.4.17"
minisign = "0.7.2"
semver = "1.0.14"
Expand All @@ -94,7 +112,10 @@ object = "0.30.0"
wasm-coredump-builder = { version = "0.1.11" }

[build-dependencies]
chrono = { version = "^0.4", default-features = false, features = [ "std", "clock" ] }
chrono = { version = "^0.4", default-features = false, features = [
"std",
"clock",
] }

[target.'cfg(target_os = "linux")'.dependencies]
unix_mode = "0.1.3"
Expand All @@ -119,62 +140,62 @@ wast = ["wasmer-wast"]
wasi = ["wasmer-wasi", "wasmer-wasi-local-networking"]
emscripten = ["wasmer-emscripten"]
wat = ["wasmer/wat"]
webc_runner = ["wasi", "wasmer-wasi/webc_runner", "wasmer-wasi/webc_runner_rt_wasi", "wasmer-wasi/webc_runner_rt_emscripten", "wasmer-wasi/webc_runner_rt_wcgi", "nuke-dir", "webc"]
webc_runner = [
"wasi",
"wasmer-wasi/webc_runner",
"wasmer-wasi/webc_runner_rt_wasi",
"wasmer-wasi/webc_runner_rt_emscripten",
"wasmer-wasi/webc_runner_rt_wcgi",
"nuke-dir",
"webc",
]
compiler = [
"wasmer-compiler/translator",
"wasmer-compiler/compiler",
"wasmer-wasi/compiler"
"wasmer-wasi/compiler",
]
wasmer-artifact-create = ["compiler",
"wasmer/wasmer-artifact-load",
"wasmer/wasmer-artifact-create",
"wasmer-compiler/wasmer-artifact-load",
"wasmer-compiler/wasmer-artifact-create",
"wasmer-object",
]
static-artifact-create = ["compiler",
"wasmer/static-artifact-load",
"wasmer/static-artifact-create",
"wasmer-compiler/static-artifact-load",
"wasmer-compiler/static-artifact-create",
"wasmer-object",
]
wasmer-artifact-load = ["compiler",
"wasmer/wasmer-artifact-load",
"wasmer-compiler/wasmer-artifact-load",
]
static-artifact-load = ["compiler",
"wasmer/static-artifact-load",
"wasmer-compiler/static-artifact-load",
]

experimental-io-devices = [
"wasmer-wasi-experimental-io-devices",
"wasi"
wasmer-artifact-create = [
"compiler",
"wasmer/wasmer-artifact-load",
"wasmer/wasmer-artifact-create",
"wasmer-compiler/wasmer-artifact-load",
"wasmer-compiler/wasmer-artifact-create",
"wasmer-object",
]
singlepass = [
"wasmer-compiler-singlepass",
static-artifact-create = [
"compiler",
"wasmer/static-artifact-load",
"wasmer/static-artifact-create",
"wasmer-compiler/static-artifact-load",
"wasmer-compiler/static-artifact-create",
"wasmer-object",
]
cranelift = [
"wasmer-compiler-cranelift",
wasmer-artifact-load = [
"compiler",
"wasmer/wasmer-artifact-load",
"wasmer-compiler/wasmer-artifact-load",
]
llvm = [
"wasmer-compiler-llvm",
static-artifact-load = [
"compiler",
"wasmer/static-artifact-load",
"wasmer-compiler/static-artifact-load",
]

experimental-io-devices = ["wasmer-wasi-experimental-io-devices", "wasi"]
singlepass = ["wasmer-compiler-singlepass", "compiler"]
cranelift = ["wasmer-compiler-cranelift", "compiler"]
llvm = ["wasmer-compiler-llvm", "compiler"]
debug = ["fern", "wasmer-wasi/logging"]
disable-all-logging = ["wasmer-wasi/disable-all-logging"]
headless = []
headless-minimal = ["headless", "disable-all-logging", "wasi"]

# Optional
enable-serde = [
"wasmer/enable-serde",
"wasmer-vm/enable-serde",
"wasmer-compiler/enable-serde",
"wasmer-wasi/enable-serde",
"wasmer/enable-serde",
"wasmer-vm/enable-serde",
"wasmer-compiler/enable-serde",
"wasmer-wasi/enable-serde",
]

[target.'cfg(target_os = "windows")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl RunWithPathBuf {
if runner.can_run_command(id, command).unwrap_or(false) {
runner
.run_cmd(&container, id)
.context("Emscripten runner failed")?;
.context("WCGI runner failed")?;
}

anyhow::bail!("No runner");
Expand Down
10 changes: 8 additions & 2 deletions lib/registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ dirs = "4.0.0"
graphql_client = "0.11.0"
serde = { version = "1.0.145", features = ["derive"] }
anyhow = "1.0.65"
reqwest = { version = "0.11.12", default-features = false, features = ["rustls-tls", "blocking", "multipart", "json", "stream"] }
reqwest = { version = "0.11.12", default-features = false, features = [
"rustls-tls",
"blocking",
"multipart",
"json",
"stream",
] }
futures-util = "0.3.25"
whoami = "1.2.3"
serde_json = "1.0.85"
Expand All @@ -25,7 +31,7 @@ tar = "0.4.38"
flate2 = "1.0.24"
semver = "1.0.14"
lzma-rs = "0.2.0"
webc = { version = "5.0.0-rc.2", features = ["mmap"] }
webc = { version = "5.0.0-rc.3", features = ["mmap"] }
hex = "0.4.3"
tokio = "1.24.0"
tempdir = "0.3.7"
Expand Down
13 changes: 10 additions & 3 deletions lib/vfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ libc = { version = "^0.2", default-features = false, optional = true }
thiserror = "1"
tracing = { version = "0.1" }
typetag = { version = "0.1", optional = true }
webc = { version = "5.0.0-rc.2", optional = true }
webc = { version = "5.0.0-rc.3", optional = true }
slab = { version = "0.4" }
derivative = "2.2.0"
anyhow = { version = "1.0.66", optional = true }
Expand All @@ -20,12 +20,19 @@ lazy_static = "1.4"
fs_extra = { version = "1.2.0", optional = true }
filetime = { version = "0.2.18", optional = true }
bytes = "1"
tokio = { version = "1", features = [ "io-util", "sync", "macros" ], default_features = false }
tokio = { version = "1", features = [
"io-util",
"sync",
"macros",
], default_features = false }
pin-project-lite = "0.2.9"
indexmap = "1.9.2"

[dev-dependencies]
tokio = { version = "1", features = [ "io-util", "rt" ], default_features = false }
tokio = { version = "1", features = [
"io-util",
"rt",
], default_features = false }

[features]
default = ["host-fs", "webc-fs", "static-fs"]
Expand Down
7 changes: 4 additions & 3 deletions lib/wasi/src/runners/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use webc::{
Version,
};

/// Parsed WAPM file, memory-mapped to an on-disk path
/// A parsed WAPM package.
#[derive(Debug, Clone)]
pub struct WapmContainer {
repr: Repr,
Expand Down Expand Up @@ -89,8 +89,9 @@ impl WapmContainer {
// HACK(Michael-F-Bryan): WapmContainer originally exposed its Arc<WebCMmap>
// field, so every man and his dog accessed it directly instead of going
// through the WapmContainer abstraction. This is an escape hatch to make
// that code w
pub fn v1(&self) -> &WebC<'_> {
// that code keep working for the time being.
// #[deprecated]
pub(crate) fn v1(&self) -> &WebC<'_> {
match &self.repr {
Repr::V1Mmap(mapped) => &*mapped,
Repr::V1Owned(owned) => &*owned,
Expand Down
Loading

0 comments on commit 76b445b

Please sign in to comment.