Skip to content

Commit df5f7d6

Browse files
committed
Turn --avoid-dev-deps into a -Z unstable flag
1 parent 3fc0715 commit df5f7d6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/bin/build.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub struct Options {
1212
flag_features: Vec<String>,
1313
flag_all_features: bool,
1414
flag_no_default_features: bool,
15-
flag_avoid_dev_deps: bool,
1615
flag_target: Option<String>,
1716
flag_manifest_path: Option<String>,
1817
flag_verbose: u32,
@@ -64,7 +63,6 @@ Options:
6463
--features FEATURES Space-separated list of features to also build
6564
--all-features Build all available features
6665
--no-default-features Do not build the `default` feature
67-
--avoid-dev-deps Avoid installing dev-dependencies if possible
6866
--target TRIPLE Build for the target triple
6967
--manifest-path PATH Path to the manifest to compile
7068
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
@@ -101,7 +99,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
10199

102100
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
103101
let mut ws = Workspace::new(&root, config)?;
104-
if options.flag_avoid_dev_deps {
102+
if config.cli_unstable().avoid_dev_deps {
105103
ws.set_require_optional_deps(false);
106104
}
107105

src/cargo/core/features.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ pub struct CliUnstable {
234234
pub unstable_options: bool,
235235
pub offline: bool,
236236
pub no_index_update: bool,
237+
pub avoid_dev_deps: bool,
237238
}
238239

239240
impl CliUnstable {
@@ -266,6 +267,7 @@ impl CliUnstable {
266267
"unstable-options" => self.unstable_options = true,
267268
"offline" => self.offline = true,
268269
"no-index-update" => self.no_index_update = true,
270+
"avoid-dev-deps" => self.avoid_dev_deps = true,
269271
_ => bail!("unknown `-Z` flag specified: {}", k),
270272
}
271273

src/cargo/core/workspace.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ pub struct Workspace<'cfg> {
6464

6565
// True if this workspace should enforce optional dependencies even when
6666
// not needed; false if this workspace should only enforce dependencies
67-
// needed by the current configuration (such as in cargo install).
67+
// needed by the current configuration (such as in cargo install). In some
68+
// cases `false` also results in the non-enforcement of dev-dependencies.
6869
require_optional_deps: bool,
6970
}
7071

0 commit comments

Comments
 (0)