forked from nrfconnect/sdk-connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66d24b1
commit b9a696e
Showing
1 changed file
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |