Skip to content

Commit

Permalink
Combine various different ZAP configuration lists into a single YAML. (
Browse files Browse the repository at this point in the history
…#24958)

* Combine various different ZAP configuration lists into a single YAML.

Fixes #24954

* Fix k32w timeout.
  • Loading branch information
bzbarsky-apple authored Feb 10, 2023
1 parent ed22d1e commit f0262a0
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 50 deletions.
2 changes: 1 addition & 1 deletion integrations/docker/images/chip-cert-bins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.02.03-nightly
ARG ZAP_VERSION=v2023.02.09-nightly

# Ensure TARGETPLATFORM is set
RUN case ${TARGETPLATFORM} in \
Expand Down
2 changes: 1 addition & 1 deletion scripts/tools/zap/zap_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.3'
MIN_ZAP_VERSION = '2023.2.9'


class ZapTool:
Expand Down
2 changes: 1 addition & 1 deletion scripts/zap.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"mac-arm64",
"windows-amd64"
],
"tags": ["version:[email protected].03-nightly.1"]
"tags": ["version:[email protected].09-nightly.1"]
}
]
}
77 changes: 77 additions & 0 deletions src/app/common/templates/config-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
LegacyStructs:
# List of structs for which we output a legacy definition in af-structs.h
# Ideally this list should become empty.
- CredentialStruct

WeakEnums:
# Allow-list of enums that we generate as enums, not enum classes.
# The goal is to drive this down to 0.
- BarrierControlBarrierPosition
- BarrierControlMovingState
- ColorControlOptions
- ColorLoopAction
- ColorLoopDirection
- ColorMode
- ContentLaunchStatus
- ContentLaunchStreamingType
- EnhancedColorMode
- HardwareFaultEnum
- HueDirection
- HueMoveMode
- HueStepMode
- IdentifyEffectIdentifier
- IdentifyEffectVariant
- IdentifyIdentifyType
- InterfaceTypeEnum
- KeypadLockout
- LevelControlOptions
- MoveMode
- NetworkFaultEnum
- OnOffDelayedAllOffEffectVariant
- OnOffDyingLightEffectVariant
- OnOffEffectIdentifier
- PHYRateEnum
- RadioFaultEnum
- RoutingRole
- SaturationMoveMode
- SaturationStepMode
- SecurityType
- StatusCode
- StepMode
- TemperatureDisplayMode
- WiFiVersionType

# We need a more configurable way of deciding which clusters have which init functions....
# See https://github.com/project-chip/connectedhomeip/issues/4369
ClustersWithInitFunctions:
- Basic
- Color Control
- Groups
- Identify
- Level Control
- Localization Configuration
- Occupancy Sensing
- On/Off
- Pump Configuration and Control
- Scenes
- Time Format Localization
- Thermostat
- Mode Select

ClustersWithAttributeChangedFunctions:
- Bridged Device Basic
- Door Lock
- Identify
- Pump Configuration and Control
- Window Covering
- Fan Control

ClustersWithPreAttributeChangeFunctions:
- Door Lock
- Pump Configuration and Control
- Thermostat User Interface Configuration
- Time Format Localization
- Localization Configuration
- Mode Select
- Fan Control
- Thermostat
3 changes: 0 additions & 3 deletions src/app/common/templates/legacy-struct-list.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions src/app/common/templates/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"templates/chip/helper.js"
],
"resources": {
"weak-enum-list": "weak-enum-list.yaml",
"legacy-struct-list": "legacy-struct-list.yaml"
"config-data": "config-data.yaml"
},
"override": "../../zap-templates/common/override.js",
"partials": [
Expand Down
36 changes: 0 additions & 36 deletions src/app/common/templates/weak-enum-list.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions src/app/zap-templates/app-templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"templates/app/helper.js",
"templates/chip/helper.js"
],
"resources": {
"config-data": "../common/templates/config-data.yaml"
},
"override": "common/override.js",
"partials": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/templates/app/af-structs.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

{{#zcl_structs}}

{{#if (isLegacyStruct (asUnderlyingType label))}}
{{#if (isInConfigList (asUnderlyingType label) "LegacyStructs")}}
{{#if itemCnt}}
// Struct for {{label}}
typedef struct _{{asType label}} {
Expand Down
4 changes: 2 additions & 2 deletions src/app/zap-templates/templates/app/cluster-enums-check.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ static auto __attribute__((unused)) EnsureKnownEnumValue({{asUpperCamelCase ../n
{
using EnumType = {{asUpperCamelCase ../name}}::{{asType label}};
switch (val) {
{{#if (isWeaklyTypedEnum label)}}
{{#if (isInConfigList label "WeakEnums")}}
// Need to convert consumers to using the new enum classes, so we
// don't just have casts all over.
#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM
{{/if}}
{{#zcl_enum_items}}
case EnumType::k{{asUpperCamelCase label}}:
{{/zcl_enum_items}}
{{#if (isWeaklyTypedEnum label)}}
{{#if (isInConfigList label "WeakEnums")}}
#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM
{{#zcl_enum_items}}
case EMBER_ZCL_{{asDelimitedMacro parent.label}}_{{asDelimitedMacro label}}:
Expand Down
4 changes: 2 additions & 2 deletions src/app/zap-templates/templates/app/cluster-enums.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Clusters {
namespace {{asUpperCamelCase name}} {
{{#zcl_enums}}

{{#if (isWeaklyTypedEnum label)}}
{{#if (isInConfigList label "WeakEnums")}}
// Need to convert consumers to using the new enum classes, so we
// don't just have casts all over.
#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM
Expand All @@ -30,7 +30,7 @@ k{{asUpperCamelCase label}} = {{asHex value 2}},
// enum value. This specific should never be transmitted.
kUnknownEnumValue = {{first_unused_enum_value mode="first_unused"}},
};
{{#if (isWeaklyTypedEnum label)}}
{{#if (isInConfigList label "WeakEnums")}}
#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM
using {{asType label}} = EmberAf{{asType label}};
static {{asType label}} __attribute__((unused)) k{{asType label}}kUnknownEnumValue = static_cast<{{asType label}}>({{first_unused_enum_value mode="first_unused"}});
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/templates/app/enums.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{#zcl_enums}}
{{#unless (isStrEqual label "Status")}}
{{#unless (isStrEqual label "ReportingDirection")}}
{{#if (isWeaklyTypedEnum label)}}
{{#if (isInConfigList label "WeakEnums")}}

// Enum for {{label}}
enum EmberAf{{asType label}} : {{asUnderlyingZclType name}} {
Expand Down

0 comments on commit f0262a0

Please sign in to comment.