Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
Z
zap
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
Wiki
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
esp-mirror
project-chip
zap
提交
a455e57f
未验证
提交
a455e57f
编辑于
2 years ago
作者:
Boris Zbarsky
提交者:
GitHub
2 years ago
浏览文件
操作
下载
补丁
差异文件
Remove hardcoded Darwin API rename maps. (#867)
上级
edf8d354
No related branches found
分支 包含提交
标签
v2022.12.17-nightly
标签 包含提交
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
src-electron/generator/matter/darwin/Framework/CHIP/templates/helper.js
+64
-40
64 个添加, 40 个删除
...enerator/matter/darwin/Framework/CHIP/templates/helper.js
有
64 个添加
和
40 个删除
src-electron/generator/matter/darwin/Framework/CHIP/templates/helper.js
+
64
−
40
浏览文件 @
a455e57f
...
...
@@ -135,29 +135,21 @@ function asObjectiveCNumberType(label, type, asLowerCased) {
return
templateUtil
.
templatePromise
(
this
.
global
,
promise
);
}
const
compatClusterNameMap
=
{
UnitTesting
:
'
TestCluster
'
,
};
function
compatClusterNameRemapping
(
cluster
)
{
function
compatClusterNameRemapping
(
cluster
,
options
)
{
cluster
=
appHelper
.
asUpperCamelCase
(
cluster
,
{
hash
:
{
preserveAcronyms
:
false
},
});
if
(
cluster
in
compatClusterNameMap
)
{
cluster
=
compatClusterNameMap
[
cluster
];
const
old
=
oldName
.
call
(
this
,
cluster
,
options
);
if
(
old
)
{
return
old
;
}
return
cluster
;
}
const
compatAttributeNameMap
=
{
Descriptor
:
{
DeviceTypeList
:
'
DeviceList
'
,
},
};
function
compatAttributeNameRemapping
(
cluster
,
attribute
)
{
function
compatAttributeNameRemapping
(
cluster
,
attribute
,
options
)
{
cluster
=
appHelper
.
asUpperCamelCase
(
cluster
,
{
hash
:
{
preserveAcronyms
:
false
},
});
...
...
@@ -166,15 +158,32 @@ function compatAttributeNameRemapping(cluster, attribute) {
hash
:
{
preserveAcronyms
:
false
},
});
if
(
cluster
in
compatAttributeNameMap
)
{
if
(
attribute
in
compatAttributeNameMap
[
cluster
])
{
attribute
=
compatAttributeNameMap
[
cluster
][
attribute
];
}
const
old
=
oldName
.
call
(
this
,
cluster
,
{
hash
:
{
...
options
.
hash
,
attribute
:
attribute
,
},
});
if
(
old
)
{
return
old
;
}
return
attribute
;
}
/**
* Figure out whether the entity represented by cluster+options (could be a
* cluster, attribute, command, etc) has an old name that it was renamed from,
* and if so return it.
*/
function
oldName
(
cluster
,
options
)
{
const
data
=
fetchAvailabilityData
(
this
.
global
);
const
path
=
makeAvailabilityPath
(
cluster
,
options
);
return
findDataForPath
(
data
,
[
'
renames
'
,
...
path
]);
}
async
function
asObjectiveCClass
(
type
,
cluster
,
options
)
{
let
pkgIds
=
await
templateUtil
.
ensureZclPackageIds
(
this
);
let
isStruct
=
await
zclHelper
...
...
@@ -198,7 +207,7 @@ async function asObjectiveCClass(type, cluster, options) {
if
(
isStruct
)
{
if
(
options
.
hash
.
compatRemapClusterName
)
{
cluster
=
compatClusterNameRemapping
.
call
(
this
,
cluster
);
cluster
=
compatClusterNameRemapping
.
call
(
this
,
cluster
,
{
hash
:
{}
}
);
}
else
{
let
preserveAcronyms
=
true
;
if
(
'
preserveAcronyms
'
in
options
.
hash
)
{
...
...
@@ -317,6 +326,35 @@ function fetchAvailabilityData(global) {
return
availabilityData
;
}
function
findDataForPath
(
availabilityData
,
path
)
{
let
foundData
=
undefined
;
for
(
let
releaseData
of
availabilityData
)
{
let
names
=
[...
path
];
let
currentValue
=
releaseData
;
while
(
currentValue
!=
undefined
&&
names
.
length
!=
0
)
{
currentValue
=
currentValue
[
names
.
shift
()];
}
if
(
currentValue
===
undefined
)
{
continue
;
}
if
(
foundData
!==
undefined
)
{
throw
new
Error
(
`Found two releases matching path:
${
JSON
.
stringify
(
path
)}
`
);
}
// Store for now so we can do the "only one thing matches" check above on
// later releases.
foundData
=
currentValue
;
// Go on to the next release
}
return
foundData
;
}
function
findReleaseForPath
(
availabilityData
,
path
,
options
)
{
if
(
options
.
hash
.
isForIds
)
{
// Ids include all clusters, not just the ones we have real support for.
...
...
@@ -354,7 +392,7 @@ function findReleaseForPath(availabilityData, path, options) {
let
item
=
containerNames
.
pop
();
let
currentContainer
=
releaseData
;
while
(
currentContainer
!==
undefined
&&
containerNames
.
length
!=
0
)
{
currentContainer
=
currentContainer
?.
[
containerNames
.
shift
()];
currentContainer
=
currentContainer
[
containerNames
.
shift
()];
}
if
(
currentContainer
===
undefined
)
{
...
...
@@ -594,13 +632,6 @@ async function availability(clusterName, options) {
return
'
MTR_NEWLY_AVAILABLE
'
;
}
if
(
introducedVersions
===
''
&&
deprecatedVersions
===
undefined
)
{
// TODO: For now, to minimize changes to code by not outputting availability on
// things that don't already have it. Eventually this block should go
// away.
return
''
;
}
if
(
deprecatedVersions
===
undefined
)
{
let
availabilityStrings
=
Object
.
entries
(
introducedVersions
).
map
(
([
os
,
version
])
=>
`
${
os
}
(
${
version
}
)`
...
...
@@ -617,19 +648,12 @@ async function availability(clusterName, options) {
}
if
(
deprecatedVersions
===
'
future
'
)
{
// TODO: For now, to minimize changes to code by not outputting
// availability on things that don't already have it. Eventually this
// condition and the return after it should go away and the return inside
// the if should become unconditional.
if
(
introducedVersions
!=
''
)
{
let
availabilityStrings
=
Object
.
entries
(
introducedVersions
).
map
(
([
os
,
version
])
=>
`
${
os
}
(
${
version
}
)`
);
return
`API_AVAILABLE(
${
availabilityStrings
.
join
(
'
,
'
)}
)\nMTR_NEWLY_DEPRECATED("
${
options
.
hash
.
deprecationMessage
}
")`
;
}
return
`MTR_NEWLY_DEPRECATED("
${
options
.
hash
.
deprecationMessage
}
")`
;
let
availabilityStrings
=
Object
.
entries
(
introducedVersions
).
map
(
([
os
,
version
])
=>
`
${
os
}
(
${
version
}
)`
);
return
`API_AVAILABLE(
${
availabilityStrings
.
join
(
'
,
'
)}
)\nMTR_NEWLY_DEPRECATED("
${
options
.
hash
.
deprecationMessage
}
")`
;
}
// Make sure the set of OSes we were introduced and deprecated on is the same.
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录