Skip to content

Commit 1459278

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Don't try to use nonexistent global attribute id constants on Darwin. (#26398)
We have some global attributes that are marked provisional. New clusters being added would try to generate a constant for the global attribute inside the cluster, until we had a chance to set it provisional, but set its value to the nonexistent global constant, which would fail to compile. This just skips generating the relevant cluster constants.
1 parent 1c4141a commit 1459278

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID
3838
{{#zcl_attributes_server}}
3939
{{~#*inline "attribute"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}}
4040
{{#unless clusterRef}}
41-
{{#if (isSupported "" globalAttribute=(asUpperCamelCase label) isForIds=true)}}
42-
MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID {{availability "" globalAttribute=(asUpperCamelCase label) minimalRelease="First major API revamp" isForIds=true}} = {{asMEI manufacturerCode code}},
41+
{{#if (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)}}
42+
MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID {{availability "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true}} = {{asMEI manufacturerCode code}},
4343
{{/if}}
4444
{{/unless}}
4545
{{/zcl_attributes_server}}
@@ -86,7 +86,9 @@ MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID,
8686
// Cluster {{> cluster}} attributes
8787
{{/if}}
8888
{{/first}}
89-
{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)}}
89+
{{#if (and (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)
90+
(or clusterRef
91+
(isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)))}}
9092
MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID {{availability (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true}} =
9193
{{#if clusterRef}}
9294
{{asMEI manufacturerCode code}},

src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt

+6-3
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,12 @@ MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID
189189

190190
{{#zcl_attributes_server}}
191191
{{! This is used as the implementation for both the new-name and old-name bits, so check for both here. }}
192-
{{#if (or (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))
193-
(and (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name))
194-
(wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name))))}}
192+
{{#if (and
193+
(or clusterRef
194+
(isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true)))
195+
(or (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))
196+
(and (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name))
197+
(wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))))}}
195198
{{#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}}
196199
{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}}
197200
- (NSDictionary<NSString *, id> *)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params {

src/darwin/Framework/CHIP/templates/MTRClusters.zapt

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ NS_ASSUME_NONNULL_BEGIN
4040
{{/zcl_commands}}
4141

4242
{{#zcl_attributes_server}}
43-
{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}
43+
{{#if (and (or clusterRef
44+
(isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true)))
45+
(isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)))}}
4446
{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}}
4547
{{#*inline "availability"}}
4648
{{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)}}

0 commit comments

Comments
 (0)