From 7ccd17d64bea5a52751d93c32f764639ed983d90 Mon Sep 17 00:00:00 2001 From: VAN BOSSUYT Nicolas Date: Tue, 14 Nov 2023 21:54:47 +0100 Subject: [PATCH] Add new "fast" optimization mixin and handle disabled components in builder.py --- cutekit/builder.py | 8 ++++++-- cutekit/mixins.py | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cutekit/builder.py b/cutekit/builder.py index 091f06a..938ae95 100644 --- a/cutekit/builder.py +++ b/cutekit/builder.py @@ -214,6 +214,10 @@ def build( products: list[Product] = [] for c in components: + r = c.resolved[target.id] + if not r.enabled: + raise RuntimeError(f"Component {c.id} is disabled: {r.reason}") + products.append( Product( path=Path(outfile(target, c)), @@ -224,9 +228,9 @@ def build( outs = list(map(lambda p: str(p.path), products)) if all: - shell.exec("ninja", "-v", "-f", ninjaPath) + shell.exec("ninja", "-f", ninjaPath) else: - shell.exec("ninja", "-v", "-f", ninjaPath, *outs) + shell.exec("ninja", "-f", ninjaPath, *outs) return products diff --git a/cutekit/mixins.py b/cutekit/mixins.py index c275525..57a0f29 100644 --- a/cutekit/mixins.py +++ b/cutekit/mixins.py @@ -65,6 +65,7 @@ mixins: dict[str, Mixin] = { "tsan": makeMixinSan("thread"), "ubsan": makeMixinSan("undefined"), "tune": makeMixinTune("native"), + "fast": makeMixinOptimize("fast"), "o3": makeMixinOptimize("3"), "o2": makeMixinOptimize("2"), "o1": makeMixinOptimize("1"), @@ -77,4 +78,6 @@ def append(mixinSpec: str, mixin: Mixin): def byId(id: str) -> Mixin: + if id not in mixins: + raise RuntimeError(f"Unknown mixin {id}") return mixins[id]