From 329459353380564ead4b2dd468160d9bf800eed6 Mon Sep 17 00:00:00 2001 From: Joshua Villasenor Date: Fri, 10 Mar 2023 09:10:52 -0800 Subject: [PATCH] Allow simulated apps to have separate templates. (#25378) --- .../linux/apps/app1/templates/templates.json | 72 +++++++++++++++++++ .../linux/apps/app2/templates/templates.json | 72 +++++++++++++++++++ examples/placeholder/templates/templates.json | 72 ------------------- scripts/tools/zap_regen_all.py | 3 +- 4 files changed, 146 insertions(+), 73 deletions(-) create mode 100644 examples/placeholder/linux/apps/app1/templates/templates.json create mode 100644 examples/placeholder/linux/apps/app2/templates/templates.json delete mode 100644 examples/placeholder/templates/templates.json diff --git a/examples/placeholder/linux/apps/app1/templates/templates.json b/examples/placeholder/linux/apps/app1/templates/templates.json new file mode 100644 index 00000000000000..07ab95ea1c7d99 --- /dev/null +++ b/examples/placeholder/linux/apps/app1/templates/templates.json @@ -0,0 +1,72 @@ +{ + "name": "Placeholder templates", + "version": "chip-v1", + "helpers": [ + "partials/helper.js", + "common/StringHelper.js", + "templates/app/helper.js", + "templates/chip/helper.js", + "common/ClusterTestGeneration.js", + "chip-tool/templates/helper.js", + "chip-tool/templates/tests/helper.js" + ], + "resources": { + "pics-metafile": "../../../../../../src/app/tests/suites/certification/PICS.yaml", + "certification-metadir": "../../../../../../src/app/tests/suites/certification", + "test-metadir": "../../../../../../src/app/tests/suites" + }, + "override": "../../../../../../src/app/zap-templates/common/override.js", + "partials": [ + { + "name": "header", + "path": "../../../../../../src/app/zap-templates/partials/header.zapt" + }, + { + "name": "test_cluster", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/test_cluster.zapt" + }, + { + "name": "test_step", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/test_step.zapt" + }, + { + "name": "test_step_response", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/test_step_response.zapt" + }, + { + "name": "maybeCheckExpectedValue", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/checks/maybeCheckExpectedValue.zapt" + }, + { + "name": "maybeCheckExpectedConstraints", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/checks/maybeCheckExpectedConstraints.zapt" + }, + { + "name": "maybeSaveAs", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/saveAs/maybeSaveAs.zapt" + }, + { + "name": "setupSaveAs", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/saveAs/setupSaveAs.zapt" + }, + { + "name": "teardownSaveAs", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/saveAs/teardownSaveAs.zapt" + }, + { + "name": "commandValue", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/command_value.zapt" + }, + { + "name": "valueEquals", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/value_equals.zapt" + } + ], + "templates": [ + { + "path": "../../../../templates/tests-commands.zapt", + "name": "Tests Commands header", + "output": "test/Commands.h" + } + ] +} diff --git a/examples/placeholder/linux/apps/app2/templates/templates.json b/examples/placeholder/linux/apps/app2/templates/templates.json new file mode 100644 index 00000000000000..07ab95ea1c7d99 --- /dev/null +++ b/examples/placeholder/linux/apps/app2/templates/templates.json @@ -0,0 +1,72 @@ +{ + "name": "Placeholder templates", + "version": "chip-v1", + "helpers": [ + "partials/helper.js", + "common/StringHelper.js", + "templates/app/helper.js", + "templates/chip/helper.js", + "common/ClusterTestGeneration.js", + "chip-tool/templates/helper.js", + "chip-tool/templates/tests/helper.js" + ], + "resources": { + "pics-metafile": "../../../../../../src/app/tests/suites/certification/PICS.yaml", + "certification-metadir": "../../../../../../src/app/tests/suites/certification", + "test-metadir": "../../../../../../src/app/tests/suites" + }, + "override": "../../../../../../src/app/zap-templates/common/override.js", + "partials": [ + { + "name": "header", + "path": "../../../../../../src/app/zap-templates/partials/header.zapt" + }, + { + "name": "test_cluster", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/test_cluster.zapt" + }, + { + "name": "test_step", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/test_step.zapt" + }, + { + "name": "test_step_response", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/test_step_response.zapt" + }, + { + "name": "maybeCheckExpectedValue", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/checks/maybeCheckExpectedValue.zapt" + }, + { + "name": "maybeCheckExpectedConstraints", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/checks/maybeCheckExpectedConstraints.zapt" + }, + { + "name": "maybeSaveAs", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/saveAs/maybeSaveAs.zapt" + }, + { + "name": "setupSaveAs", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/saveAs/setupSaveAs.zapt" + }, + { + "name": "teardownSaveAs", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/saveAs/teardownSaveAs.zapt" + }, + { + "name": "commandValue", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/command_value.zapt" + }, + { + "name": "valueEquals", + "path": "../../../../../../examples/chip-tool/templates/tests/partials/value_equals.zapt" + } + ], + "templates": [ + { + "path": "../../../../templates/tests-commands.zapt", + "name": "Tests Commands header", + "output": "test/Commands.h" + } + ] +} diff --git a/examples/placeholder/templates/templates.json b/examples/placeholder/templates/templates.json deleted file mode 100644 index 5b4ee12daebc49..00000000000000 --- a/examples/placeholder/templates/templates.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "Placeholder templates", - "version": "chip-v1", - "helpers": [ - "partials/helper.js", - "common/StringHelper.js", - "templates/app/helper.js", - "templates/chip/helper.js", - "common/ClusterTestGeneration.js", - "chip-tool/templates/helper.js", - "chip-tool/templates/tests/helper.js" - ], - "resources": { - "pics-metafile": "../../../src/app/tests/suites/certification/PICS.yaml", - "certification-metadir": "../../../src/app/tests/suites/certification", - "test-metadir": "../../../src/app/tests/suites" - }, - "override": "../../../src/app/zap-templates/common/override.js", - "partials": [ - { - "name": "header", - "path": "../../../src/app/zap-templates/partials/header.zapt" - }, - { - "name": "test_cluster", - "path": "../../../examples/chip-tool/templates/tests/partials/test_cluster.zapt" - }, - { - "name": "test_step", - "path": "../../../examples/chip-tool/templates/tests/partials/test_step.zapt" - }, - { - "name": "test_step_response", - "path": "../../../examples/chip-tool/templates/tests/partials/test_step_response.zapt" - }, - { - "name": "maybeCheckExpectedValue", - "path": "../../../examples/chip-tool/templates/tests/partials/checks/maybeCheckExpectedValue.zapt" - }, - { - "name": "maybeCheckExpectedConstraints", - "path": "../../../examples/chip-tool/templates/tests/partials/checks/maybeCheckExpectedConstraints.zapt" - }, - { - "name": "maybeSaveAs", - "path": "../../../examples/chip-tool/templates/tests/partials/saveAs/maybeSaveAs.zapt" - }, - { - "name": "setupSaveAs", - "path": "../../../examples/chip-tool/templates/tests/partials/saveAs/setupSaveAs.zapt" - }, - { - "name": "teardownSaveAs", - "path": "../../../examples/chip-tool/templates/tests/partials/saveAs/teardownSaveAs.zapt" - }, - { - "name": "commandValue", - "path": "../../../examples/chip-tool/templates/tests/partials/command_value.zapt" - }, - { - "name": "valueEquals", - "path": "../../../examples/chip-tool/templates/tests/partials/value_equals.zapt" - } - ], - "templates": [ - { - "path": "tests-commands.zapt", - "name": "Tests Commands header", - "output": "test/Commands.h" - } - ] -} diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index ee09ca86a76a09..0da0969086f4a6 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -257,7 +257,8 @@ def getGlobalTemplatesTargets(): # a name like output_dir = os.path.join( 'zzz_generated', 'placeholder', example_name, 'zap-generated') - template = 'examples/placeholder/templates/templates.json' + template = os.path.join( + 'examples', 'placeholder', 'linux', 'apps', example_name, 'templates', 'templates.json') targets.append(ZAPGenerateTarget.MatterIdlTarget(filepath)) targets.append(ZAPGenerateTarget(filepath, output_dir=output_dir, template=template))