Skip to content

Commit

Permalink
Build all function
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed May 24, 2022
1 parent ba144ea commit 921557a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,13 @@ def main(argv: Sequence[str]) -> None:
shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h")
chef_util.generate_device_manifest(chef_devices_dir, include_zap_submod=True, write_manifest_file = True, ci_manifest_file_name = ci_manifest_file_name, repo_base_path=_REPO_BASE_PATH)
exit(0)

#
# Build all
#

if options.build_all:
chef_util.build_all(chef_devices_dir, _CHEF_SCRIPT_PATH)
exit(0)

#
Expand Down
17 changes: 16 additions & 1 deletion examples/chef/chef_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import hashlib

ci_allowlist = ['lighting-app.zap']
cd_output_dirs = {
cd_platforms_and_outputs = {
'linux': 'linux/out',
'esp32': 'esp32/build',
'nrfconnect': 'nrfconnect/build',
Expand Down Expand Up @@ -38,3 +38,18 @@ def generate_device_manifest(chef_devices_dir: str, include_zap_submod: bool = F
with open(ci_manifest_file_name, "w+", encoding="utf-8") as ci_manifest_file:
ci_manifest_file.write(json.dumps(ci_manifest, indent=4))
return ci_manifest

def create_build_command(zap: str, platform: str) -> str:
return './chef.py -czbr -d {} -t {}'.format(zap, platform)

def build_all(device_dir: str, chef_script_path: str) -> None:
devices = []
for device in os.listdir(device_dir):
target_file_ext = ".zap"
if device.endswith(target_file_ext):
devices.append(device[:-len(target_file_ext)])
for platform, directory in cd_platforms_and_outputs.items():
cd_platforms_and_outputs[platform] = os.path.join(chef_script_path, directory)
for device in devices:
command = create_build_command(device, platform)
subprocess.check_call(command, cwd=chef_script_path, shell=True)

0 comments on commit 921557a

Please sign in to comment.