mirror of
https://codeberg.org/icewind/mill-scale.git
synced 2026-06-03 18:04:09 +02:00
don't add 'all-features' checks if the only features are default
This commit is contained in:
parent
d71328fa95
commit
c71caa3c2b
1 changed files with 7 additions and 3 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
{ lib, src, config, flakelight, inputs, ... }:
|
{ lib, src, config, flakelight, inputs, ... }:
|
||||||
let
|
let
|
||||||
inherit (builtins) elem readFile pathExists isAttrs attrNames match any;
|
inherit (builtins) elem readFile pathExists isAttrs attrNames match any;
|
||||||
inherit (lib) map mkDefault mkIf mkMerge mkOption warnIf assertMsg optionalAttrs types optionalString genAttrs hasInfix intersectLists foldl attrVals;
|
inherit (lib) map mkDefault mkIf mkMerge mkOption warnIf assertMsg optionalAttrs types optionalString genAttrs hasInfix intersectLists foldl attrVals remove;
|
||||||
inherit (lib.fileset) fileFilter toSource unions;
|
inherit (lib.fileset) fileFilter toSource unions;
|
||||||
inherit (flakelight.types) fileset function optFunctionTo;
|
inherit (flakelight.types) fileset function optFunctionTo;
|
||||||
|
|
||||||
|
|
@ -15,6 +15,10 @@ let
|
||||||
hasMsrv = tomlPackage ? rust-version;
|
hasMsrv = tomlPackage ? rust-version;
|
||||||
hasWorkspace = tomlPackage ? workspace;
|
hasWorkspace = tomlPackage ? workspace;
|
||||||
hasFeatures = cargoToml ? features && isAttrs cargoToml.features;
|
hasFeatures = cargoToml ? features && isAttrs cargoToml.features;
|
||||||
|
features = cargoToml.features or {};
|
||||||
|
defaultFeatures = features.default or [];
|
||||||
|
nonDefaultFeatures = remove "default" (attrNames features);
|
||||||
|
hasNonDefaultFeatures = hasFeatures && (defaultFeatures != nonDefaultFeatures);
|
||||||
hasDefaultFeatures = cargoToml ? features && cargoToml.features ? default;
|
hasDefaultFeatures = cargoToml ? features && cargoToml.features ? default;
|
||||||
msrv = assert assertMsg hasMsrv ''"rust-version" not set in Cargo.toml''; tomlPackage.rust-version;
|
msrv = assert assertMsg hasMsrv ''"rust-version" not set in Cargo.toml''; tomlPackage.rust-version;
|
||||||
maybeWorkspace = optionalString hasWorkspace "--workspace";
|
maybeWorkspace = optionalString hasWorkspace "--workspace";
|
||||||
|
|
@ -255,7 +259,7 @@ warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
|
||||||
cargoExtraArgs = "--release --locked --all-targets --all-features ${maybeWorkspace}";
|
cargoExtraArgs = "--release --locked --all-targets --all-features ${maybeWorkspace}";
|
||||||
installPhaseCommand = "mkdir $out";
|
installPhaseCommand = "mkdir $out";
|
||||||
} // packageOpts);
|
} // packageOpts);
|
||||||
}) // (optionalAttrs hasFeatures {
|
}) // (optionalAttrs hasNonDefaultFeatures {
|
||||||
test-all-features = craneLib.cargoTest (allFeaturesCraneArgs // {
|
test-all-features = craneLib.cargoTest (allFeaturesCraneArgs // {
|
||||||
cargoArtifacts = cargoArtifactsAllFeatures;
|
cargoArtifacts = cargoArtifactsAllFeatures;
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
@ -276,7 +280,7 @@ warnIf (! builtins ? readFileType) "Unsupported Nix version in use."
|
||||||
}) // (optionalAttrs hasExamples {
|
}) // (optionalAttrs hasExamples {
|
||||||
examples = craneLibMsrv.buildPackage (commonCraneArgs // {
|
examples = craneLibMsrv.buildPackage (commonCraneArgs // {
|
||||||
pname = "${crateName}-examples";
|
pname = "${crateName}-examples";
|
||||||
cargoExtraArgs = "--examples ${optionalString hasFeatures "--all-features"} ${maybeWorkspace}";
|
cargoExtraArgs = "--examples ${optionalString hasNonDefaultFeatures "--all-features"} ${maybeWorkspace}";
|
||||||
} // packageOpts);
|
} // packageOpts);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue