mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-23 16:32:23 +03:00
475de74fa2
* feat: add cargoLlvmCov * cargoHelperFunctionsHook: prefer `--release` over `--profile release` Some tools (e.g. cargo-llvm-cov) don't understand `--profile release` as an alias for `--release`, so `cargoWithProfile` should prefer passing `--release` when `$CARGO_PROFILE` == "release" --------- Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
32 lines
635 B
Nix
32 lines
635 B
Nix
{ mkCargoDerivation
|
|
, cargo-llvm-cov
|
|
}:
|
|
|
|
{ cargoExtraArgs ? ""
|
|
, cargoLlvmCovCommand ? "test"
|
|
, cargoLlvmCovExtraArgs ? "--lcov --output-path $out"
|
|
, ...
|
|
}@origArgs:
|
|
|
|
let
|
|
args = builtins.removeAttrs origArgs [
|
|
"cargoExtraArgs"
|
|
"cargoLlvmCovCommand"
|
|
"cargoLlvmCovExtraArgs"
|
|
];
|
|
in
|
|
|
|
mkCargoDerivation (args // {
|
|
pnameSuffix = "-llvm-cov";
|
|
|
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-llvm-cov ];
|
|
|
|
doInstallCargoArtifacts = false;
|
|
|
|
buildPhaseCargoCommand = ''
|
|
cargoWithProfile llvm-cov "${cargoLlvmCovCommand}" ${cargoExtraArgs} ${cargoLlvmCovExtraArgs}
|
|
'';
|
|
|
|
installPhaseCommand = "";
|
|
})
|