Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: Upgrade clap to v4 #3854

Merged
merged 3 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 94 additions & 12 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion lib/cache/src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Cache for FileSystemCache {
key.to_string()
};
let path = self.path.join(filename);
let ret = Module::deserialize_from_file(engine, path.clone());
let ret = Module::deserialize_from_file_checked(engine, path.clone());
if ret.is_err() {
// If an error occurs while deserializing then we can not trust it anymore
// so delete the cache file
Expand Down
13 changes: 12 additions & 1 deletion lib/cli-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ wasmer-types = { version = "=3.3.0", path = "../types" }
atty = "0.2"
colored = "2.0"
anyhow = "1.0"
clap = { version = "3.1", features = ["derive"] }
# For the function names autosuggestion
distance = "0.4"
# For the inspect subcommand
Expand All @@ -37,10 +36,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
2 changes: 1 addition & 1 deletion lib/cli-compiler/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::commands::{Config, Validate};
use crate::error::PrettyError;
use anyhow::Result;

use clap::{ErrorKind, Parser};
use clap::{error::ErrorKind, Parser};

#[derive(Parser)]
#[clap(
Expand Down
4 changes: 2 additions & 2 deletions lib/cli-compiler/src/commands/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ use wasmer_types::{
/// The options for the `wasmer compile` subcommand
pub struct Compile {
/// Input file
#[clap(name = "FILE", parse(from_os_str))]
#[clap(name = "FILE")]
path: PathBuf,

/// Output file
#[clap(name = "OUTPUT PATH", short = 'o', parse(from_os_str))]
#[clap(name = "OUTPUT PATH", short = 'o')]
output: PathBuf,

/// Compilation Target triple
Expand Down
12 changes: 6 additions & 6 deletions lib/cli-compiler/src/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ use std::path::PathBuf;
/// The options for the `wasmer config` subcommand
pub struct Config {
/// Print the installation prefix.
#[clap(long, conflicts_with = "pkg-config")]
#[clap(long, conflicts_with = "pkg_config")]
prefix: bool,

/// Directory containing Wasmer executables.
#[clap(long, conflicts_with = "pkg-config")]
#[clap(long, conflicts_with = "pkg_config")]
bindir: bool,

/// Directory containing Wasmer headers.
#[clap(long, conflicts_with = "pkg-config")]
#[clap(long, conflicts_with = "pkg_config")]
includedir: bool,

/// Directory containing Wasmer libraries.
#[clap(long, conflicts_with = "pkg-config")]
#[clap(long, conflicts_with = "pkg_config")]
libdir: bool,

/// Libraries needed to link against Wasmer components.
#[clap(long, conflicts_with = "pkg-config")]
#[clap(long, conflicts_with = "pkg_config")]
libs: bool,

/// C compiler flags for files that include Wasmer headers.
#[clap(long, conflicts_with = "pkg-config")]
#[clap(long, conflicts_with = "pkg_config")]
cflags: bool,

/// It outputs the necessary details for compiling
Expand Down
2 changes: 1 addition & 1 deletion lib/cli-compiler/src/commands/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use wasmer_types::{is_wasm, CpuFeature, Target, Triple};
/// The options for the `wasmer validate` subcommand
pub struct Validate {
/// File to validate as WebAssembly
#[clap(name = "FILE", parse(from_os_str))]
#[clap(name = "FILE")]
path: PathBuf,

#[clap(flatten)]
Expand Down
19 changes: 17 additions & 2 deletions 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 = "3.2.22", features = ["derive", "env"] }

# For the function names autosuggestion
distance = "0.4"
# For the inspect subcommand
Expand Down Expand Up @@ -81,9 +81,24 @@ object = "0.30.0"
wasm-coredump-builder = { version = "0.1.11", optional = true }
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3", features = [ "env-filter", "fmt" ] }
clap-verbosity-flag = "1"
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
6 changes: 3 additions & 3 deletions lib/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ use crate::commands::{
#[cfg(feature = "static-artifact-create")]
use crate::commands::{CreateObj, GenCHeader};
use crate::error::PrettyError;
use clap::{CommandFactory, ErrorKind, Parser};
use clap::{error::ErrorKind, CommandFactory, Parser};

#[derive(Parser, Debug)]
#[cfg_attr(
not(feature = "headless"),
clap(
name = "wasmer",
about = "WebAssembly standalone runtime.",
about = concat!("wasmer ", env!("CARGO_PKG_VERSION")),
version,
author
)
Expand All @@ -31,7 +31,7 @@ use clap::{CommandFactory, ErrorKind, Parser};
feature = "headless",
clap(
name = "wasmer-headless",
about = "WebAssembly standalone runtime (headless).",
about = concat!("wasmer ", env!("CARGO_PKG_VERSION")),
version,
author
)
Expand Down
1 change: 0 additions & 1 deletion lib/cli/src/commands/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub struct Add {
#[clap(long, groups = &["bindings", "py"])]
pip: bool,
/// The packages to add (e.g. "wasmer/[email protected]" or "python/python")
#[clap(parse(try_from_str))]
packages: Vec<wasmer_registry::Package>,
}

Expand Down
4 changes: 2 additions & 2 deletions lib/cli/src/commands/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use wasmer::*;
/// The options for the `wasmer compile` subcommand
pub struct Compile {
/// Input file
#[clap(name = "FILE", parse(from_os_str))]
#[clap(name = "FILE")]
path: PathBuf,

/// Output file
#[clap(name = "OUTPUT PATH", short = 'o', parse(from_os_str))]
#[clap(name = "OUTPUT PATH", short = 'o')]
output: PathBuf,

/// Compilation Target triple
Expand Down
Loading