Merge pull request #187975 from marius851000/rustRequiredFeatures
buildRustCrate: Do not compile binaries if all the requiredFeatures aren't enabled.
This commit is contained in:
commit
6a0d3815a3
|
@ -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 a new issue