Skip to content

Commit 1f8b398

Browse files
committed
Add --all-features flag to cargo
1 parent 3e41b6b commit 1f8b398

25 files changed

+145
-9
lines changed

src/bin/bench.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub struct Options {
99
flag_package: Vec<String>,
1010
flag_jobs: Option<u32>,
1111
flag_features: Vec<String>,
12+
flag_all_features: bool,
1213
flag_no_default_features: bool,
1314
flag_target: Option<String>,
1415
flag_manifest_path: Option<String>,
@@ -42,6 +43,7 @@ Options:
4243
-p SPEC, --package SPEC ... Package to run benchmarks for
4344
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
4445
--features FEATURES Space-separated list of features to also build
46+
--all-features Build all available features
4547
--no-default-features Do not build the `default` feature
4648
--target TRIPLE Build for the target triple
4749
--manifest-path PATH Path to the manifest to build benchmarks for
@@ -83,6 +85,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
8385
jobs: options.flag_jobs,
8486
target: options.flag_target.as_ref().map(|s| &s[..]),
8587
features: &options.flag_features,
88+
all_features: options.flag_all_features,
8689
no_default_features: options.flag_no_default_features,
8790
spec: &options.flag_package,
8891
exec_engine: None,

src/bin/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub struct Options {
1111
flag_package: Vec<String>,
1212
flag_jobs: Option<u32>,
1313
flag_features: Vec<String>,
14+
flag_all_features: bool,
1415
flag_no_default_features: bool,
1516
flag_target: Option<String>,
1617
flag_manifest_path: Option<String>,
@@ -44,6 +45,7 @@ Options:
4445
--bench NAME Build only the specified benchmark target
4546
--release Build artifacts in release mode, with optimizations
4647
--features FEATURES Space-separated list of features to also build
48+
--all-features Build all available features
4749
--no-default-features Do not build the `default` feature
4850
--target TRIPLE Build for the target triple
4951
--manifest-path PATH Path to the manifest to compile
@@ -79,6 +81,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
7981
jobs: options.flag_jobs,
8082
target: options.flag_target.as_ref().map(|t| &t[..]),
8183
features: &options.flag_features,
84+
all_features: options.flag_all_features,
8285
no_default_features: options.flag_no_default_features,
8386
spec: &options.flag_package,
8487
exec_engine: None,

src/bin/doc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use cargo::util::important_paths::{find_root_manifest_for_wd};
77
pub struct Options {
88
flag_target: Option<String>,
99
flag_features: Vec<String>,
10+
flag_all_features: bool,
1011
flag_jobs: Option<u32>,
1112
flag_manifest_path: Option<String>,
1213
flag_no_default_features: bool,
@@ -39,6 +40,7 @@ Options:
3940
--bin NAME Document only the specified binary
4041
--release Build artifacts in release mode, with optimizations
4142
--features FEATURES Space-separated list of features to also build
43+
--all-features Build all available features
4244
--no-default-features Do not build the `default` feature
4345
--target TRIPLE Build for the target triple
4446
--manifest-path PATH Path to the manifest to document
@@ -74,6 +76,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
7476
jobs: options.flag_jobs,
7577
target: options.flag_target.as_ref().map(|t| &t[..]),
7678
features: &options.flag_features,
79+
all_features: options.flag_all_features,
7780
no_default_features: options.flag_no_default_features,
7881
spec: &options.flag_package,
7982
exec_engine: None,

src/bin/install.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use cargo::util::{CliResult, Config, ToUrl};
66
pub struct Options {
77
flag_jobs: Option<u32>,
88
flag_features: Vec<String>,
9+
flag_all_features: bool,
910
flag_no_default_features: bool,
1011
flag_debug: bool,
1112
flag_bin: Vec<String>,
@@ -48,8 +49,9 @@ Specifying what crate to install:
4849
Build and install options:
4950
-h, --help Print this message
5051
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
51-
--features FEATURES Space-separated list of features to activate
5252
-f, --force Force overwriting existing crates or binaries
53+
--features FEATURES Space-separated list of features to activate
54+
--all-features Build all available features
5355
--no-default-features Do not build the `default` feature
5456
--debug Build in debug mode instead of release mode
5557
--bin NAME Only install the binary NAME
@@ -104,6 +106,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
104106
jobs: options.flag_jobs,
105107
target: None,
106108
features: &options.flag_features,
109+
all_features: options.flag_all_features,
107110
no_default_features: options.flag_no_default_features,
108111
spec: &[],
109112
exec_engine: None,

src/bin/metadata.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use cargo::util::{CliResult, Config};
77
pub struct Options {
88
flag_color: Option<String>,
99
flag_features: Vec<String>,
10+
flag_all_features: bool,
1011
flag_format_version: u32,
1112
flag_manifest_path: Option<String>,
1213
flag_no_default_features: bool,
@@ -27,6 +28,7 @@ Usage:
2728
Options:
2829
-h, --help Print this message
2930
--features FEATURES Space-separated list of features
31+
--all-features Build all available features
3032
--no-default-features Do not include the `default` feature
3133
--no-deps Output information only about the root package
3234
and don't fetch dependencies.
@@ -50,6 +52,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<ExportInfo
5052

5153
let options = OutputMetadataOptions {
5254
features: options.flag_features,
55+
all_features: options.flag_all_features,
5356
no_default_features: options.flag_no_default_features,
5457
no_deps: options.flag_no_deps,
5558
version: options.flag_format_version,

src/bin/run.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub struct Options {
99
flag_example: Option<String>,
1010
flag_jobs: Option<u32>,
1111
flag_features: Vec<String>,
12+
flag_all_features: bool,
1213
flag_no_default_features: bool,
1314
flag_target: Option<String>,
1415
flag_manifest_path: Option<String>,
@@ -34,6 +35,7 @@ Options:
3435
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
3536
--release Build artifacts in release mode, with optimizations
3637
--features FEATURES Space-separated list of features to also build
38+
--all-features Build all available features
3739
--no-default-features Do not build the `default` feature
3840
--target TRIPLE Build for the target triple
3941
--manifest-path PATH Path to the manifest to execute
@@ -75,6 +77,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
7577
jobs: options.flag_jobs,
7678
target: options.flag_target.as_ref().map(|t| &t[..]),
7779
features: &options.flag_features,
80+
all_features: options.flag_all_features,
7881
no_default_features: options.flag_no_default_features,
7982
spec: &[],
8083
exec_engine: None,

src/bin/rustc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub struct Options {
1212
flag_package: Option<String>,
1313
flag_jobs: Option<u32>,
1414
flag_features: Vec<String>,
15+
flag_all_features: bool,
1516
flag_no_default_features: bool,
1617
flag_target: Option<String>,
1718
flag_manifest_path: Option<String>,
@@ -47,6 +48,7 @@ Options:
4748
--release Build artifacts in release mode, with optimizations
4849
--profile PROFILE Profile to build the selected target for
4950
--features FEATURES Features to compile for the package
51+
--all-features Build all available features
5052
--no-default-features Do not compile default features for the package
5153
--target TRIPLE Target triple which compiles will be for
5254
--manifest-path PATH Path to the manifest to fetch dependencies for
@@ -97,6 +99,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
9799
jobs: options.flag_jobs,
98100
target: options.flag_target.as_ref().map(|t| &t[..]),
99101
features: &options.flag_features,
102+
all_features: options.flag_all_features,
100103
no_default_features: options.flag_no_default_features,
101104
spec: &options.flag_package.map_or(Vec::new(), |s| vec![s]),
102105
exec_engine: None,

src/bin/rustdoc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub struct Options {
88
arg_opts: Vec<String>,
99
flag_target: Option<String>,
1010
flag_features: Vec<String>,
11+
flag_all_features: bool,
1112
flag_jobs: Option<u32>,
1213
flag_manifest_path: Option<String>,
1314
flag_no_default_features: bool,
@@ -44,6 +45,7 @@ Options:
4445
--bench NAME Build only the specified benchmark target
4546
--release Build artifacts in release mode, with optimizations
4647
--features FEATURES Space-separated list of features to also build
48+
--all-features Build all available features
4749
--no-default-features Do not build the `default` feature
4850
--target TRIPLE Build for the target triple
4951
--manifest-path PATH Path to the manifest to document
@@ -83,6 +85,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
8385
jobs: options.flag_jobs,
8486
target: options.flag_target.as_ref().map(|t| &t[..]),
8587
features: &options.flag_features,
88+
all_features: options.flag_all_features,
8689
no_default_features: options.flag_no_default_features,
8790
spec: &options.flag_package.map_or(Vec::new(), |s| vec![s]),
8891
exec_engine: None,

src/bin/test.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use cargo::util::important_paths::{find_root_manifest_for_wd};
77
pub struct Options {
88
arg_args: Vec<String>,
99
flag_features: Vec<String>,
10+
flag_all_features: bool,
1011
flag_jobs: Option<u32>,
1112
flag_manifest_path: Option<String>,
1213
flag_no_default_features: bool,
@@ -47,6 +48,7 @@ Options:
4748
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
4849
--release Build artifacts in release mode, with optimizations
4950
--features FEATURES Space-separated list of features to also build
51+
--all-features Build all available features
5052
--no-default-features Do not build the `default` feature
5153
--target TRIPLE Build for the target triple
5254
--manifest-path PATH Path to the manifest to build tests for
@@ -115,6 +117,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
115117
jobs: options.flag_jobs,
116118
target: options.flag_target.as_ref().map(|s| &s[..]),
117119
features: &options.flag_features,
120+
all_features: options.flag_all_features,
118121
no_default_features: options.flag_no_default_features,
119122
spec: &options.flag_package,
120123
exec_engine: None,

src/cargo/core/package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Package {
7878
pub fn package_id(&self) -> &PackageId { self.manifest.package_id() }
7979
pub fn root(&self) -> &Path { self.manifest_path.parent().unwrap() }
8080
pub fn summary(&self) -> &Summary { self.manifest.summary() }
81-
pub fn targets(&self) -> &[Target] { self.manifest().targets() }
81+
pub fn targets(&self) -> &[Target] { self.manifest.targets() }
8282
pub fn version(&self) -> &Version { self.package_id().version() }
8383
pub fn authors(&self) -> &Vec<String> { &self.manifest.metadata().authors }
8484
pub fn publish(&self) -> bool { self.manifest.publish() }

0 commit comments

Comments
 (0)