Skip to content

Commit

Permalink
chore: Disable clap "color" feature for wasm builds
Browse files Browse the repository at this point in the history
Feature does not work correctly on wasm due to the "anstream" dependency
not compiling
  • Loading branch information
theduke committed May 11, 2023
1 parent 7f070b0 commit 8d1b932
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions lib/cli-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 16 additions & 1 deletion lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf>,

#[clap(flatten)]
Expand Down

0 comments on commit 8d1b932

Please sign in to comment.