2022-10-24 02:20:22 +03:00
|
|
|
{ mkCargoDerivation
|
2022-01-17 05:16:21 +03:00
|
|
|
, cargo-tarpaulin
|
2023-10-01 21:22:09 +03:00
|
|
|
, lib
|
2022-01-17 05:16:21 +03:00
|
|
|
}:
|
2023-10-01 21:22:09 +03:00
|
|
|
let
|
|
|
|
xml = if lib.versionOlder cargo-tarpaulin.version "0.27.0" then "Xml" else "xml";
|
|
|
|
in
|
2022-10-24 02:20:22 +03:00
|
|
|
{ cargoExtraArgs ? ""
|
2023-10-01 21:22:09 +03:00
|
|
|
, cargoTarpaulinExtraArgs ? "--skip-clean --out ${xml} --output-dir $out"
|
2022-01-17 05:16:21 +03:00
|
|
|
, ...
|
|
|
|
}@origArgs:
|
|
|
|
let
|
2022-10-09 21:58:21 +03:00
|
|
|
args = builtins.removeAttrs origArgs [
|
|
|
|
"cargoExtraArgs"
|
|
|
|
"cargoTarpaulinExtraArgs"
|
|
|
|
];
|
2022-01-17 05:16:21 +03:00
|
|
|
in
|
2022-10-09 21:58:21 +03:00
|
|
|
mkCargoDerivation (args // {
|
|
|
|
buildPhaseCargoCommand = "cargoWithProfile tarpaulin ${cargoExtraArgs} ${cargoTarpaulinExtraArgs}";
|
2022-01-17 05:16:21 +03:00
|
|
|
|
|
|
|
pnameSuffix = "-tarpaulin";
|
|
|
|
|
2023-06-21 04:13:46 +03:00
|
|
|
# With `--skip-clean` cargo-tarpaulin tries to mutate dependency files in place
|
|
|
|
doNotLinkInheritedArtifacts = args.doNotLinkInheritedArtifacts or true;
|
|
|
|
|
2022-01-17 05:16:21 +03:00
|
|
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-tarpaulin ];
|
|
|
|
})
|