Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have nicer command lines for zap_regen_all invoking zap_generate. #33320

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/tools/zap/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

from zap_execution import ZapTool

# TODO: Can we share this constant definition with zap_regen_all.py?
DEFAULT_DATA_MODEL_DESCRIPTION_FILE = 'src/app/zap-templates/zcl/zcl.json'


@dataclass
class CmdLineArgs:
Expand Down Expand Up @@ -88,7 +91,7 @@ def detectZclFile(zapFile):
print(f"Searching for zcl file from {zapFile}")

prefix_chip_root_dir = True
path = 'src/app/zap-templates/zcl/zcl.json'
path = DEFAULT_DATA_MODEL_DESCRIPTION_FILE

if zapFile:
data = json.load(open(zapFile))
Expand Down
13 changes: 11 additions & 2 deletions scripts/tools/zap_regen_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
CHIP_ROOT_DIR = os.path.realpath(
os.path.join(os.path.dirname(__file__), '../..'))

# TODO: Can we share this constant definition with generate.py?
DEFAULT_DATA_MODEL_DESCRIPTION_FILE = 'src/app/zap-templates/zcl/zcl.json'


class TargetType(Flag):
"""Type of targets that can be re-generated"""
Expand Down Expand Up @@ -108,6 +111,12 @@ def build_command(self, script: str) -> List[str]:
"""What command to execute for this zap input. """
if self.zap_file:
return [script, self.zap_file]
if self.properties_json == DEFAULT_DATA_MODEL_DESCRIPTION_FILE:
# Omit the -z bits because that's the default generate.py
# will use anyway, and this leads to nicer-looking command
# lines if people need to run the regen manually and get
# their command line from our --dry-run.
return [script]
return [script, '-z', self.properties_json]


Expand Down Expand Up @@ -382,7 +391,7 @@ def getGlobalTemplatesTargets():

targets.append(ZAPGenerateTarget.MatterIdlTarget(ZapInput.FromZap(filepath)))

targets.append(ZAPGenerateTarget.MatterIdlTarget(ZapInput.FromPropertiesJson('src/app/zap-templates/zcl/zcl.json'),
targets.append(ZAPGenerateTarget.MatterIdlTarget(ZapInput.FromPropertiesJson(DEFAULT_DATA_MODEL_DESCRIPTION_FILE),
client_side=True, matter_file_name="src/controller/data_model/controller-clusters.matter"))

return targets
Expand Down Expand Up @@ -414,7 +423,7 @@ def getGoldenTestImageTargets():


def getSpecificTemplatesTargets():
zap_input = ZapInput.FromPropertiesJson('src/app/zap-templates/zcl/zcl.json')
zap_input = ZapInput.FromPropertiesJson(DEFAULT_DATA_MODEL_DESCRIPTION_FILE)

# Mapping of required template and output directory
templates = {
Expand Down
Loading