From 8d1b932601b824a6e731b3bf1c66f92bca41af29 Mon Sep 17 00:00:00 2001 From: Christoph Herzog Date: Thu, 11 May 2023 13:03:43 +0200 Subject: [PATCH] chore: Disable clap "color" feature for wasm builds Feature does not work correctly on wasm due to the "anstream" dependency not compiling --- Cargo.lock | 1 + lib/cli-compiler/Cargo.toml | 12 ++++++++++++ lib/cli/Cargo.toml | 17 ++++++++++++++++- lib/cli/src/store.rs | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b12bfb4e3cd..ee63d69002d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,7 @@ # It is not intended for manual editing. version = 3 + [[package]] name = "addr2line" version = "0.19.0" diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index 3e432be1473..3a00c1ac8c4 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -37,10 +37,22 @@ target-lexicon = { version = "0.12", features = ["std"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] wasmer-compiler-singlepass = { version = "=3.3.0", path = "../compiler-singlepass", optional = true } wasmer-compiler-cranelift = { version = "=3.3.0", path = "../compiler-cranelift", optional = true } +clap = { version = "4.2.7", features = ["derive", "env"] } [target.'cfg(target_arch = "wasm32")'.dependencies] wasmer-compiler-singlepass = { version = "=3.3.0", path = "../compiler-singlepass", optional = true, default-features = false, features = ["wasm"] } wasmer-compiler-cranelift = { version = "=3.3.0", path = "../compiler-cranelift", optional = true, default-features = false, features = ["wasm"] } +# NOTE: Must use different features for clap because the "color" feature does not +# work on wasi due to the anstream dependency not compiling. +clap = { version = "4.2.7", default-features = false, features = [ + "std", + "help", + "usage", + "error-context", + "suggestions", + "derive", + "env", +]} [target.'cfg(target_os = "linux")'.dependencies] unix_mode = "0.1.3" diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 3c9d92b2f98..467d583a633 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -45,7 +45,7 @@ atty = "0.2" colored = "2.0" anyhow = "1.0" spinoff = "0.5.4" -clap = { version = "4.2.7", features = ["derive", "env"] } + # For the function names autosuggestion distance = "0.4" # For the inspect subcommand @@ -84,6 +84,21 @@ tracing-subscriber = { version = "0.3", features = [ "env-filter", "fmt" ] } clap-verbosity-flag = "2" wapm-targz-to-pirita = "0.2.1" +# NOTE: Must use different features for clap because the "color" feature does not +# work on wasi due to the anstream dependency not compiling. +[target.'cfg(not(target_family = "wasm"))'.dependencies] +clap = { version = "4.2.7", features = ["derive", "env"] } +[target.'cfg(target_family = "wasm")'.dependencies] +clap = { version = "4.2.7", default-features = false, features = [ + "std", + "help", + "usage", + "error-context", + "suggestions", + "derive", + "env", +]} + [target.'cfg(not(target_arch = "riscv64"))'.dependencies] http_req = { version="^0.8", default-features = false, features = ["rust-tls"] } reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls", "json", "multipart"] } diff --git a/lib/cli/src/store.rs b/lib/cli/src/store.rs index 7b5eeac874c..8f43a14bb17 100644 --- a/lib/cli/src/store.rs +++ b/lib/cli/src/store.rs @@ -48,7 +48,7 @@ pub struct CompilerOptions { /// LLVM debug directory, where IR and object files will be written to. #[cfg(feature = "llvm")] - #[clap(long, parse(from_os_str))] + #[clap(long)] llvm_debug_dir: Option, #[clap(flatten)]