Skip to content

Commit

Permalink
fix(rust): remove all-targets in doctest
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
  • Loading branch information
rvolosatovs committed Oct 21, 2024
1 parent ddfd1d8 commit 96327b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/rust-complex/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

build.workspace = true;
clippy.workspace = true;
test.doc = true;
test.allTargets = true;
test.workspace = true;

buildOverrides = {
Expand Down
15 changes: 11 additions & 4 deletions lib/rust/mkAttrs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ with self.lib.rust.targets;
overrideArgs,
}: f: let
buildArgs = "-j $NIX_BUILD_CORES ${mkCargoFlags build}";
checkArgs = "-j $NIX_BUILD_CORES ${mkCargoFlags build}";
docArgs = "-j $NIX_BUILD_CORES ${mkCargoFlags doc}";
testArgs = "-j $NIX_BUILD_CORES ${mkCargoFlags test}";

Expand All @@ -84,7 +83,7 @@ with self.lib.rust.targets;
version = version';

cargoBuildCommand = "cargoWithProfile build ${buildArgs}";
cargoCheckExtraArgs = checkArgs;
cargoCheckExtraArgs = buildArgs;
cargoClippyExtraArgs = clippyArgs;
cargoDocExtraArgs = docArgs;
cargoNextestExtraArgs = testArgs;
Expand Down Expand Up @@ -226,8 +225,16 @@ with self.lib.rust.targets;
fmt = callHostCrane {} hostCraneLib.cargoFmt;
nextest = callHostCraneCheckWithDeps {} hostCraneLib.cargoNextest;
}
// (optionalAttrs (test ? doc && test.doc)) {
doctest = callHostCraneCheckWithDeps {} hostCraneLib.cargoDocTest;
// (optionalAttrs (test ? doc && test.doc || test ? allTargets && test.allTargets))
{
doctest =
callHostCraneCheckWithDeps {
cargoTestExtraArgs = "-j $NIX_BUILD_CORES ${mkCargoFlags (test
// {
allTargets = false;
})}";
}
hostCraneLib.cargoDocTest;
}
// (optionalAttrs (pathExists "${src}/Cargo.lock") {
# TODO: Use `cargoLock` if `Cargo.lock` missing
Expand Down

0 comments on commit 96327b8

Please sign in to comment.