Skip to content

Commit

Permalink
Run with --all-features first
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Apr 2, 2024
1 parent 9276049 commit 64895b7
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 111 deletions.
22 changes: 12 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,18 @@ fn exec_on_package(
Kind::Each { .. } | Kind::Powerset { .. } => {}
}

// Run with --all-features first: https://github.com/taiki-e/cargo-hack/issues/246
let pkg_features = cx.pkg_features(id);
if !cx.exclude_all_features
&& pkg_features.normal().len() + pkg_features.optional_deps().len() > 1
{
let mut line = line.clone();
// run with all features
// https://github.com/taiki-e/cargo-hack/issues/42
line.arg("--all-features");
exec_cargo(cx, id, &mut line, progress, keep_going)?;
}

if !cx.no_default_features {
line.arg("--no-default-features");
}
Expand Down Expand Up @@ -505,16 +517,6 @@ fn exec_on_package(
Kind::Normal => unreachable!(),
}

let pkg_features = cx.pkg_features(id);
if !cx.exclude_all_features
&& pkg_features.normal().len() + pkg_features.optional_deps().len() > 1
{
// run with all features
// https://github.com/taiki-e/cargo-hack/issues/42
line.arg("--all-features");
exec_cargo(cx, id, &mut line, progress, keep_going)?;
}

Ok(())
}

Expand Down
Loading

0 comments on commit 64895b7

Please sign in to comment.