summaryrefslogtreecommitdiff
path: root/zephyr/zmake/zmake/project.py
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2021-03-30 14:34:16 -0600
committerCommit Bot <commit-bot@chromium.org>2021-03-31 18:58:26 +0000
commit9b918d35a2a5573405250e1dfeef084f40ef0c99 (patch)
treec2e1eec258d694f63570b6c2505c22a65d559e9b /zephyr/zmake/zmake/project.py
parent68da2a47999aa5f2a6398bbadebc0b859bce63f3 (diff)
downloadchrome-ec-9b918d35a2a5573405250e1dfeef084f40ef0c99.tar.gz
zephyr: Add find_projects() to zmake.project.
A new generator function which searches subdirectories for zmake projects. BUG=b:183007888 TEST=zmake testall BRANCH=none Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Iceca946a12e0e64a46c5994366734addb3e24cb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2795931 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/zmake/zmake/project.py')
-rw-r--r--zephyr/zmake/zmake/project.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/zephyr/zmake/zmake/project.py b/zephyr/zmake/zmake/project.py
index a7e2fec20e..f7e085cb1e 100644
--- a/zephyr/zmake/zmake/project.py
+++ b/zephyr/zmake/zmake/project.py
@@ -3,7 +3,10 @@
# found in the LICENSE file.
"""Module for project config wrapper object."""
+import logging
+import pathlib
import warnings
+
import yaml
# The version of jsonschema in the chroot has a bunch of
@@ -33,6 +36,20 @@ def module_dts_overlay_name(modpath, board_name):
board_name)
+def find_projects(root_dir):
+ """Finds all zmake projects in root_dir.
+
+ Args:
+ root_dir: the root dir as a pathlib.Path object
+
+ Yields:
+ Project: The next project found.
+ """
+ logging.info('Finding zmake targets under \'%s\'.', root_dir)
+ for path in pathlib.Path(root_dir).rglob('zmake.yaml'):
+ yield Project(path.parent)
+
+
class ProjectConfig:
"""An object wrapping zmake.yaml."""
validator = jsonschema.Draft7Validator