From 18248806381afde0ac2a8b39fafccfd0c0f2cf0b Mon Sep 17 00:00:00 2001 From: Bharat Raju Date: Thu, 6 Apr 2023 21:46:46 -0400 Subject: [PATCH] Deprecating stateful helpers with stateless ones (#25978) * Deprecating stateful helpers with stateless ones Github: ZAP#682 * updating the minimum version of zap Github: ZAP#682 --- .../logging/DataModelLogger-src.zapt | 4 +- .../docker/images/chip-cert-bins/Dockerfile | 2 +- scripts/setup/zap.json | 2 +- scripts/tools/zap/zap_execution.py | 2 +- .../templates/app/CHIPClientCallbacks.zapt | 4 +- .../templates/app/CHIPClusters.zapt | 4 +- .../zap-templates/templates/app/access.zapt | 48 +++++++++---------- .../java/templates/CHIPClustersWrite-JNI.zapt | 4 +- .../java/templates/CHIPInvokeCallbacks.zapt | 4 +- .../java/templates/CHIPReadCallbacks-src.zapt | 4 +- .../java/templates/ChipClusters-java.zapt | 4 +- .../java/templates/ChipEventStructs-java.zapt | 8 ++-- .../java/templates/ChipIdLookup-java.zapt | 8 ++-- .../java/templates/ChipStructs-java.zapt | 8 ++-- .../java/templates/ClusterInfo-java.zapt | 4 +- 15 files changed, 55 insertions(+), 55 deletions(-) diff --git a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt index 64f701e140b43d..d710ff53735f6c 100644 --- a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt +++ b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt @@ -159,7 +159,7 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip switch (header.mPath.mClusterId) { {{#all_user_clusters side='client'}} -{{#chip_server_cluster_events}} +{{#zcl_events}} {{#first}} case {{asUpperCamelCase parent.name}}::Id: { @@ -177,7 +177,7 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip break; } {{/last}} -{{/chip_server_cluster_events}} +{{/zcl_events}} {{/all_user_clusters}} default: break; diff --git a/integrations/docker/images/chip-cert-bins/Dockerfile b/integrations/docker/images/chip-cert-bins/Dockerfile index bc7317f5f7adc2..d1d9c5d081f829 100644 --- a/integrations/docker/images/chip-cert-bins/Dockerfile +++ b/integrations/docker/images/chip-cert-bins/Dockerfile @@ -7,7 +7,7 @@ ARG COMMITHASH=7b99e6399c6069037c613782d78132c69b9dcabb # ZAP Development install, so that it runs on both x64 and arm64 # Generally this should match with the ZAP version that is used for codegen within the # specified SHA -ARG ZAP_VERSION=v2023.03.30-nightly +ARG ZAP_VERSION=v2023.04.05-nightly # Ensure TARGETPLATFORM is set RUN case ${TARGETPLATFORM} in \ diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index a9a13342a3b79b..88209409ae83d1 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,7 +8,7 @@ "mac-arm64", "windows-amd64" ], - "tags": ["version:2@v2023.03.30-nightly.1"] + "tags": ["version:2@v2023.04.05-nightly.1"] } ] } diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index 4beb061e32fc3f..cfc4fcfc588281 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2023.3.30' +MIN_ZAP_VERSION = '2023.4.5' class ZapTool: diff --git a/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt b/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt index 2bcc81a319eca2..d28b45a8f2032d 100644 --- a/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt +++ b/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt @@ -1,6 +1,6 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} #pragma once #include @@ -21,4 +21,4 @@ typedef void (*{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}ListAttr {{/zcl_attributes_server}} {{/all_user_clusters}} -{{/if}} \ No newline at end of file +{{/if_enabled_clusters}} \ No newline at end of file diff --git a/src/app/zap-templates/templates/app/CHIPClusters.zapt b/src/app/zap-templates/templates/app/CHIPClusters.zapt index a1ce28b71469a9..2bf93e2c728fe2 100644 --- a/src/app/zap-templates/templates/app/CHIPClusters.zapt +++ b/src/app/zap-templates/templates/app/CHIPClusters.zapt @@ -1,6 +1,6 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} // Prevent multiple inclusion #pragma once @@ -25,4 +25,4 @@ public: {{/all_user_clusters}} } // namespace Controller } // namespace chip -{{/if}} +{{/if_enabled_clusters}} diff --git a/src/app/zap-templates/templates/app/access.zapt b/src/app/zap-templates/templates/app/access.zapt index fca0bd9b4a20d1..483de62bce4c60 100644 --- a/src/app/zap-templates/templates/app/access.zapt +++ b/src/app/zap-templates/templates/app/access.zapt @@ -10,7 +10,7 @@ //////////////////////////////////////////////////////////////////////////////// -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (*cluster*, attribute, privilege) for read attribute #define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ @@ -41,9 +41,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, *attribute*, privilege) for read attribute #define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ @@ -74,9 +74,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, attribute, *privilege*) for read attribute #define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ @@ -107,11 +107,11 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} //////////////////////////////////////////////////////////////////////////////// -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (*cluster*, attribute, privilege) for write attribute #define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ @@ -142,9 +142,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, *attribute*, privilege) for write attribute #define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ @@ -175,9 +175,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, attribute, *privilege*) for write attribute #define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ @@ -208,11 +208,11 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} //////////////////////////////////////////////////////////////////////////////// -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (*cluster*, command, privilege) for invoke command #define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ @@ -243,9 +243,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, *command*, privilege) for invoke command #define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ @@ -276,9 +276,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, command, *privilege*) for invoke command #define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ @@ -309,11 +309,11 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} //////////////////////////////////////////////////////////////////////////////// -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (*cluster*, event, privilege) for read event #define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ @@ -344,9 +344,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, *event*, privilege) for read event #define GENERATED_ACCESS_READ_EVENT__EVENT { \ @@ -377,9 +377,9 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} -{{#chip_server_clusters}} +{{#all_user_clusters side='server'}} {{#first}} // Parallel array data (cluster, event, *privilege*) for read event #define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ @@ -410,7 +410,7 @@ {{#last}} } {{/last}} -{{/chip_server_clusters}} +{{/all_user_clusters}} //////////////////////////////////////////////////////////////////////////////// diff --git a/src/controller/java/templates/CHIPClustersWrite-JNI.zapt b/src/controller/java/templates/CHIPClustersWrite-JNI.zapt index 23d49866ca04ea..9be7cfb69dcd39 100644 --- a/src/controller/java/templates/CHIPClustersWrite-JNI.zapt +++ b/src/controller/java/templates/CHIPClustersWrite-JNI.zapt @@ -1,5 +1,5 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} #include #include #include "CHIPInvokeCallbacks.h" @@ -78,6 +78,6 @@ JNI_METHOD(void, {{asUpperCamelCase ../name}}Cluster, write{{asUpperCamelCase na {{/if_unsupported_attribute_callback}} {{/zcl_attributes_server}} {{/all_user_clusters}} -{{/if}} +{{/if_enabled_clusters}} #pragma clang diagnostic pop diff --git a/src/controller/java/templates/CHIPInvokeCallbacks.zapt b/src/controller/java/templates/CHIPInvokeCallbacks.zapt index 81fe85ffc713f0..59adcfe73961f0 100644 --- a/src/controller/java/templates/CHIPInvokeCallbacks.zapt +++ b/src/controller/java/templates/CHIPInvokeCallbacks.zapt @@ -1,5 +1,5 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} #include #include @@ -26,4 +26,4 @@ private: {{/zcl_commands_source_server}} {{/all_user_clusters}} } // namespace chip -{{/if}} +{{/if_enabled_clusters}} diff --git a/src/controller/java/templates/CHIPReadCallbacks-src.zapt b/src/controller/java/templates/CHIPReadCallbacks-src.zapt index 3a7ce97c8e68e6..60bc0b09447780 100644 --- a/src/controller/java/templates/CHIPReadCallbacks-src.zapt +++ b/src/controller/java/templates/CHIPReadCallbacks-src.zapt @@ -1,5 +1,5 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} #include #include @@ -175,4 +175,4 @@ void CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallb {{/zcl_attributes_server}} {{/all_user_clusters}} -{{/if}} +{{/if_enabled_clusters}} diff --git a/src/controller/java/templates/ChipClusters-java.zapt b/src/controller/java/templates/ChipClusters-java.zapt index 655b547864a4af..d46005ce04ff9b 100644 --- a/src/controller/java/templates/ChipClusters-java.zapt +++ b/src/controller/java/templates/ChipClusters-java.zapt @@ -1,5 +1,5 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} package chip.devicecontroller; @@ -247,4 +247,4 @@ public class ChipClusters { {{/not_last}} {{/all_user_clusters}} } -{{/if}} +{{/if_enabled_clusters}} diff --git a/src/controller/java/templates/ChipEventStructs-java.zapt b/src/controller/java/templates/ChipEventStructs-java.zapt index 4737bd19b2648b..e180b3c3a75b70 100644 --- a/src/controller/java/templates/ChipEventStructs-java.zapt +++ b/src/controller/java/templates/ChipEventStructs-java.zapt @@ -1,16 +1,16 @@ {{> header}} package chip.devicecontroller; -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Optional; -{{/if}} +{{/if_enabled_clusters}} {{! TODO: Use AutoValue for inner classes. }} public class ChipEventStructs { -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} {{#all_user_clusters side='client'}} {{#zcl_events}} public static class {{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event { @@ -55,5 +55,5 @@ public {{asJavaType type null parent.parent.name includeAnnotations=true}} {{asL {{/zcl_events}} {{/all_user_clusters}} -{{/if}} +{{/if_enabled_clusters}} } \ No newline at end of file diff --git a/src/controller/java/templates/ChipIdLookup-java.zapt b/src/controller/java/templates/ChipIdLookup-java.zapt index 18bea3b747cb37..aa744a98cd94ac 100644 --- a/src/controller/java/templates/ChipIdLookup-java.zapt +++ b/src/controller/java/templates/ChipIdLookup-java.zapt @@ -1,5 +1,5 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} package chip.devicecontroller; @@ -42,15 +42,15 @@ public final class ChipIdLookup { public static String eventIdToName(long clusterId, long eventId) { {{#all_user_clusters side='client'}} if (clusterId == {{code}}L) { - {{#chip_server_cluster_events}} + {{#zcl_events}} if (eventId == {{code}}L) { return "{{asUpperCamelCase name}}"; } - {{/chip_server_cluster_events}} + {{/zcl_events}} return ""; } {{/all_user_clusters}} return ""; } } -{{/if}} \ No newline at end of file +{{/if_enabled_clusters}} \ No newline at end of file diff --git a/src/controller/java/templates/ChipStructs-java.zapt b/src/controller/java/templates/ChipStructs-java.zapt index 19771c7bdd2bad..595b47afa42830 100644 --- a/src/controller/java/templates/ChipStructs-java.zapt +++ b/src/controller/java/templates/ChipStructs-java.zapt @@ -1,16 +1,16 @@ {{> header}} package chip.devicecontroller; -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Optional; -{{/if}} +{{/if_enabled_clusters}} {{! TODO: Use AutoValue for inner classes. }} public class ChipStructs { -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} {{#all_user_clusters side='client'}} {{#zcl_structs}} {{#if itemCnt}} @@ -53,5 +53,5 @@ public {{asJavaType type null parent.parent.name includeAnnotations=true}} {{asL {{/zcl_structs}} {{/all_user_clusters}} -{{/if}} +{{/if_enabled_clusters}} } \ No newline at end of file diff --git a/src/controller/java/templates/ClusterInfo-java.zapt b/src/controller/java/templates/ClusterInfo-java.zapt index 63cf5cbfba106e..45234bd42a1b39 100644 --- a/src/controller/java/templates/ClusterInfo-java.zapt +++ b/src/controller/java/templates/ClusterInfo-java.zapt @@ -1,5 +1,5 @@ {{> header}} -{{#if (chip_has_client_clusters)}} +{{#if_enabled_clusters side='client'}} package chip.devicecontroller; @@ -373,4 +373,4 @@ public class ClusterInfoMapping { } -{{/if}} \ No newline at end of file +{{/if_enabled_clusters}} \ No newline at end of file