#cargo-command #matrix #run-command #features #sets #enabled #combination

bin+lib cargo-feature-matrix

在特性集矩阵上运行 cargo 命令

6 个版本

0.3.0 2022 年 11 月 27 日
0.2.2 2022 年 2 月 25 日
0.2.1 2022 年 1 月 12 日
0.2.0 2021 年 12 月 3 日
0.1.1 2021 年 12 月 3 日

#402Cargo 插件

每月 21 次下载

MIT/Apache

23KB
516

Cargo 特性矩阵

在特性集矩阵上运行 cargo 命令。

动机

如果您曾经想知道您的包的所有特性是否在不同的组合中实际都工作,那么您可能会对这个包感兴趣。它会查找您包的所有特性,并为每个特性组合运行一个 cargo 命令。它还考虑了传递性启用的特性。因此,如果您有 feat-a 启用了 feat-b,它不会进行两次独立的运行。

安装

cargo install cargo-feature-matrix

用法

任何接受 --package--features--no-default-features 标志的 cargo 命令都可以使用此命令运行。

cargo feature-matrix [OPTIONS] <COMMAND> [-- <COMMAND_ARGS_AND_FLAGS>...]

选项

以下为 cargo help feature-matrix 的输出

USAGE:
    cargo feature-matrix [OPTIONS] <COMMAND> [-- <ARGS>...]

ARGS:
    <COMMAND>
            The cargo commands to run

    <ARGS>...
            Arguments to pass to the cargo command

OPTIONS:
        --color <COLOR>
            Colorize output

            [default: auto]
            [possible values: auto, always, never]

    -d, --deny <DENY>...
            Add these features to the deny list

        --dry-run
            Perform a dry run and print output as if all the jobs succeeded

    -h, --help
            Print help information

    -m, --manifest-path <MANIFEST_PATH>
            The path to the cargo manifest file to use

    -p, --print-jobs
            Print a list of all the cargo commands one per line.

            This is intended to be consumed by external job runners.

    -V, --version
            Print version information

配置

它还支持以下配置选项在 crate 的 Cargo.toml 文件中。每个配置设置都是可选的,如果您对默认值满意,可以完全省略配置。

[package.metadata.feature-matrix]

# If this set is not empty, only these features will be used to construct the
# matrix.
seed = ["a", "list", "of", "features"]

# All of these features will be included in every feature set in the matrix.
include = ["a", "list", "of", "features"]

# Any feature set that includes any of these will be excluded from the matrix.
# This includes features enabled by other features.
#
# This can be used for things like having an "__unstable" feature that gets
# enabled by any other features that use unstable rust features and then
# excluding "__unstable" if not on nightly.
deny = ["a", "list", "of", "features"]

# These sets will be dropped from the matrix.
skip = [["a", "list"], ["of", "feature"], ["lists"]]

# Some crates prepend internal features with a double underscore. If this
# flag is not set, those features will not be used to build the matrix, but
# will be allowed if they are enabled by other features. Defaults is false
include_hidden = true

# List sets of features that can't be used together. Any generated feature
# set that is a superset of any of these sets will be dropped from the matrix.
conflict = [["a", "list"], ["of", "feature"], ["lists"]]

许可

MIT 许可证下许可。

贡献

任何提交的用于包含在此作品中的贡献都应按上述方式许可,而不附加任何额外的条款和条件。

依赖

~3.5–5MB
~84K SLoC