buildDartApplication: Refactor autoDepsList logic

This commit is contained in:
hacker1024 2023-10-26 14:35:13 +11:00 committed by FlafyDev
parent 7c7cb95085
commit 4f623fa0a1

View File

@ -53,9 +53,15 @@
let
generators = callPackage ./generators.nix { inherit dart; } { inherit sdkSetupScript; buildDrvArgs = args; };
depsList = if depsListFile == null then null else lib.importJSON depsListFile;
generatedDepsList = generators.mkDepsList { inherit pubspecLockFile pubspecLockData packageConfig; };
depsList =
if autoDepsList
then lib.importJSON generatedDepsList
else if depsListFile == null
then null
else lib.importJSON depsListFile;
pubspecLockFile = builtins.toJSON pubspecLock;
pubspecLockData = pub2nix.readPubspecLock { inherit src packageRoot pubspecLock gitHashes sdkSourceBuilders; };
packageConfig = pub2nix.generatePackageConfig {
@ -133,10 +139,7 @@ let
});
packageOverrideRepository = (callPackage ../../../development/compilers/dart/package-overrides { }) // customPackageOverrides;
productPackages = builtins.filter (package: package.kind != "dev")
(if autoDepsList
then lib.importJSON generatedDepsList
else if depsList == null then [ ] else depsList);
productPackages = builtins.filter (package: package.kind != "dev") (if depsList == null then [ ] else depsList);
in
assert !(builtins.isString dartOutputType && dartOutputType != "") ->
throw "dartOutputType must be a non-empty string";