feat: ignore discoveredProjects if projects is defined

This commit is contained in:
DavHau 2022-11-13 15:05:35 +01:00
parent 4214176e5a
commit bd958e2566
2 changed files with 28 additions and 9 deletions

View File

@ -609,7 +609,7 @@ in let
generateImpureResolveScript = {
source,
impureDiscoveredProjects,
impureProjects,
}: let
impureResolveScriptsList =
l.listToAttrs
@ -621,7 +621,7 @@ in let
"Name: ${project.name}; Subsystem: ${project.subsystem or "?"}; relPath: ${project.relPath}"
(utils.makeTranslateScript {inherit project source;})
)
impureDiscoveredProjects
impureProjects
);
resolveImpureScript =
@ -653,20 +653,40 @@ in let
sourceOverrides ? old: {},
inject ? {},
}: let
impureDiscoveredProjects =
# if projects are defined manually, ignore discoveredProjects
finalProjects =
if projects != {}
then let
projectsList = l.attrValues projects;
in
# skip discovery and just add required attributes to project list
l.forEach projectsList
(proj:
proj
// {
relPath = proj.relPath or "";
translator = proj.translator or (l.head proj.translators);
dreamLockPath =
framework.functions.discoverers.getDreamLockPath
proj
(l.head projectsList);
})
else discoveredProjects;
impureProjects =
l.filter
(proj:
framework.translators."${proj.translator}".type
== "impure")
discoveredProjects;
finalProjects;
resolveImpureScript = generateImpureResolveScript {
inherit impureDiscoveredProjects source;
inherit impureProjects source;
};
translatedProjects = translateProjects {
discoveredProjects = finalProjects;
inherit
discoveredProjects
pname
settings
source
@ -702,7 +722,7 @@ in let
or by resolving all impure projects by running the `resolveImpure` package
'';
})
impureDiscoveredProjects);
impureProjects);
in
realizedProjects
// {

View File

@ -3,7 +3,6 @@
dlib = config.dlib;
discoverProjects = {
projects,
source ? throw "Pass either `source` or `tree` to discoverProjects",
tree ? dlib.prepareSourceTree {inherit source;},
settings ? [],
@ -24,7 +23,7 @@
in
sorted;
allProjects = discoveredProjectsSorted ++ (l.attrValues projects);
allProjects = discoveredProjectsSorted;
rootProject = l.head allProjects;