toposort discovered projects to improve selection of main project

This commit is contained in:
DavHau 2022-03-14 10:15:19 +07:00
parent cd223d4669
commit 0ef1821bdc
2 changed files with 11 additions and 10 deletions

View File

@ -507,13 +507,6 @@
self))
discoveredProjects;
# attrset of projects by key
projects =
l.listToAttrs
(l.map
(proj: l.nameValuePair proj.key proj)
projectsList);
# unresolved impure projects cannot be resolved on the fly
projectsImpureUnresolved =
l.filter (project: project.impure && ! project.resolved) projectsList;

View File

@ -23,15 +23,23 @@
(discoverer: discoverer.discover {inherit tree;})
allDiscoverers);
rootProjectName = l.head discoveredProjects;
discoveredProjectsSorted = let
toposorted =
l.toposort
(p1: p2: l.hasPrefix p1.relPath p2.relPath)
discoveredProjects;
in
toposorted.result;
rootProject = l.head discoveredProjectsSorted;
projectsExtended =
l.forEach discoveredProjects
l.forEach discoveredProjectsSorted
(proj:
proj
// {
translator = l.head proj.translators;
dreamLockPath = getDreamLockPath proj rootProjectName;
dreamLockPath = getDreamLockPath proj rootProject;
});
in
applyProjectSettings projectsExtended settings;