Skip to content

Commit

Permalink
Deprecate some clusters in Matter.framework that should never have sh…
Browse files Browse the repository at this point in the history
…ipped (project-chip#35584)

* Temporarily add clusters that should never have shipped to availability.yaml as deprecated.

BarrierControl, BinaryInputBasic, ElectricalMeasurement,
OnOffSwitchConfiguration were never certifiable and should not have shipped.
Add them as deprecated with a dummy release that has some future-enough version
numbers.

* Regenerate generated code with deprecations.

* Mark these clusters as removed and move them out of generated code and into manual shims.

This should only have moved code, not new code.

* Regenerate generated code with the clusters removed.

This has no changes to API headers.

* Regenerate darwin-framework-tool.
  • Loading branch information
bzbarsky-apple authored Sep 16, 2024
1 parent 54127b9 commit c4d4686
Show file tree
Hide file tree
Showing 25 changed files with 128,114 additions and 146,572 deletions.
3,197 changes: 3,197 additions & 0 deletions src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h

Large diffs are not rendered by default.

14,888 changes: 14,888 additions & 0 deletions src/darwin/Framework/CHIP/MTRBackwardsCompatShims.mm

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* {{description}}
*/
{{availability (asUpperCamelCase name preserveAcronyms=true)}}
{{availability (asUpperCamelCase name preserveAcronyms=true) deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}}
@interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRGenericBaseCluster

{{#zcl_commands}}
Expand All @@ -29,20 +29,20 @@ NS_ASSUME_NONNULL_BEGIN
*
* {{description}}
*/
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
{{#unless commandHasRequiredField}}
- (void){{asLowerCamelCase name}}WithCompletion:({{>command_completion_type command=.}})completion
{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }}
{{#if (and (isStrEqual command "KeySetReadAllIndices")
(isStrEqual cluster "GroupKeyManagement"))}}
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691"}};
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691" deprecationMessage="This command is deprecated"}};
{{else}}
{{#if (isInConfigList
(concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true))
"LegacyCommandsWithOnlyOptionalArguments")}}
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A"}};
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A" deprecationMessage="This command is deprecated"}};
{{else}}
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
{{/if}}
{{/if}}
{{/unless}}
Expand All @@ -62,16 +62,16 @@ NS_ASSUME_NONNULL_BEGIN
{{~else~}}
Completion:
{{~/if_is_fabric_scoped_struct~}}
(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
{{#if (or isWritableAttribute
(isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}}
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
{{/if}}
{{#if isReportableAttribute}}
- (void) subscribe{{>attribute}}WithParams:(MTRSubscribeParams *)params
subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
+ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
+ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
{{/if}}
{{/if}}
{{/zcl_attributes_server}}
Expand All @@ -89,7 +89,7 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio
*/
- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device
endpointID:(NSNumber *)endpointID
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}};

@end
{{/if}}
Expand Down
6 changes: 6 additions & 0 deletions src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ MTRCluster{{compatClusterNameRemapping label}}ID {{availability (compatClusterNa
MTRClusterIDType{{>cluster}}ID {{availability (asUpperCamelCase label preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " cluster will be removed")}} = {{asMEI manufacturerCode code}},
{{/if}}
{{/zcl_clusters}}

{{> cluster_id_shims}}
};

#pragma mark - Attributes IDs
Expand Down Expand Up @@ -112,6 +114,8 @@ MTRAttributeIDTypeCluster{{compatClusterNameRemapping ../clusterName}}Attribute{

{{> attributeIDs clusterName=label}}
{{/zcl_clusters}}

{{> attribute_id_shims}}
};

#pragma mark - Commands IDs
Expand Down Expand Up @@ -174,6 +178,8 @@ MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID {{availability cluster co

{{> commandIDs clusterName=label}}
{{/zcl_clusters}}

{{> command_id_shims}}
};

#pragma mark - Events IDs
Expand Down
14 changes: 7 additions & 7 deletions src/darwin/Framework/CHIP/templates/MTRClusters.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ NS_ASSUME_NONNULL_BEGIN
* Cluster {{name}}
* {{description}}
*/
{{availability (asUpperCamelCase name preserveAcronyms=true)}}
{{availability (asUpperCamelCase name preserveAcronyms=true) deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}}
@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRGenericCluster

{{#zcl_commands}}
{{#if (is_str_equal source 'client')}}
{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }}
{{#*inline "commandDecl"}}
{{#if (isSupported cluster command=command)}}
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
{{#unless commandHasRequiredField}}
- (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion
{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }}
{{#if (and (isStrEqual command "KeySetReadAllIndices")
(isStrEqual cluster "GroupKeyManagement"))}}
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691"}};
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691" deprecationMessage="This command is deprecated"}};
{{else}}
{{#if (isInConfigList
(concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true))
"LegacyCommandsWithOnlyOptionalArguments")}}
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A"}};
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A" deprecationMessage="This command is deprecated"}};
{{else}}
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
{{/if}}
{{/if}}
{{/unless}}
Expand All @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
(isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)))}}
{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}}
{{#*inline "availability"}}
{{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)}}
{{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) deprecationMessage="This attribute is deprecated"}}
{{/inline}}
- (NSDictionary<NSString *, id> * _Nullable)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params {{> availability}};
{{#if (or isWritableAttribute
Expand Down Expand Up @@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype _Nullable)initWithDevice:(MTRDevice *)device
endpointID:(NSNumber *)endpointID
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}};

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ NS_ASSUME_NONNULL_BEGIN
- (NSDictionary<NSString *, id> * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error;
@end

NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
5 changes: 5 additions & 0 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9937,6 +9937,11 @@
- ColorCapabilities
- ColorLoopUpdateFlags
removed:
clusters:
- BarrierControl
- BinaryInputBasic
- ElectricalMeasurement
- OnOffSwitchConfiguration
enum values:
ColorControl:
# Don't expose the new value names on the old enum names
Expand Down
Loading

0 comments on commit c4d4686

Please sign in to comment.