feat: project can loads targets from external deps
This commit is contained in:
parent
0396c8165a
commit
f3dcfd8bf0
|
@ -5,7 +5,7 @@ import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from cutekit.model import ProjectManifest, TargetManifest, ComponentManifest, Props, Type, Tool, Tools
|
from cutekit.model import ProjectManifest, TargetManifest, ComponentManifest, Props, Type, Tool, Tools
|
||||||
from cutekit import const, shell, jexpr, utils, rules, mixins
|
from cutekit import const, shell, jexpr, utils, rules, mixins, project
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -117,9 +117,18 @@ class Context(IContext):
|
||||||
|
|
||||||
|
|
||||||
def loadAllTargets() -> list[TargetManifest]:
|
def loadAllTargets() -> list[TargetManifest]:
|
||||||
files = shell.find(const.TARGETS_DIR, ["*.json"])
|
projectRoot = project.root()
|
||||||
return list(
|
pj = loadProject(projectRoot)
|
||||||
map(lambda path: TargetManifest(jexpr.evalRead(path), path), files))
|
paths = list(
|
||||||
|
map(lambda e: os.path.join(const.EXTERN_DIR, e, const.TARGETS_DIR), pj.extern.keys())
|
||||||
|
) + [const.TARGETS_DIR]
|
||||||
|
|
||||||
|
ret = []
|
||||||
|
for entry in paths:
|
||||||
|
files = shell.find(entry, ["*.json"])
|
||||||
|
ret += list(map(lambda path: TargetManifest(jexpr.evalRead(path), path), files))
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def loadProject(path: str) -> ProjectManifest:
|
def loadProject(path: str) -> ProjectManifest:
|
||||||
|
|
Loading…
Reference in a new issue