Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set cargoExtraArgs in craneLib.cargoNextest (#675) #678

Merged
merged 8 commits into from
Aug 6, 2024
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

### Changed
* Removed invalid `cargoExtraArgs` input attribute from `craneLib.cargoNextest`
in favor of `cargoNextestExtraArgs`.

### Fixed
* Fixed vendoring dependencies from an alternative registry which they
themselves have dependencies on crates from _other_ registries.
Expand Down
4 changes: 1 addition & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,15 +615,13 @@ Except where noted below, all derivation attributes are delegated to

#### Optional attributes
* `buildPhaseCargoCommand`, unless specified, will be set to print the nextest version
* `cargoExtraArgs`: additional flags to be passed in the cargo invocation (e.g.
enabling specific features)
- Default value: `""`
* `cargoLlvmCovExtraArgs`: additional flags to be passed in the cargo
llvm-cov invocation
- Default value: `"--lcov --output-path $out/coverage"`
* `cargoNextestExtraArgs`: additional flags to be passed in the nextest invocation
(e.g. specifying a profile)
- Default value: `""`
- Note that all flags from `cargo test` are supported.
* `partitions`: The number of separate nextest partitions to run. Useful if the
test suite takes a long time and can be parallelized across multiple build
nodes.
Expand Down
10 changes: 3 additions & 7 deletions lib/cargoNextest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
}:

{ cargoArtifacts
, cargoExtraArgs ? ""
, cargoLlvmCovExtraArgs ? "--lcov --output-path $out/coverage"
, cargoNextestExtraArgs ? ""
, doInstallCargoArtifacts ? true
Expand All @@ -19,15 +18,14 @@
}@origArgs:
let
args = builtins.removeAttrs origArgs [
"cargoExtraArgs"
"cargoLlvmCovExtraArgs"
"cargoNextestExtraArgs"
"partitions"
"partitionType"
"withLlvmCov"
];

mkUpdatedArgs = { cmd ? lib.optionalString (!withLlvmCov) "run", extraSuffix ? "", moreArgs ? "", withLlvmCov }: args // {
mkUpdatedArgs = { cmd ? "run", extraSuffix ? "", moreArgs ? "", withLlvmCov }: args // {
inherit cargoArtifacts;
pnameSuffix = "-nextest${extraSuffix}";
doCheck = args.doCheck or true;
Expand All @@ -44,10 +42,8 @@ let
'';

checkPhaseCargoCommand = ''
cargo ${cargoExtraArgs} \
${lib.optionalString withLlvmCov "llvm-cov ${cargoLlvmCovExtraArgs}"} \
nextest ${cmd} ''${CARGO_PROFILE:+--cargo-profile $CARGO_PROFILE} \
${cargoNextestExtraArgs} ${moreArgs}
${if withLlvmCov then "cargo llvm-cov nextest ${cargoLlvmCovExtraArgs}" else "cargo nextest ${cmd}"} \
''${CARGO_PROFILE:+--cargo-profile $CARGO_PROFILE} ${cargoNextestExtraArgs} ${moreArgs}
ipetkov marked this conversation as resolved.
Show resolved Hide resolved
'';

nativeBuildInputs = (args.nativeBuildInputs or [ ])
Expand Down
Loading