fix fallback on existing dream-lock.json

This commit is contained in:
DavHau 2022-03-05 23:55:42 +07:00
parent 924bb494e6
commit bc3c3820b0

View File

@ -504,22 +504,24 @@ let
isImpure = project: translatorName: isImpure = project: translatorName:
(getTranslator project.subsystem translatorName).type == "impure"; (getTranslator project.subsystem translatorName).type == "impure";
getInvalidationHash = project:
dlib.calcInvalidationHash {
inherit source;
# TODO: add translatorArgs
translatorArgs = {};
translator = project.translator;
};
isResolved = project: isResolved = project:
let let
dreamLockExists = l.pathExists "${config.projectRoot}/${project.dreamLockPath}"; dreamLockExists =
l.pathExists "${config.projectRoot}/${project.dreamLockPath}";
invalidationHash = dlib.calcInvalidationHash {
inherit source;
# TODO: add translatorArgs
translatorArgs = {};
translator = project.translator;
};
dreamLockValid = dreamLockValid =
project.dreamLock.lock._generic.invalidationHash or "" project.dreamLock.lock._generic.invalidationHash or ""
== invalidationHash; == project.invalidationHash;
in in
dreamLockExists && dreamLockValid; dreamLockExists && dreamLockValid;
getProjectKey = project: getProjectKey = project:
"${project.name}_|_${project.subsystem}_|_${project.relPath}"; "${project.name}_|_${project.subsystem}_|_${project.relPath}";
@ -527,11 +529,14 @@ let
# list of projects extended with some information requried for processing # list of projects extended with some information requried for processing
projectsList = projectsList =
l.map l.map
(project: project // (let self = rec { (project: (let self = project // rec {
dreamLock = dlib.readDreamLock "${config.projectRoot}/${project.dreamLockPath}"; dreamLock = utils.readDreamLock {
dreamLock = "${config.projectRoot}/${project.dreamLockPath}";
};
impure = isImpure project translator; impure = isImpure project translator;
invalidationHash = getInvalidationHash project;
key = getProjectKey project; key = getProjectKey project;
resolved = isResolved project; resolved = isResolved self;
translator = project.translator or (l.head project.translators); translator = project.translator or (l.head project.translators);
}; in self)) }; in self))
discoveredProjects; discoveredProjects;
@ -571,13 +576,18 @@ let
(proj: (proj:
let let
translator = getTranslator proj.subsystem proj.translator; translator = getTranslator proj.subsystem proj.translator;
in dreamLock' = translator.translate {
proj inherit source tree;
// { project = proj;
dreamLock = translator.translate { };
inherit source tree; dreamLock = dreamLock' // {
project = proj; _generic = dreamLock'._generic // {
invalidationHash = proj.invalidationHash;
}; };
};
in
proj // {
inherit dreamLock;
}); });
resolvedProjects = projectsResolved ++ projectsResolvedOnTheFly; resolvedProjects = projectsResolved ++ projectsResolvedOnTheFly;