Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for backwards-compat shims for cluster renames on Darwin. #811

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ function asObjectiveCNumberType(label, type, asLowerCased) {
return templateUtil.templatePromise(this.global, promise);
}

const compatClusterNameMap = {
UnitTesting: 'TestCluster',
};

function compatClusterNameRemapping(cluster) {
cluster = appHelper.asUpperCamelCase(cluster, {
hash: { preserveAcronyms: false },
});

if (cluster in compatClusterNameMap) {
cluster = compatClusterNameMap[cluster];
}

return cluster;
}

async function asObjectiveCClass(type, cluster, options) {
let pkgIds = await templateUtil.ensureZclPackageIds(this);
let isStruct = await zclHelper
Expand All @@ -152,9 +168,14 @@ async function asObjectiveCClass(type, cluster, options) {
}

if (isStruct) {
return `MTR${appHelper.asUpperCamelCase(cluster, {
hash: { preserveAcronyms: false },
})}Cluster${appHelper.asUpperCamelCase(type)}`;
if (options.hash.compatRemapClusterName) {
cluster = compatClusterNameRemapping.call(this, cluster);
} else {
cluster = appHelper.asUpperCamelCase(cluster, {
hash: { preserveAcronyms: false },
});
}
return `MTR${cluster}Cluster${appHelper.asUpperCamelCase(type)}`;
}

return 'NSNumber';
Expand Down Expand Up @@ -262,6 +283,7 @@ exports.commandHasRequiredField = commandHasRequiredField;
exports.objCEnumName = objCEnumName;
exports.objCEnumItemLabel = objCEnumItemLabel;
exports.hasArguments = hasArguments;
exports.compatClusterNameRemapping = compatClusterNameRemapping;

exports.meta = {
category: dbEnum.helperCategory.matter,
Expand Down