feat: allow plugins to inject custom props
This commit is contained in:
parent
e620d8e1cf
commit
dcde816298
|
@ -76,8 +76,8 @@ def gen(out: TextIO, context: Context):
|
||||||
writer.newline()
|
writer.newline()
|
||||||
|
|
||||||
|
|
||||||
def build(componentSpec: str, targetSpec: str) -> str:
|
def build(componentSpec: str, targetSpec: str, props: Props = {}) -> str:
|
||||||
context = contextFor(targetSpec)
|
context = contextFor(targetSpec, props)
|
||||||
target = context.target
|
target = context.target
|
||||||
|
|
||||||
shell.mkdir(context.builddir())
|
shell.mkdir(context.builddir())
|
||||||
|
|
|
@ -186,7 +186,7 @@ def instanciate(componentSpec: str, components: list[ComponentManifest], target:
|
||||||
context: dict = {}
|
context: dict = {}
|
||||||
|
|
||||||
|
|
||||||
def contextFor(targetSpec: str) -> Context:
|
def contextFor(targetSpec: str, props: Props = {}) -> Context:
|
||||||
if targetSpec in context:
|
if targetSpec in context:
|
||||||
return context[targetSpec]
|
return context[targetSpec]
|
||||||
|
|
||||||
|
@ -198,6 +198,8 @@ def contextFor(targetSpec: str) -> Context:
|
||||||
targetEls[0] = "host-" + shell.uname().machine
|
targetEls[0] = "host-" + shell.uname().machine
|
||||||
|
|
||||||
target = loadTarget(targetEls[0])
|
target = loadTarget(targetEls[0])
|
||||||
|
target.props |= props
|
||||||
|
|
||||||
components = loadAllComponents()
|
components = loadAllComponents()
|
||||||
components = filterDisabled(components, target)
|
components = filterDisabled(components, target)
|
||||||
|
|
||||||
|
@ -221,7 +223,6 @@ def contextFor(targetSpec: str) -> Context:
|
||||||
for component in components:
|
for component in components:
|
||||||
for toolSpec in component.tools:
|
for toolSpec in component.tools:
|
||||||
tool = component.tools[toolSpec]
|
tool = component.tools[toolSpec]
|
||||||
|
|
||||||
tools[toolSpec].args += tool.args
|
tools[toolSpec].args += tool.args
|
||||||
|
|
||||||
instances = cast(list[ComponentInstance], list(filter(lambda e: e != None, map(lambda c: instanciate(
|
instances = cast(list[ComponentInstance], list(filter(lambda e: e != None, map(lambda c: instanciate(
|
||||||
|
|
Loading…
Reference in a new issue