mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
buildRustCrate: Do not compile binaries if all the requiredFeatures aren't enabled.
This commit is contained in:
parent
c83b87fecd
commit
3291bda7b6
@ -69,7 +69,15 @@
|
||||
|
||||
|
||||
|
||||
${lib.optionalString (lib.length crateBin > 0) (lib.concatMapStringsSep "\n" (bin: ''
|
||||
${lib.optionalString (lib.length crateBin > 0) (lib.concatMapStringsSep "\n" (bin:
|
||||
let
|
||||
haveRequiredFeature = if bin ? requiredFeatures then
|
||||
# Check that all element in requiredFeatures are also present in crateFeatures
|
||||
lib.intersectLists bin.requiredFeatures crateFeatures == bin.requiredFeatures
|
||||
else
|
||||
true;
|
||||
in
|
||||
if haveRequiredFeature then ''
|
||||
mkdir -p target/bin
|
||||
BIN_NAME='${bin.name or crateName}'
|
||||
${if !bin ? path then ''
|
||||
@ -79,6 +87,8 @@
|
||||
BIN_PATH='${bin.path}'
|
||||
''}
|
||||
${build_bin} "$BIN_NAME" "$BIN_PATH"
|
||||
'' else ''
|
||||
echo Binary ${bin.name or crateName} not compiled due to not having all of the required features -- ${lib.escapeShellArg (builtins.toJSON bin.requiredFeatures)} -- enabled.
|
||||
'') crateBin)}
|
||||
|
||||
${lib.optionalString buildTests ''
|
||||
|
Loading…
Reference in New Issue
Block a user