module_deps: Add deps to output properties Bug: b/522852278 Change-Id: Iae407ea4217791429860a9a13294622ad83850c2 Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/426593
diff --git a/recipes/module_deps.py b/recipes/module_deps.py index a8be216..1c56733 100644 --- a/recipes/module_deps.py +++ b/recipes/module_deps.py
@@ -52,15 +52,20 @@ env = api.environment.init(checkout, props.environment_options) + deps = set() with env(), api.context(cwd=checkout.root): if props.run_bazel: - handle_bazel(api) + deps.update(handle_bazel(api)) if props.run_gn: - handle_gn(api) + deps.update(handle_gn(api)) if props.run_cmake: - handle_cmake(api) + deps.update(handle_cmake(api)) if props.run_soong: - handle_soong(api) + deps.update(handle_soong(api)) + + sorted_deps = sorted(deps) + pres = api.step.empty('output properties').presentation + pres.properties['deps'] = sorted_deps def handle_bazel(api: recipe_api.RecipeScriptApi) -> list[str]: @@ -170,6 +175,11 @@ 'bazel.found 3 bazel deps', ['pw_analog, pw_assert, targets'], ), + api.post_check( + post_process.PropertyEquals, + 'deps', + ['pw_analog', 'pw_assert', 'targets'], + ), api.post_process(post_process.DropExpectation), ) @@ -196,6 +206,11 @@ 'gn.found 3 gn deps', ['pw_assert, pw_non_existent, pw_string'], ), + api.post_check( + post_process.PropertyEquals, + 'deps', + ['pw_assert', 'pw_non_existent', 'pw_string'], + ), api.post_process(post_process.DropExpectation), ) @@ -206,6 +221,7 @@ api.post_check(post_process.DoesNotRun, 'gn'), api.post_check(post_process.DoesNotRun, 'cmake'), api.post_check(post_process.DoesNotRun, 'soong'), + api.post_check(post_process.PropertyEquals, 'deps', []), api.post_process(post_process.DropExpectation), ) @@ -229,5 +245,8 @@ api.post_check(post_process.MustRun, 'gn'), api.post_check(post_process.MustRun, 'cmake'), api.post_check(post_process.MustRun, 'soong'), + api.post_check( + post_process.PropertyEquals, 'deps', ['pw_analog', 'pw_string'] + ), api.post_process(post_process.DropExpectation), )