在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:taiki-e/cargo-hack开源软件地址:https://github.com/taiki-e/cargo-hack开源编程语言:Rust 98.8%开源软件介绍:cargo-hackCargo subcommand to provide various options useful for testing and continuous integration. UsageClick to show a complete list of options$ cargo hack --help
cargo-hack
Cargo subcommand to provide various options useful for testing and continuous integration.
USAGE:
cargo hack [OPTIONS] [SUBCOMMAND]
Use -h for short descriptions and --help for more details.
OPTIONS:
-p, --package <SPEC>...
Package(s) to check.
--all
Alias for --workspace.
--workspace
Perform command for all packages in the workspace.
--exclude <SPEC>...
Exclude packages from the check.
This flag can only be used together with --workspace
--manifest-path <PATH>
Path to Cargo.toml.
--features <FEATURES>...
Space-separated list of features to activate.
--each-feature
Perform for each feature of the package.
This also includes runs with just --no-default-features flag, and default features.
When this flag is not used together with --exclude-features (--skip) and
--include-features and there are multiple features, this also includes runs with just
--all-features flag.
--feature-powerset
Perform for the feature powerset of the package.
This also includes runs with just --no-default-features flag, and default features.
When this flag is used together with --depth or namespaced features (-Z
namespaced-features) and not used together with --exclude-features (--skip) and
--include-features and there are multiple features, this also includes runs with just
--all-features flag.
--optional-deps [DEPS]...
Use optional dependencies as features.
If DEPS are not specified, all optional dependencies are considered as features.
This flag can only be used together with either --each-feature flag or
--feature-powerset flag.
--skip <FEATURES>...
Alias for --exclude-features.
--exclude-features <FEATURES>...
Space-separated list of features to exclude.
To exclude run of default feature, using value `--exclude-features default`.
To exclude run of just --no-default-features flag, using --exclude-no-default-features
flag.
To exclude run of just --all-features flag, using --exclude-all-features flag.
This flag can only be used together with either --each-feature flag or
--feature-powerset flag.
--exclude-no-default-features
Exclude run of just --no-default-features flag.
This flag can only be used together with either --each-feature flag or
--feature-powerset flag.
--exclude-all-features
Exclude run of just --all-features flag.
This flag can only be used together with either --each-feature flag or
--feature-powerset flag.
--depth <NUM>
Specify a max number of simultaneous feature flags of --feature-powerset.
If NUM is set to 1, --feature-powerset is equivalent to --each-feature.
This flag can only be used together with --feature-powerset flag.
--group-features <FEATURES>...
Space-separated list of features to group.
To specify multiple groups, use this option multiple times: `--group-features a,b
--group-features c,d`
This flag can only be used together with --feature-powerset flag.
--include-features <FEATURES>...
Include only the specified features in the feature combinations instead of package
features.
This flag can only be used together with either --each-feature flag or
--feature-powerset flag.
--no-dev-deps
Perform without dev-dependencies.
Note that this flag removes dev-dependencies from real `Cargo.toml` while cargo-hack is
running and restores it when finished.
--remove-dev-deps
Equivalent to --no-dev-deps flag except for does not restore the original `Cargo.toml`
after performed.
--ignore-private
Skip to perform on `publish = false` packages.
--ignore-unknown-features
Skip passing --features flag to `cargo` if that feature does not exist in the package.
This flag can only be used together with either --features or --include-features.
--version-range <START>..[END]
Perform commands on a specified (inclusive) range of Rust versions.
If the given range is unclosed, the latest stable compiler is treated as the upper
bound.
Note that ranges are always inclusive ranges.
--version-step <NUM>
Specify the version interval of --version-range (default to `1`).
This flag can only be used together with --version-range flag.
--clean-per-run
Remove artifacts for that package before running the command.
If used this flag with --workspace, --each-feature, or --feature-powerset, artifacts
will be removed before each run.
Note that dependencies artifacts will be preserved.
--clean-per-version
Remove artifacts per Rust version.
Note that dependencies artifacts will also be removed.
This flag can only be used together with --version-range flag.
--keep-going
Keep going on failure.
-v, --verbose
Use verbose output.
--color <WHEN>
Coloring: auto, always, never.
This flag will be propagated to cargo.
-h, --help
Prints help information.
-V, --version
Prints version information.
Some common cargo commands are (see all commands with --list):
build Compile the current package
check Analyze the current package and report errors, but don't build object files
run Run a binary or example of the local package
test Run the tests
--each-featurePerform for each feature which includes default features and
This is useful to check that each feature is working properly. (When used for
this purpose, it is recommended to use with cargo hack check --each-feature --no-dev-deps See also Options for adjusting the behavior of --each-feature and --feature-powerset section. --feature-powersetPerform for the feature powerset which includes This is useful to check that every combination of features is working
properly. (When used for this purpose, it is recommended to use with
cargo hack check --feature-powerset --no-dev-deps cargo-hack deduplicate any fully equivalent feature combinations based on how the cargo features work. Therefore, it may be more efficient than checking all feature combinations in other ways. When using this flag results in a very large number of feature combinations, consider using See also Options for adjusting the behavior of --each-feature and --feature-powerset section. Options for adjusting the behavior of --each-feature and --feature-powersetThe following flags can be used with --optional-depsUse optional dependencies as features. This flag treats all option dependencies as features by default. To treat only specific dependencies as features, pass a space or comma separated list. cargo hack check --feature-powerset --optional-deps deps1,deps2 --exclude-features, --skipSpace-separated list of features to exclude. --depthSpecify a max number of simultaneous feature flags of If the number is set to 1, --group-featuresSpace-separated list of features to group. To specify multiple groups, use this option multiple times:
--version-rangePerform commands on a specified (inclusive) range of Rust versions. $ cargo hack check --version-range 1.46..1.47
info: running `cargo +1.46 check` on cargo-hack (1/2)
...
info: running `cargo +1.47 check` on cargo-hack (2/2)
... This might be useful for catching issues like termcolor#35, regex#685, rust-clippy#6324. If the upper bound of the range is omitted, the latest stable compiler is used as the upper bound. If the lower bound of the range is omitted, the value of the You can specify the version interval by using --no-dev-depsPerform without dev-dependencies. This is a workaround for an issue that dev-dependencies leaking into normal build (cargo#4866). Also, this can be used as a workaround for an issue that cargo hack publish --no-dev-deps --dry-run --allow-dirty Note: Currently, using --remove-dev-depsEquivalent to This is useful to know what Cargo.toml that cargo-hack is actually using
with This flag also works without subcommands. --ignore-privateSkip to perform on --ignore-unknown-featuresSkip passing --clean-per-runRemove artifacts for that package before running the command. This also works as a workaround for rust-clippy#4612. Improvement of the behavior of existing cargo flags
--features, --no-default-featuresUnlike --all, --workspacePerform command for all packages in the workspace. Unlike cargo, it does not compile all members at once. For example, running # If you use cargo-hack, you don't need to maintain this list manually.
members=("foo" "bar")
for member in "${members[@]}"; do
cargo check --manifest-path "${member}/Cargo.toml"
done Workspace members will be performed according to the order of the 'packages'
fields of InstallationFrom sourcecargo install cargo-hack Compiler support: requires rustc 1.46+ cargo-hack is usually runnable with Cargo versions older than the Rust version
required for installation (e.g., From prebuilt binariesYou can download prebuilt binaries from the Release page. Prebuilt binaries are available for macOS, Linux (gnu and musl), and Windows (static executable). On GitHub ActionsYou can use taiki-e/install-action to install prebuilt binaries on Linux, macOS, and Windows. This makes the installation faster and may avoid the impact of problems caused by upstream changes. - uses: taiki-e/install-action@cargo-hack Via HomebrewYou can install cargo-hack using Homebrew tap on macOS and Linux: brew install taiki-e/tap/cargo-hack Via AUR (ArchLinux)You can install cargo-hack from AUR: paru -S cargo-hack Note: AUR package is maintained by community, not maintainer of cargo-hack. Related Projects
LicenseLicensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论