From e2d404d3422b07c969ab23c3aeb594cc87d83b01 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 14 Jan 2022 17:27:08 -0500 Subject: [PATCH] Re-generate zap (which moves Clusters.matter to stay with zap files) --- .../all-clusters-app.matter | 0 .../bridge-common/bridge-app.matter | 0 .../door-lock-common/door-lock-app.matter | 0 .../lighting-common/lighting-app.matter | 0 .../lock-app/lock-common/lock-app.matter | 0 .../log-source-common/log-source-app.matter | 0 .../ota-provider-app.matter | 0 .../ota-requestor-app.matter | 0 .../placeholder/linux/apps/app1/config.matter | 0 .../placeholder/linux/apps/app2/config.matter | 0 .../pump-app/pump-common/pump-app.matter | 0 .../pump-controller-app.matter | 0 .../esp32/main/temperature-measurement.matter | 0 .../thermostat-common/thermostat.matter | 0 .../tv-app/tv-common/tv-app.matter | 0 .../tv-casting-common/tv-casting-app.matter | 0 .../window-app/common/window-app.matter | 0 scripts/tools/zap_regen_all.py | 23 +++++++++++++------ .../data_model/controller-clusters.matter | 0 19 files changed, 16 insertions(+), 7 deletions(-) rename zzz_generated/all-clusters-app/zap-generated/Clusters.matter => examples/all-clusters-app/all-clusters-common/all-clusters-app.matter (100%) rename zzz_generated/bridge-app/zap-generated/Clusters.matter => examples/bridge-app/bridge-common/bridge-app.matter (100%) rename zzz_generated/door-lock-app/zap-generated/Clusters.matter => examples/door-lock-app/door-lock-common/door-lock-app.matter (100%) rename zzz_generated/lighting-app/zap-generated/Clusters.matter => examples/lighting-app/lighting-common/lighting-app.matter (100%) rename zzz_generated/lock-app/zap-generated/Clusters.matter => examples/lock-app/lock-common/lock-app.matter (100%) rename zzz_generated/log-source-app/zap-generated/Clusters.matter => examples/log-source-app/log-source-common/log-source-app.matter (100%) rename zzz_generated/ota-provider-app/zap-generated/Clusters.matter => examples/ota-provider-app/ota-provider-common/ota-provider-app.matter (100%) rename zzz_generated/ota-requestor-app/zap-generated/Clusters.matter => examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter (100%) rename zzz_generated/placeholder/app1/zap-generated/Clusters.matter => examples/placeholder/linux/apps/app1/config.matter (100%) rename zzz_generated/placeholder/app2/zap-generated/Clusters.matter => examples/placeholder/linux/apps/app2/config.matter (100%) rename zzz_generated/pump-app/zap-generated/Clusters.matter => examples/pump-app/pump-common/pump-app.matter (100%) rename zzz_generated/pump-controller-app/zap-generated/Clusters.matter => examples/pump-controller-app/pump-controller-common/pump-controller-app.matter (100%) rename zzz_generated/temperature-measurement-app/zap-generated/Clusters.matter => examples/temperature-measurement-app/esp32/main/temperature-measurement.matter (100%) rename zzz_generated/thermostat/zap-generated/Clusters.matter => examples/thermostat/thermostat-common/thermostat.matter (100%) rename zzz_generated/tv-app/zap-generated/Clusters.matter => examples/tv-app/tv-common/tv-app.matter (100%) rename zzz_generated/tv-casting-app/zap-generated/Clusters.matter => examples/tv-casting-app/tv-casting-common/tv-casting-app.matter (100%) rename zzz_generated/window-app/zap-generated/Clusters.matter => examples/window-app/common/window-app.matter (100%) rename zzz_generated/controller-clusters/zap-generated/Clusters.matter => src/controller/data_model/controller-clusters.matter (100%) diff --git a/zzz_generated/all-clusters-app/zap-generated/Clusters.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter similarity index 100% rename from zzz_generated/all-clusters-app/zap-generated/Clusters.matter rename to examples/all-clusters-app/all-clusters-common/all-clusters-app.matter diff --git a/zzz_generated/bridge-app/zap-generated/Clusters.matter b/examples/bridge-app/bridge-common/bridge-app.matter similarity index 100% rename from zzz_generated/bridge-app/zap-generated/Clusters.matter rename to examples/bridge-app/bridge-common/bridge-app.matter diff --git a/zzz_generated/door-lock-app/zap-generated/Clusters.matter b/examples/door-lock-app/door-lock-common/door-lock-app.matter similarity index 100% rename from zzz_generated/door-lock-app/zap-generated/Clusters.matter rename to examples/door-lock-app/door-lock-common/door-lock-app.matter diff --git a/zzz_generated/lighting-app/zap-generated/Clusters.matter b/examples/lighting-app/lighting-common/lighting-app.matter similarity index 100% rename from zzz_generated/lighting-app/zap-generated/Clusters.matter rename to examples/lighting-app/lighting-common/lighting-app.matter diff --git a/zzz_generated/lock-app/zap-generated/Clusters.matter b/examples/lock-app/lock-common/lock-app.matter similarity index 100% rename from zzz_generated/lock-app/zap-generated/Clusters.matter rename to examples/lock-app/lock-common/lock-app.matter diff --git a/zzz_generated/log-source-app/zap-generated/Clusters.matter b/examples/log-source-app/log-source-common/log-source-app.matter similarity index 100% rename from zzz_generated/log-source-app/zap-generated/Clusters.matter rename to examples/log-source-app/log-source-common/log-source-app.matter diff --git a/zzz_generated/ota-provider-app/zap-generated/Clusters.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter similarity index 100% rename from zzz_generated/ota-provider-app/zap-generated/Clusters.matter rename to examples/ota-provider-app/ota-provider-common/ota-provider-app.matter diff --git a/zzz_generated/ota-requestor-app/zap-generated/Clusters.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter similarity index 100% rename from zzz_generated/ota-requestor-app/zap-generated/Clusters.matter rename to examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter diff --git a/zzz_generated/placeholder/app1/zap-generated/Clusters.matter b/examples/placeholder/linux/apps/app1/config.matter similarity index 100% rename from zzz_generated/placeholder/app1/zap-generated/Clusters.matter rename to examples/placeholder/linux/apps/app1/config.matter diff --git a/zzz_generated/placeholder/app2/zap-generated/Clusters.matter b/examples/placeholder/linux/apps/app2/config.matter similarity index 100% rename from zzz_generated/placeholder/app2/zap-generated/Clusters.matter rename to examples/placeholder/linux/apps/app2/config.matter diff --git a/zzz_generated/pump-app/zap-generated/Clusters.matter b/examples/pump-app/pump-common/pump-app.matter similarity index 100% rename from zzz_generated/pump-app/zap-generated/Clusters.matter rename to examples/pump-app/pump-common/pump-app.matter diff --git a/zzz_generated/pump-controller-app/zap-generated/Clusters.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter similarity index 100% rename from zzz_generated/pump-controller-app/zap-generated/Clusters.matter rename to examples/pump-controller-app/pump-controller-common/pump-controller-app.matter diff --git a/zzz_generated/temperature-measurement-app/zap-generated/Clusters.matter b/examples/temperature-measurement-app/esp32/main/temperature-measurement.matter similarity index 100% rename from zzz_generated/temperature-measurement-app/zap-generated/Clusters.matter rename to examples/temperature-measurement-app/esp32/main/temperature-measurement.matter diff --git a/zzz_generated/thermostat/zap-generated/Clusters.matter b/examples/thermostat/thermostat-common/thermostat.matter similarity index 100% rename from zzz_generated/thermostat/zap-generated/Clusters.matter rename to examples/thermostat/thermostat-common/thermostat.matter diff --git a/zzz_generated/tv-app/zap-generated/Clusters.matter b/examples/tv-app/tv-common/tv-app.matter similarity index 100% rename from zzz_generated/tv-app/zap-generated/Clusters.matter rename to examples/tv-app/tv-common/tv-app.matter diff --git a/zzz_generated/tv-casting-app/zap-generated/Clusters.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter similarity index 100% rename from zzz_generated/tv-casting-app/zap-generated/Clusters.matter rename to examples/tv-casting-app/tv-casting-common/tv-casting-app.matter diff --git a/zzz_generated/window-app/zap-generated/Clusters.matter b/examples/window-app/common/window-app.matter similarity index 100% rename from zzz_generated/window-app/zap-generated/Clusters.matter rename to examples/window-app/common/window-app.matter diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index 01845e8f4e3f73..58f73f0d2a8f71 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -28,10 +28,15 @@ class ZAPGenerateTarget: def __init__(self, zap_config, template=None, output_dir=None): self.script = './scripts/tools/zap/generate.py' - self.output_dir = output_dir - self.zap_config = zap_config + self.zap_config = str(zap_config) self.template = template + if output_dir: + # make sure we convert any os.PathLike object to string + self.output_dir = str(output_dir) + else: + self.output_dir = None + def generate(self): """Runs a ZAP generate command on the configured zap/template/outputs. """ @@ -52,6 +57,10 @@ def extractAnyGeneratedIDL(self): """Searches for Clusters.matter in the output directory and if found, will move it to stay along with the zap file config """ + if not self.output_dir: + # TODO: where do things get generated if no output dir? + # Assume here that IDL is not generated in such cases + return idl_path = os.path.join(self.output_dir, "Clusters.matter") if not os.path.exists(idl_path): @@ -62,9 +71,10 @@ def extractAnyGeneratedIDL(self): # We expect "something.zap" and don't handle corner cases of # multiple extensions. This is to work with existing codebase only raise Error("Unexpected input zap file %s" % self.zap_config) - + os.rename(idl_path, target_path) + def checkPythonVersion(): if sys.version_info[0] < 3: print('Must use Python 3. Current version is ' + @@ -96,10 +106,9 @@ def getGlobalTemplatesTargets(): os.makedirs(output_dir) template = 'examples/placeholder/templates/templates.json' - targets.append(ZAPGenerateTarget( - str(filepath), output_dir=output_dir)) + targets.append(ZAPGenerateTarget(filepath, output_dir=output_dir)) targets.append( - ZAPGenerateTarget(str(filepath), output_dir=output_dir, template=template)) + ZAPGenerateTarget(filepath, output_dir=output_dir, template=template)) continue logging.info("Found example %s (via %s)" % @@ -112,7 +121,7 @@ def getGlobalTemplatesTargets(): if not os.path.exists(output_dir): os.makedirs(output_dir) - targets.append(ZAPGenerateTarget(str(filepath), output_dir=output_dir)) + targets.append(ZAPGenerateTarget(filepath, output_dir=output_dir)) targets.append(ZAPGenerateTarget( './src/controller/data_model/controller-clusters.zap', diff --git a/zzz_generated/controller-clusters/zap-generated/Clusters.matter b/src/controller/data_model/controller-clusters.matter similarity index 100% rename from zzz_generated/controller-clusters/zap-generated/Clusters.matter rename to src/controller/data_model/controller-clusters.matter