xts-gate-windows 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +177 -0
- package/PUBLISH_NOTE.md +68 -0
- package/README.md +94 -2
- package/SKILL.md +170 -0
- package/install.js +78 -0
- package/package.json +35 -4
- package/references/gate-error-catalog.md +284 -0
- package/references/pre-submit-checklist.md +128 -0
- package/references/project-completion.md +265 -0
- package/references/system-api-hits.md +72 -0
- package/references/windows-gate-build.md +231 -0
- package/scripts/check_xts_project.py +599 -0
- package/scripts/run-gate-build.ps1 +79 -0
- package/scripts/run-gate-build.sh +138 -0
- package/templates/BUILD.gn.dynamic +13 -0
- package/templates/BUILD.gn.static +14 -0
- package/templates/Test.json +28 -0
- package/templates/hvigor-config.json5.example +7 -0
- package/templates/local.properties.example +5 -0
- package/templates/module.json5.snippet +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
package/PUBLISH_NOTE.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# 给邱老师的说明
|
|
2
|
+
|
|
3
|
+
这是 Claude Code 的 **XTS 门禁 Windows 编译 + 上库前检查** skill。
|
|
4
|
+
|
|
5
|
+
## 为什么强调 WSL
|
|
6
|
+
|
|
7
|
+
门禁是 Linux 上的 `build.py → GN/ninja → hvigor`。Windows 原生 hvigor 的 schema、SDK 版本、文件系统大小写规则都与门禁不同,**Windows 上编过不能作为门禁结论**。
|
|
8
|
+
|
|
9
|
+
本 skill 的唯一门禁一致路线是:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Windows 编辑 → WSL Ubuntu → Linux SDK + 门禁 hvigor + node 18.20.1 → 门禁同款 hvigor 命令
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 安装
|
|
16
|
+
|
|
17
|
+
```powershell
|
|
18
|
+
npx -y xts-gate-windows@latest install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
默认安装到 `%USERPROFILE%\.claude\skills\xts-gate-windows`。自定义目录:
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
npx -y xts-gate-windows@latest install --dest D:\claude-skills
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
也可以解压后手动放到 `%USERPROFILE%\.claude\skills\xts-gate-windows\`。新开 Claude Code 会话即可被识别。
|
|
28
|
+
|
|
29
|
+
## 前置
|
|
30
|
+
|
|
31
|
+
- WSL2 Ubuntu 22.04/24.04
|
|
32
|
+
- WSL 内:门禁同版本 Linux SDK、`command-line-tools 26.0.1.290`(hvigor 6.26.21)、`node 18.20.1-linux-x64`、JDK 17
|
|
33
|
+
- 静态严格门禁:门禁 `7.26.0.static/hvigor`(公开包没有;没有时用 5.14.2 近似,结论要标注)
|
|
34
|
+
|
|
35
|
+
## 两条上库规范(本 skill 已内置检查)
|
|
36
|
+
|
|
37
|
+
1. **system API 用例**:走 HITS 独立仓(闭源,仓名/构建/提交流程以 HITS 团队/CI 为准,不要猜),命名用 `Hits` 前缀,测试 HAP 必须系统签名;不要提交到 `xts_acts`。
|
|
38
|
+
2. **禁止预编译二进制**:工程内不得携带 `.hsp`、`.hap`、`.har`、`.so`、`.abc`、`.jar` 等;所有模块必须在门禁中从源码编译,HSP 依赖改为源码模块。
|
|
39
|
+
|
|
40
|
+
## 最快验证
|
|
41
|
+
|
|
42
|
+
```powershell
|
|
43
|
+
python .\scripts\check_xts_project.py <suite_dir>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
.\scripts\run-gate-build.ps1 -Distro Ubuntu `
|
|
48
|
+
-Project /root/ohos-gate/ws/test/xts/acts/.../<suite> `
|
|
49
|
+
-Mode dyn `
|
|
50
|
+
-NodeHome /root/ohos-gate/toolchain/node-v18.20.1-linux-x64 `
|
|
51
|
+
-SdkRoot /root/ohos-gate/sdk `
|
|
52
|
+
-HvigorHome /root/ohos-gate/toolchain/clt-26.0.1.290/hvigor `
|
|
53
|
+
-JavaHome /usr/lib/jvm/java-17-openjdk-amd64
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 验证状态
|
|
57
|
+
|
|
58
|
+
- WSL + 门禁 hvigor 6.26.21 + node 18.20.1:动态 `BUILD SUCCESSFUL`。
|
|
59
|
+
- WSL + 本地 hvigor 5.14.2:静态 `BUILD SUCCESSFUL`(近似)。
|
|
60
|
+
- `check_xts_project.py` 已用真实工程 + 反例夹具验证:BUILD.gn、schema、Test.json、syscap、大小写 import、`@tc.number`、`globalThis`、RPC 类型等均能报出。
|
|
61
|
+
|
|
62
|
+
## 先读
|
|
63
|
+
|
|
64
|
+
1. `SKILL.md`
|
|
65
|
+
2. `references/windows-gate-build.md`
|
|
66
|
+
3. `references/pre-submit-checklist.md`
|
|
67
|
+
4. `references/system-api-hits.md`(system API 用例)
|
|
68
|
+
5. `references/gate-error-catalog.md`
|
package/README.md
CHANGED
|
@@ -1,3 +1,95 @@
|
|
|
1
|
-
#
|
|
1
|
+
# xts-gate-windows
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
给 Claude Code 的 XTS 门禁编译 + 上库前检查 skill。
|
|
4
|
+
|
|
5
|
+
## 它解决什么
|
|
6
|
+
|
|
7
|
+
1. **在 Windows 上得到与门禁一致的编译条件**:Windows 负责编辑,WSL Ubuntu 内用**门禁 Linux 工具链**(Linux SDK / Linux hvigor / node 18.20.1)编译。Windows 原生 hvigor 只做语法参考,不作为门禁结论。
|
|
8
|
+
2. **完善 XTS 工程**:BUILD.gn、module.json5、Test.json、syscap、hypium、动态/静态目录与类型规则;system API 用例走 HITS 独立仓(闭源,流程以 HITS 团队为准)+ `Hits` 前缀 + 系统签名。
|
|
9
|
+
3. **上库前检查**:可运行的 `check_xts_project.py`,覆盖门禁最容易拦的工程/配置/代码问题,包括仓/前缀不一致、工程携带 `.hsp` 等预编译二进制。
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
### npm(推荐)
|
|
14
|
+
|
|
15
|
+
```powershell
|
|
16
|
+
npx -y xts-gate-windows@latest install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
默认安装到 `%USERPROFILE%\.claude\skills\xts-gate-windows`;自定义目录:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
npx -y xts-gate-windows@latest install --dest D:\claude-skills
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 手动
|
|
26
|
+
|
|
27
|
+
把整个目录放到 Claude Code 的 skills 目录:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
%USERPROFILE%\.claude\skills\xts-gate-windows\
|
|
31
|
+
SKILL.md
|
|
32
|
+
references\
|
|
33
|
+
scripts\
|
|
34
|
+
templates\
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
或解压 `xts-gate-windows.zip` 到该目录。重启/新开 Claude Code 会话后,描述里出现 “XTS 门禁 / WSL 编译 / XTS 上库” 即会被加载。
|
|
38
|
+
|
|
39
|
+
## 前置
|
|
40
|
+
|
|
41
|
+
- Windows 10/11 + WSL2(Ubuntu 22.04/24.04)
|
|
42
|
+
- WSL 内:Linux SDK(门禁同版本,如 26.1.0.x)、`command-line-tools 26.0.1.290`(hvigor 6.26.21)、`node 18.20.1-linux-x64`、JDK 17
|
|
43
|
+
- 静态严格门禁还需要门禁的 `7.26.0.static/hvigor`(公开包没有;没有时用 5.14.2 近似并在结论中标注)
|
|
44
|
+
|
|
45
|
+
## 快速开始
|
|
46
|
+
|
|
47
|
+
```powershell
|
|
48
|
+
# 1) 工程检查(Windows 或 WSL 均可)
|
|
49
|
+
python .\scripts\check_xts_project.py E:\path\to\ActsXxxTest
|
|
50
|
+
|
|
51
|
+
# 2) WSL 门禁编译(Windows 侧包装)
|
|
52
|
+
.\scripts\run-gate-build.ps1 -Distro Ubuntu `
|
|
53
|
+
-Project /root/ohos-gate/ws/test/xts/acts/.../ActsXxxTest `
|
|
54
|
+
-Mode dyn `
|
|
55
|
+
-NodeHome /root/ohos-gate/toolchain/node-v18.20.1-linux-x64 `
|
|
56
|
+
-SdkRoot /root/ohos-gate/sdk `
|
|
57
|
+
-HvigorHome /root/ohos-gate/toolchain/clt-26.0.1.290/hvigor `
|
|
58
|
+
-JavaHome /usr/lib/jvm/java-17-openjdk-amd64
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
静态:`-Mode sta`,`-HvigorHome` 指向 `7.26.0.static/hvigor`(若可得)或本地 `hvigor-5.14.2`(近似)。
|
|
62
|
+
|
|
63
|
+
## 文件
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
SKILL.md
|
|
67
|
+
references/
|
|
68
|
+
windows-gate-build.md WSL + Linux 工具链、SDK 解压、命令、坑位
|
|
69
|
+
project-completion.md BUILD.gn/配置/代码/注册规则
|
|
70
|
+
pre-submit-checklist.md 上库前逐项清单
|
|
71
|
+
system-api-hits.md system API:HITS 仓、Hits 命名、系统签名(闭源仓不推测)
|
|
72
|
+
gate-error-catalog.md 门禁错误原文 → 根因 → 修复
|
|
73
|
+
scripts/
|
|
74
|
+
check_xts_project.py 工程检查器
|
|
75
|
+
run-gate-build.sh WSL 内编译
|
|
76
|
+
run-gate-build.ps1 Windows 调用 WSL
|
|
77
|
+
templates/
|
|
78
|
+
BUILD.gn.dynamic / BUILD.gn.static
|
|
79
|
+
Test.json / module.json5.snippet
|
|
80
|
+
local.properties.example / hvigor-config.json5.example
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 验证状态
|
|
84
|
+
|
|
85
|
+
- 2026-11-26,一对真实动态/静态 XTS suite 在 WSL + 门禁 hvigor 6.26.21 + node 18.20.1 下动态 `BUILD SUCCESSFUL`。
|
|
86
|
+
- 同批静态 suite 在 WSL + 本地 hvigor 5.14.2 下 `BUILD SUCCESSFUL`(门禁 `7.26.0.static` 无公开包,属近似)。
|
|
87
|
+
- Windows 原生 hvigor 路径未作为门禁一致方案;本 skill 不使用它下结论。
|
|
88
|
+
|
|
89
|
+
## 发布
|
|
90
|
+
|
|
91
|
+
把本目录(或同内容 zip)发给邱老师即可。建议同时附上:
|
|
92
|
+
|
|
93
|
+
- `references/windows-gate-build.md`
|
|
94
|
+
- `scripts/check_xts_project.py`
|
|
95
|
+
- 一个真实套件的检查输出示例
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xts-gate-windows
|
|
3
|
+
description: Use when building OpenHarmony XTS test suites on a Windows host through WSL with the Linux gate toolchain, or preparing an XTS suite for repository submission — covers WSL + Linux SDK/hvigor/node gate setup, acts vs system-API HITS repo/naming/system signing, BUILD.gn/module.json5/Test.json/syscap/hypium configuration, dynamic vs static builds, no-prebuilt-binary rules, gate-only compile errors, and the full pre-submit checklist. Windows-native hvigor is explicitly not gate-identical.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# XTS 门禁 Windows 编译与上库前准备
|
|
7
|
+
|
|
8
|
+
## 核心原则
|
|
9
|
+
|
|
10
|
+
**Windows 上编过 ≠ 门禁能过。** 门禁是 Linux 上的 `build.py → GN/ninja → hvigor`,它会额外检查 BUILD.gn 注册、schema、hap 命名、syscap、Test.json、大小写路径,并使用与本地 DevEco 不同版本的 hvigor/SDK。
|
|
11
|
+
|
|
12
|
+
本 skill 的唯一门禁一致路线是:**Windows 宿主 + WSL Ubuntu + 门禁 Linux 工具链(Linux SDK / Linux hvigor / node 18.20.1)**。Windows 原生 hvigor/DevEco 只能做语法和工程检查,**不能作为门禁结论**。
|
|
13
|
+
|
|
14
|
+
本 skill 只负责准备与本地验证,**不执行 git commit/push,也不提交 PR**;提交由你们按仓的流程完成。
|
|
15
|
+
|
|
16
|
+
## 先选路线
|
|
17
|
+
|
|
18
|
+
| 目标 | 路线 | 说明 |
|
|
19
|
+
|------|------|------|
|
|
20
|
+
| 门禁一致(唯一推荐) | **WSL Ubuntu + 门禁 Linux SDK + 门禁 hvigor 6.26.21 + node 18.20.1** | 已验证;本 skill 的主路线 |
|
|
21
|
+
| 只查工程问题、不编译 | `scripts/check_xts_project.py` + 生成 skill 的 `validate_test.py` + `ohos-test-xts-code-quality` | 零下载、最快 |
|
|
22
|
+
| Windows 原生 hvigor | 仅语法参考 | schema/API/编译器版本均与门禁不同,**不得**作为门禁通过依据 |
|
|
23
|
+
| 静态套件 | 门禁 `7.26.0.static` 若可得;否则 WSL 内本地 hvigor 5.14.2 近似 | 静态门禁 hvigor 无公开包,必须标注“近似” |
|
|
24
|
+
|
|
25
|
+
> 门禁本体是 Linux。不要把 Windows 原生 hvigor 的 `BUILD SUCCESSFUL` 当作门禁证据;所有编译结论都应在 WSL 内产生。
|
|
26
|
+
|
|
27
|
+
## 工作流 A:Windows 宿主 + WSL 门禁编译
|
|
28
|
+
|
|
29
|
+
完整步骤、路径校验、坑位见 `references/windows-gate-build.md`。所有编译命令都在 WSL 内执行。
|
|
30
|
+
|
|
31
|
+
1. 在 Windows 上确认 WSL:
|
|
32
|
+
```powershell
|
|
33
|
+
wsl -l -v
|
|
34
|
+
wsl -d Ubuntu -e bash -lc "uname -a && df -h /"
|
|
35
|
+
```
|
|
36
|
+
2. 在 WSL 内准备四样东西(优先用本地已有包,不强制联网):
|
|
37
|
+
- `node-v18.20.1-linux-x64`(门禁 node 版本)
|
|
38
|
+
- `command-line-tools 26.0.1.290`(门禁同款 hvigor 6.26.21)
|
|
39
|
+
- 门禁 Linux SDK(`prebuilts/ohos-sdk/linux/<version>` 或每日 `ohos-sdk-full[_Dyn_Sta]` 的 linux 组件)
|
|
40
|
+
- JDK 17(WSL 内 `java`,仅 HAP 打包需要)
|
|
41
|
+
3. 工程放到 WSL 的 `test/xts/acts/...` 深度,确保 `oh-package.json5` 里
|
|
42
|
+
`file:../../../../../tools/hypium_prepare/*.har` 能解析到 `test/xts/tools/hypium_prepare`。
|
|
43
|
+
4. 在 WSL 内设置:
|
|
44
|
+
```bash
|
|
45
|
+
export DEVECO_NODE_HOME=/root/ohos-gate/toolchain/node-v18.20.1-linux-x64
|
|
46
|
+
export PATH=$DEVECO_NODE_HOME/bin:$PATH
|
|
47
|
+
export OHOS_BASE_SDK_HOME=/root/ohos-gate/sdk # 其下有 26.1.0/{ets,js,native,previewer,toolchains}
|
|
48
|
+
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
|
49
|
+
```
|
|
50
|
+
`local.properties` 写 `sdk.dir=/root/ohos-gate/sdk`。
|
|
51
|
+
5. 在 WSL 内安装依赖:`ohpm install`;若 ohpm 因 node 版本报 `ERR_REQUIRE_ESM`,按 §手动安装 hypium 处理。
|
|
52
|
+
6. 动态(`BUILD.gn` 里 `test_hap = true`):
|
|
53
|
+
```bash
|
|
54
|
+
cd <suite>
|
|
55
|
+
/root/ohos-gate/toolchain/clt-26.0.1.290/bin/hvigorw \
|
|
56
|
+
--mode module -p module=entry@ohosTest assembleHap \
|
|
57
|
+
-p debuggable=false -p hvigor-obfuscation=false --no-daemon
|
|
58
|
+
```
|
|
59
|
+
产物:`entry/build/default/outputs/ohosTest/entry-ohosTest-unsigned.hap`
|
|
60
|
+
7. 静态(`ohos_js_app_static_suite`,`test_hap` 注释掉):
|
|
61
|
+
```bash
|
|
62
|
+
/root/ohos-gate/toolchain/hvigor-5.14.2/bin/hvigorw assembleHap --mode module -p module=entry \
|
|
63
|
+
-p product=default -p debuggable=false -p hvigor-obfuscation=false --no-daemon
|
|
64
|
+
```
|
|
65
|
+
产物:`entry/build/default/outputs/default/entry-default-unsigned.hap`
|
|
66
|
+
8. 用 `scripts/run-gate-build.ps1`(Windows 侧调用 WSL)或 `scripts/run-gate-build.sh`(WSL 内)可一次完成校验 + 构建 + 产物检查。
|
|
67
|
+
|
|
68
|
+
### 两个高频环境坑(WSL 内)
|
|
69
|
+
|
|
70
|
+
- `spawn .../node ENOENT`:hvigor 6.26.21 期望 SDK 有 `ets/build-tools/ets-loader`;26.1.0.22 是 `ets/dynamic/build-tools`。在 WSL 的 SDK 内建兼容链接:
|
|
71
|
+
`ln -sfn dynamic/build-tools <sdk>/26.1.0/ets/build-tools`(仅本地临时 SDK;优先用 26.1.0.27+ 门禁 SDK)。
|
|
72
|
+
- `spawn java ENOENT`:HAP 打包需要 Java;WSL 内安装 `openjdk-17-jre-headless`,设置 `JAVA_HOME`。
|
|
73
|
+
|
|
74
|
+
## 工作流 B:完善 XTS 工程
|
|
75
|
+
|
|
76
|
+
字段级规则、目录结构、动态/静态差异见 `references/project-completion.md`。
|
|
77
|
+
|
|
78
|
+
必须同时满足:
|
|
79
|
+
|
|
80
|
+
0. **选仓/命名**:普通 Public API → `xts_acts` + `Acts` 前缀;`@systemapi`/系统权限 → **HITS 独立仓(闭源,仓名与流程以 HITS 团队/CI 为准)** + `Hits` 前缀 + 系统签名。不要把 system API 用例提交到 `xts_acts`,也不要混用前缀。详见 `references/system-api-hits.md`。
|
|
81
|
+
1. **目录/注册**:suite 放在对应仓的 `<subsystem>/<part>/<suite>` 下;父 `BUILD.gn` 的 `group("<part>")` 的 deps 里追加 `"<suite>:<Target>"`;若是新子系统,还要在 `test_targets.gni` 的 `all_test_targets` 增加该子系统 group。
|
|
82
|
+
2. **BUILD.gn**:动态 `ohos_js_app_suite` + `test_hap = true`;静态 `ohos_js_app_static_suite` + `# test_hap = true`;`hap_name` 按仓用 `Acts`/`Hits` 前缀;`part_name`/`subsystem_name` 与 `bundle.json` 一致;`certificate_profile` 指向存在的 p7b。
|
|
83
|
+
3. **module.json5**:`extensionAbilities[]` 不允许 `process`;需要独立进程用 `extensionProcessMode`(`bundle|type|instance`)。`process` 只能写在 `abilities[]` 下。
|
|
84
|
+
4. **Test.json**:`test-file-name` 与 `hap_name.hap` 一致;`bundle-name` 与 `AppScope/app.json5` 一致;`module-name` 动态=`entry_test`、静态=`entry`,与 module.json5 的 `module.name` 一致。
|
|
85
|
+
5. **syscap.json**:动态检查 `entry/src/ohosTest/syscap.json`,静态检查 `entry/src/main/syscap.json`;`custom[].xts` 至少包含被测 API 的 `@syscap`(如 `SystemCapability.Ability.AbilityRuntime.Core`)。
|
|
86
|
+
6. **oh-package.json5**:动态 `@ohos/hypium-dynamic`、静态 `@ohos/hypium-static`,路径指向 `file:../../../../../tools/hypium_prepare/*.har`;`modelVersion` 与 hvigor 代际匹配(门禁 26.x → `26.0.0`)。
|
|
87
|
+
7. **build-profile.json5**:API ≥26 时 `compileSdkVersion`/`compatibleSdkVersion` 用字符串(如 `"26.1.0"`/`"26.0.0"`),<26 用数字;静态加 `arkTSVersion: "1.2"`;`runtimeOS: "OpenHarmony"`;建议开 `strictMode.caseSensitiveCheck`。
|
|
88
|
+
8. **代码**:动态用 `rpc.MessageParcel`,静态用 `rpc.MessageSequence`;`parameters` 先判空;禁止 `globalThis`;静态用 `int`/`long`,回调按 `AsyncCallback<T>` 推断;`@tc.number` 唯一;清理用 `try/finally`。
|
|
89
|
+
9. **接口**:新接口的 callback/Promise 重载必须由 `interface/sdk-js` 按 spec 提供;测试保留 spec 要求的用例,不要为了本地编译删掉。接口未合入前,门禁必挂。
|
|
90
|
+
10. **禁止预编译二进制**:工程内不得携带 `.hsp`、`.hap`、`.har`、`.so`、`.abc`、`.jar` 等预编译产物;所有模块必须在门禁中从源码编译。HSP 依赖必须改为源码模块,不能把现成 HSP 塞进工程。
|
|
91
|
+
|
|
92
|
+
## 工作流 C:提交前检查
|
|
93
|
+
|
|
94
|
+
完整清单见 `references/pre-submit-checklist.md`。最少执行:
|
|
95
|
+
|
|
96
|
+
```powershell
|
|
97
|
+
python scripts\check_xts_project.py <suite_dir>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
检查器覆盖:BUILD.gn 模板/test_hap/hap_name/part、module.json5 `process`/`extensionProcessMode`、Test.json 名称一致性、syscap、hypium har、compileSdkVersion 类型、动态/静态 RPC 类型、`parameters` 判空、`globalThis`、`@tc.number` 重复、大小写敏感 import、父 group 注册、构建残留。
|
|
101
|
+
|
|
102
|
+
再按顺序跑:
|
|
103
|
+
|
|
104
|
+
1. `python .../ohos-test-xts-code-quality/scripts/main.py <suite> --level all --sta-mode dyn|sta`
|
|
105
|
+
2. `python .../ohos-test-arkts-xts-generation/scripts/validate_test.py <test_file>`
|
|
106
|
+
3. **在 WSL 内**跑动态门禁命令 + 静态近似命令,确认 HAP 产物
|
|
107
|
+
4. `git status`:不得提交 `oh_modules/`、`build/`、`.hvigor/`、`local.properties`、`oh-package-lock.json5`
|
|
108
|
+
|
|
109
|
+
## 门禁专属失败速查
|
|
110
|
+
|
|
111
|
+
Windows 本地编过、门禁却失败的常见原因:
|
|
112
|
+
|
|
113
|
+
| 现象 | 根因 | 修复 |
|
|
114
|
+
|------|------|------|
|
|
115
|
+
| `Schema validate failed ... extensionAbilities[0] ... process` | extensionAbilities 不支持 `process` | 删除;用 `extensionProcessMode` |
|
|
116
|
+
| `Expected N arguments, got M`(某个 API 调用) | 接口缺 spec 要求的重载,或测试用了 SDK 没有的签名 | 对照 `interface/sdk-js` 与 spec;接口补齐后再编,不要删用例 |
|
|
117
|
+
| `XxxRemoteObject is not assignable to RemoteObject` | 动态工程用了静态 RPC 类型 | 动态改 `MessageParcel`;静态用 `MessageSequence` |
|
|
118
|
+
| `'data.parameters' is possibly 'undefined'` | 新 SDK 中 `parameters` 可选 | 先判空再取 |
|
|
119
|
+
| `arkts-no-globalthis` | ArkTS 禁止 globalThis | 删除,改用 AppStorage/参数 |
|
|
120
|
+
| `spawn .../node ENOENT` | SDK 无 `ets/build-tools/ets-loader` | 用 26.1.0.27+ 或建兼容链接 |
|
|
121
|
+
| `spawn java ENOENT` | 无 JDK | 装 JDK 17 / 指 DevEco jbr |
|
|
122
|
+
| 静态 `Double` vs `Int` | hilog domain/参数用了 `number` | 改 `int` |
|
|
123
|
+
| 静态 `CommonEventSubscriber \| undefined` | 联合类型未收窄 | 取本地常量后判空 |
|
|
124
|
+
| 静态回调 `No matching call signature` | 显式写死 `AsyncCallback` 参数 | 用类型推断的回调,并补齐两个参数 |
|
|
125
|
+
| 静态 `Double` vs `Long` | connectionId 用了 `number` | 改 `long` |
|
|
126
|
+
| 门禁没编你的 suite | BUILD.gn 未注册/part 不在产品 | 父 group + `test_targets.gni` + part 核对 |
|
|
127
|
+
| system API 用例提交到 acts / 用 Acts 前缀 | 选错仓/命名 | 改提交 HITS 仓;`Hits` 前缀 + 系统签名 |
|
|
128
|
+
| 工程内出现 `.hsp`/`.hap`/`.har`/`.so` 等 | 携带预编译二进制,门禁禁止 | 删除;改为源码模块由门禁编译 |
|
|
129
|
+
|
|
130
|
+
更多错误原文与修复见 `references/gate-error-catalog.md`。
|
|
131
|
+
|
|
132
|
+
## 文件地图
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
xts-gate-windows/
|
|
136
|
+
SKILL.md
|
|
137
|
+
references/
|
|
138
|
+
windows-gate-build.md # Windows/WSL 门禁工具链、命令、坑位
|
|
139
|
+
project-completion.md # BUILD.gn/配置/代码/注册完整规则
|
|
140
|
+
pre-submit-checklist.md # 上库前逐项检查
|
|
141
|
+
system-api-hits.md # system API:HITS 仓、Hits 命名、系统签名(闭源仓不推测)
|
|
142
|
+
gate-error-catalog.md # 门禁错误原文 → 根因 → 修复
|
|
143
|
+
scripts/
|
|
144
|
+
check_xts_project.py # 零依赖工程检查器(Windows/WSL 均可)
|
|
145
|
+
run-gate-build.sh # WSL 内门禁编译
|
|
146
|
+
run-gate-build.ps1 # Windows 侧调用 WSL 的包装
|
|
147
|
+
templates/
|
|
148
|
+
BUILD.gn.dynamic / BUILD.gn.static
|
|
149
|
+
Test.json
|
|
150
|
+
module.json5.snippet
|
|
151
|
+
local.properties.example
|
|
152
|
+
hvigor-config.json5.example
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 验证状态
|
|
156
|
+
|
|
157
|
+
- 2026-11-26 在一对真实动态/静态 XTS suite 上验证:
|
|
158
|
+
- WSL + 门禁 hvigor 6.26.21 + node 18.20.1:动态 `BUILD SUCCESSFUL`。
|
|
159
|
+
- WSL + 本地 hvigor 5.14.2:静态 `BUILD SUCCESSFUL`(近似,门禁 `7.26.0.static` 无公开包)。
|
|
160
|
+
- Windows 路线由门禁脚本反推(同一 hvigor JS/命令),本会话未做 Windows 字节级对照;门禁复核优先 WSL。
|
|
161
|
+
|
|
162
|
+
## 不要做
|
|
163
|
+
|
|
164
|
+
- 不要用 Windows 原生 hvigor/DevEco 编完就认为门禁会过;编译结论必须在 WSL + Linux 工具链内产生。
|
|
165
|
+
- 不要把 system API 用例放进 acts,或把普通 API 放进 HITS;不要猜测闭源 HITS 仓的构建命令。
|
|
166
|
+
- 不要在工程里放预编译 `.hsp`/`.hap`/`.har`/`.so` 等二进制;所有模块必须门禁源码编译。
|
|
167
|
+
- 不要为了让本地编过而删掉 spec 要求的用例或重载。
|
|
168
|
+
- 不要用 junction/symlink 的 SDK 根目录(node/es2panda realpath 会报 `F0019`);用真实目录或硬链接镜像。
|
|
169
|
+
- 不要把 `process` 写到 `extensionAbilities`;不要提交构建残留。
|
|
170
|
+
- 不要在 Windows 大小写不敏感的文件系统上假设 import 路径正确;用检查器的大小写检查。
|
package/install.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
const SKILL_NAME = 'xts-gate-windows';
|
|
9
|
+
const ENTRIES = ['SKILL.md', 'README.md', 'PUBLISH_NOTE.md', 'LICENSE', 'references', 'scripts', 'templates'];
|
|
10
|
+
|
|
11
|
+
function usage() {
|
|
12
|
+
console.log(`Usage:
|
|
13
|
+
npx -y ${SKILL_NAME}@latest install [--dest <skills-dir>]
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
--dest <dir> Claude Code skills directory (default: ~/.claude/skills)
|
|
17
|
+
-h, --help Show this help
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
npx -y ${SKILL_NAME}@latest install
|
|
21
|
+
npx -y ${SKILL_NAME}@latest install --dest D:\\claude-skills`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function copyRecursive(src, dst) {
|
|
25
|
+
const st = fs.statSync(src);
|
|
26
|
+
if (st.isDirectory()) {
|
|
27
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
28
|
+
for (const name of fs.readdirSync(src)) {
|
|
29
|
+
copyRecursive(path.join(src, name), path.join(dst, name));
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
|
34
|
+
fs.copyFileSync(src, dst);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function main() {
|
|
38
|
+
const args = process.argv.slice(2);
|
|
39
|
+
if (args.includes('-h') || args.includes('--help')) {
|
|
40
|
+
usage();
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
const command = args.length > 0 && !args[0].startsWith('-') ? args[0] : 'install';
|
|
44
|
+
if (command !== 'install') {
|
|
45
|
+
console.error(`Unknown command: ${command}`);
|
|
46
|
+
usage();
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let skillsDir = process.env.CLAUDE_SKILLS_DIR || path.join(os.homedir(), '.claude', 'skills');
|
|
51
|
+
const destIdx = args.indexOf('--dest');
|
|
52
|
+
if (destIdx >= 0) {
|
|
53
|
+
if (!args[destIdx + 1]) {
|
|
54
|
+
console.error('--dest requires a directory');
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
skillsDir = args[destIdx + 1];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const target = path.join(skillsDir, SKILL_NAME);
|
|
61
|
+
fs.mkdirSync(target, { recursive: true });
|
|
62
|
+
for (const entry of ENTRIES) {
|
|
63
|
+
const src = path.join(__dirname, entry);
|
|
64
|
+
if (fs.existsSync(src)) {
|
|
65
|
+
copyRecursive(src, path.join(target, entry));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
console.log(`Installed ${SKILL_NAME} to: ${target}`);
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log('Next:');
|
|
72
|
+
console.log(' 1. Open a new Claude Code session.');
|
|
73
|
+
console.log(` 2. Ask Claude to use the "${SKILL_NAME}" skill for your XTS suite.`);
|
|
74
|
+
console.log(` 3. Read ${path.join(target, 'SKILL.md')} for the WSL gate build and pre-submit checklist.`);
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
process.exit(main());
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xts-gate-windows",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Claude Code skill for OpenHarmony XTS gate builds on a Windows host via WSL with the Linux gate toolchain, plus XTS pre-submit checks (acts/HITS, BUILD.gn, Test.json, syscap, binaries).",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"bin": {
|
|
7
|
+
"xts-gate-windows": "install.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"SKILL.md",
|
|
11
|
+
"README.md",
|
|
12
|
+
"PUBLISH_NOTE.md",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"references/",
|
|
15
|
+
"scripts/",
|
|
16
|
+
"templates/",
|
|
17
|
+
"install.js"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=14.0.0"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"registry": "https://registry.npmjs.org",
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"claude-code",
|
|
28
|
+
"claude-skill",
|
|
29
|
+
"openharmony",
|
|
30
|
+
"xts",
|
|
31
|
+
"hvigor",
|
|
32
|
+
"wsl",
|
|
33
|
+
"gate",
|
|
34
|
+
"acts",
|
|
35
|
+
"hits"
|
|
36
|
+
]
|
|
37
|
+
}
|