Skip to content

Commit

Permalink
Merge #3215
Browse files Browse the repository at this point in the history
3215: Update wasmer --version logic, integrate wapm-cli r=Michael-F-Bryan a=fschutt

- [x] Update clap
- [x] Integrate wapm-cli logic
- [x] Polish CLI handling and UX

Fixes #3208.
Fixes #3189.

Co-authored-by: Felix Schütt <[email protected]>
Co-authored-by: Felix Schütt <[email protected]>
  • Loading branch information
3 people authored Oct 25, 2022
2 parents dc8f108 + e268ad1 commit e831932
Show file tree
Hide file tree
Showing 24 changed files with 4,333 additions and 155 deletions.
874 changes: 785 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ members = [
"lib/c-api/tests/wasmer-c-api-test-runner",
"lib/c-api/examples/wasmer-capi-examples-runner",
"lib/types",
"lib/registry",
"tests/wasi-wast",
"tests/lib/wast",
"tests/lib/compiler-test-derive",
Expand Down
13 changes: 13 additions & 0 deletions lib/c-api/examples/assets/qjs-wapm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "adamz/qjs"
version = "0.0.1"
description = "https://github.com/bellard/quickjs"
license = "MIT"

[[command]]
name = "qjs"
module = "qjs"

[[module]]
name = "qjs"
source = "qjs.wasm"
13 changes: 12 additions & 1 deletion lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ wasmer-wasi-experimental-io-devices = { version = "=3.0.0-beta.2", path = "../wa
wasmer-wast = { version = "=3.0.0-beta.2", path = "../../tests/lib/wast", optional = true }
wasmer-cache = { version = "=3.0.0-beta.2", path = "../cache", optional = true }
wasmer-types = { version = "=3.0.0-beta.2", path = "../types" }
wasmer-registry = { version = "=3.0.0-beta.2", path = "../registry" }
wasmer-object = { version = "=3.0.0-beta.2", path = "../object", optional = true }
wasmer-vfs = { version = "=3.0.0-beta.2", path = "../vfs", default-features = false, features = ["host-fs"] }
atty = "0.2"
colored = "2.0"
anyhow = "1.0"
clap = { version = "3.1", features = ["derive"] }
spinner = "0.5.0"
clap = { version = "3.2.22", features = ["derive"] }
# For the function names autosuggestion
distance = "0.4"
# For the inspect subcommand
Expand All @@ -56,6 +58,15 @@ http_req = { version="^0.8", default-features = false, features = ["rust-tls"],
dirs = { version = "4.0", optional = true }
serde_json = { version = "1.0", optional = true }
target-lexicon = { version = "0.12", features = ["std"] }
prettytable-rs = "0.9.0"
wapm-toml = "0.1.2"
walkdir = "2.3.2"
regex = "1.6.0"
toml = "0.5.9"
url = "2.3.1"

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

[target.'cfg(target_os = "linux")'.dependencies]
unix_mode = "0.1.3"
Expand Down
26 changes: 24 additions & 2 deletions lib/cli/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
use chrono::prelude::*;
use std::process::Command;

pub fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=WASMER_INSTALL_PREFIX");
// Set WASMER_GIT_HASH
let git_hash = Command::new("git")
.args(&["rev-parse", "HEAD"])
.output()
.ok()
.and_then(|output| String::from_utf8(output.stdout).ok())
.unwrap_or_default();
println!("cargo:rustc-env=WASMER_BUILD_GIT_HASH={}", git_hash);

if git_hash.len() > 5 {
println!(
"cargo:rustc-env=WASMER_BUILD_GIT_HASH_SHORT={}",
&git_hash[..5]
);
} else {
println!("cargo:rustc-env=WASMER_BUILD_GIT_HASH_SHORT=??????");
}

let utc: DateTime<Utc> = Utc::now();
let date = utc.format("%Y-%m-%d").to_string();
println!("cargo:rustc-env=WASMER_BUILD_DATE={}", date);
}
Loading

0 comments on commit e831932

Please sign in to comment.