formats/v1: set stage sources after loading
Instead of carrying around the `sources_options` parameter through the recursive `load` and `load_build` calls, set the sources options after loading has completed by iterating through all stages of all pipelines.
This commit is contained in:
parent
698635171c
commit
da16fe30bf
1 changed files with 10 additions and 6 deletions
|
|
@ -43,20 +43,20 @@ def describe(manifest: Manifest, *, with_id=False) -> Dict:
|
||||||
return description
|
return description
|
||||||
|
|
||||||
|
|
||||||
def load_build(description: Dict, sources_options: Dict, result: List[Pipeline]):
|
def load_build(description: Dict, result: List[Pipeline]):
|
||||||
pipeline = description.get("pipeline")
|
pipeline = description.get("pipeline")
|
||||||
if pipeline:
|
if pipeline:
|
||||||
build_pipeline = load_pipeline(pipeline, sources_options, result)
|
build_pipeline = load_pipeline(pipeline, result)
|
||||||
else:
|
else:
|
||||||
build_pipeline = None
|
build_pipeline = None
|
||||||
|
|
||||||
return build_pipeline, description["runner"]
|
return build_pipeline, description["runner"]
|
||||||
|
|
||||||
|
|
||||||
def load_pipeline(description: Dict, sources_options: Dict, result: List[Pipeline]) -> Pipeline:
|
def load_pipeline(description: Dict, result: List[Pipeline]) -> Pipeline:
|
||||||
build = description.get("build")
|
build = description.get("build")
|
||||||
if build:
|
if build:
|
||||||
build_pipeline, runner = load_build(build, sources_options, result)
|
build_pipeline, runner = load_build(build, result)
|
||||||
else:
|
else:
|
||||||
build_pipeline, runner = None, detect_host_runner()
|
build_pipeline, runner = None, detect_host_runner()
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ def load_pipeline(description: Dict, sources_options: Dict, result: List[Pipelin
|
||||||
pipeline = Pipeline(runner, build_pipeline and build_pipeline.tree_id)
|
pipeline = Pipeline(runner, build_pipeline and build_pipeline.tree_id)
|
||||||
|
|
||||||
for s in description.get("stages", []):
|
for s in description.get("stages", []):
|
||||||
pipeline.add_stage(s["name"], s.get("options", {}), sources_options)
|
pipeline.add_stage(s["name"], s.get("options", {}))
|
||||||
|
|
||||||
a = description.get("assembler")
|
a = description.get("assembler")
|
||||||
if a:
|
if a:
|
||||||
|
|
@ -83,7 +83,11 @@ def load(description: Dict) -> Manifest:
|
||||||
|
|
||||||
pipelines = []
|
pipelines = []
|
||||||
|
|
||||||
load_pipeline(pipeline, sources, pipelines)
|
load_pipeline(pipeline, pipelines)
|
||||||
|
|
||||||
|
for pipeline in pipelines:
|
||||||
|
for stage in pipeline.stages:
|
||||||
|
stage.sources = sources
|
||||||
|
|
||||||
manifest = Manifest(pipelines, sources)
|
manifest = Manifest(pipelines, sources)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue