rustPlatform: add support for features
This commit is contained in:
parent
b6a580b9b3
commit
5a08a28803
@ -36,6 +36,10 @@
|
||||
, cargoLock ? null
|
||||
, cargoVendorDir ? null
|
||||
, checkType ? buildType
|
||||
, buildNoDefaultFeatures ? false
|
||||
, checkNoDefaultFeatures ? buildNoDefaultFeatures
|
||||
, buildFeatures ? [ ]
|
||||
, checkFeatures ? buildFeatures
|
||||
, depsExtraArgs ? {}
|
||||
|
||||
# Toggles whether a custom sysroot is created when the target is a .json file.
|
||||
@ -103,6 +107,14 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoLock" ]) // lib.o
|
||||
|
||||
cargoCheckType = checkType;
|
||||
|
||||
cargoBuildNoDefaultFeatures = buildNoDefaultFeatures;
|
||||
|
||||
cargoCheckNoDefaultFeatures = checkNoDefaultFeatures;
|
||||
|
||||
cargoBuildFeatures = buildFeatures;
|
||||
|
||||
cargoCheckFeatures = checkFeatures;
|
||||
|
||||
patchRegistryDeps = ./patch-registry-deps;
|
||||
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
|
@ -13,6 +13,14 @@ cargoBuildHook() {
|
||||
cargoBuildProfileFlag="--${cargoBuildType}"
|
||||
fi
|
||||
|
||||
if [ -n "${cargoBuildNoDefaultFeatures-}" ]; then
|
||||
cargoBuildNoDefaultFeaturesFlag=--no-default-features
|
||||
fi
|
||||
|
||||
if [ -n "${cargoBuildFeatures-}" ]; then
|
||||
cargoBuildFeaturesFlag="--features=${cargoBuildFeatures// /,}"
|
||||
fi
|
||||
|
||||
(
|
||||
set -x
|
||||
env \
|
||||
@ -24,6 +32,8 @@ cargoBuildHook() {
|
||||
--target @rustTargetPlatformSpec@ \
|
||||
--frozen \
|
||||
${cargoBuildProfileFlag} \
|
||||
${cargoBuildNoDefaultFeaturesFlag} \
|
||||
${cargoBuildFeaturesFlag} \
|
||||
${cargoBuildFlags}
|
||||
)
|
||||
|
||||
|
@ -20,7 +20,16 @@ cargoCheckHook() {
|
||||
cargoCheckProfileFlag="--${cargoCheckType}"
|
||||
fi
|
||||
|
||||
argstr="${cargoCheckProfileFlag} --target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}";
|
||||
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
|
||||
cargoCheckNoDefaultFeaturesFlag=--no-default-features
|
||||
fi
|
||||
|
||||
if [ -n "${cargoCheckFeatures-}" ]; then
|
||||
cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}"
|
||||
fi
|
||||
|
||||
argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag}
|
||||
--target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}"
|
||||
|
||||
(
|
||||
set -x
|
||||
|
Loading…
Reference in New Issue
Block a user