Skip to content

Commit

Permalink
zap-generate command
Browse files Browse the repository at this point in the history
  • Loading branch information
markaj-nordic committed Apr 9, 2024
1 parent 66d24b1 commit b9a696e
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions scripts/setup/nrfconnect/zap_generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
import os
from textwrap import dedent

from west import log
from west.commands import WestCommand

class ZapGenerate(NcsWestCommand):
pass
class ZapGenerate(WestCommand):

def __init__(self):
super().__init__(
'zap-generate', # gets stored as self.name
'Generate Matter data model files with ZAP', # self.help
# self.description:
dedent('''
Generate Matter data model files with the use of ZAP Tool
based on the .zap template file defined for your application.'''))
self.matter_path = os.environ.get("ZEPHYR_BASE") + "/../modules/lib/matter/"

def do_add_parser(self, parser_adder):
parser = parser_adder.add_parser(self.name,
help=self.help,
description=self.description)

parser.add_argument('-z', '--zap-file', help='Path to the .zap file [optional]')
parser.add_argument('-o', '--output', help='Path where to store the generated files [optional]')

return parser

def do_run(self, args, unknown_args):
# self.check_output(["python3", os.environ.get("ZEPHYR_BASE") + "/../modules/lib/matter/scripts/setup/nrfconnect/get_zap.py", "-l", "/opt/zap"])
self.check_output([self.matter_path + "scripts/tools/zap/generate.py",
"{}".format(args.zap_file),
"-t", self.matter_path + "src/app/zap-templates/app-templates.json",
"-o", "{}".format(args.output)])

log.inf("Done. Files generated in {}".format(args.output))

0 comments on commit b9a696e

Please sign in to comment.