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.
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env bash
2
+ # XTS 门禁叶子编译(WSL/Linux)
3
+ #
4
+ # 用法:
5
+ # ./run-gate-build.sh --project <suite> --mode dyn|sta \
6
+ # --node-home <node18> --sdk <sdk-root> --hvigor-home <hvigor-dir> \
7
+ # [--java-home <jdk>] [--ohpm <ohpm>] [--skip-install]
8
+ #
9
+ # 说明:
10
+ # - hvigor-home 是包含 bin/hvigorw 的目录。
11
+ # - 动态用门禁 command-line-tools 的 hvigor(6.26.21)。
12
+ # - 静态优先门禁 7.26.0.static;没有则用本地 hvigor 5.14.2(会打印“近似”警告)。
13
+ # - 只在 WSL/Linux 内运行;不要在 Windows 原生 bash 里跑。
14
+ set -euo pipefail
15
+
16
+ PROJECT=""
17
+ MODE="dyn"
18
+ NODE_HOME=""
19
+ SDK_ROOT=""
20
+ HVIGOR_HOME=""
21
+ JAVA_HOME_ARG=""
22
+ OHPM=""
23
+ SKIP_INSTALL=0
24
+
25
+ usage() {
26
+ cat <<'EOF'
27
+ XTS gate leaf build (WSL/Linux)
28
+
29
+ Usage:
30
+ run-gate-build.sh --project <suite> --mode dyn|sta \
31
+ --node-home <node18> --sdk <sdk-root> --hvigor-home <hvigor-dir> \
32
+ [--java-home <jdk>] [--ohpm <ohpm>] [--skip-install]
33
+
34
+ Required:
35
+ --project suite directory (contains BUILD.gn)
36
+ --mode dyn | sta
37
+ --node-home node 18.20.1 home (contains bin/node)
38
+ --sdk SDK root (contains <version>/{ets,js,native,previewer,toolchains})
39
+ --hvigor-home directory containing bin/hvigorw
40
+
41
+ Optional:
42
+ --java-home JAVA_HOME for HAP packaging
43
+ --ohpm ohpm executable; default: <clt>/ohpm/bin/ohpm or PATH
44
+ --skip-install skip ohpm install
45
+ EOF
46
+ }
47
+
48
+ die() { echo "ERROR: $*" >&2; exit 1; }
49
+
50
+ while [[ $# -gt 0 ]]; do
51
+ case "$1" in
52
+ --project) PROJECT="$2"; shift 2 ;;
53
+ --mode) MODE="$2"; shift 2 ;;
54
+ --node-home) NODE_HOME="$2"; shift 2 ;;
55
+ --sdk) SDK_ROOT="$2"; shift 2 ;;
56
+ --hvigor-home) HVIGOR_HOME="$2"; shift 2 ;;
57
+ --java-home) JAVA_HOME_ARG="$2"; shift 2 ;;
58
+ --ohpm) OHPM="$2"; shift 2 ;;
59
+ --skip-install) SKIP_INSTALL=1; shift ;;
60
+ -h|--help) usage; exit 0 ;;
61
+ *) die "unknown argument: $1" ;;
62
+ esac
63
+ done
64
+
65
+ [[ -n "$PROJECT" ]] || die "--project is required"
66
+ [[ -d "$PROJECT" ]] || die "project not found: $PROJECT"
67
+ [[ "$MODE" == "dyn" || "$MODE" == "sta" ]] || die "--mode must be dyn or sta"
68
+ [[ -n "$NODE_HOME" && -x "$NODE_HOME/bin/node" ]] || die "node not found: $NODE_HOME/bin/node"
69
+ [[ -n "$SDK_ROOT" && -d "$SDK_ROOT" ]] || die "sdk not found: $SDK_ROOT"
70
+ [[ -n "$HVIGOR_HOME" && -x "$HVIGOR_HOME/bin/hvigorw" ]] || die "hvigorw not found: $HVIGOR_HOME/bin/hvigorw"
71
+
72
+ export DEVECO_NODE_HOME="$NODE_HOME"
73
+ export PATH="$NODE_HOME/bin:$PATH"
74
+ export OHOS_BASE_SDK_HOME="$SDK_ROOT"
75
+ if [[ -n "$JAVA_HOME_ARG" ]]; then
76
+ export JAVA_HOME="$JAVA_HOME_ARG"
77
+ export PATH="$JAVA_HOME/bin:$PATH"
78
+ fi
79
+
80
+ # 门禁 compile_app.py 会写 local.properties;这里备份/恢复,避免污染工程
81
+ LOCAL_PROPS="$PROJECT/local.properties"
82
+ BACKUP=""
83
+ if [[ -f "$LOCAL_PROPS" ]]; then
84
+ BACKUP="$(mktemp)"
85
+ cp "$LOCAL_PROPS" "$BACKUP"
86
+ fi
87
+ cleanup() {
88
+ if [[ -n "$BACKUP" && -f "$BACKUP" ]]; then
89
+ cp "$BACKUP" "$LOCAL_PROPS"
90
+ rm -f "$BACKUP"
91
+ else
92
+ rm -f "$LOCAL_PROPS"
93
+ fi
94
+ }
95
+ trap cleanup EXIT
96
+
97
+ printf 'sdk.dir=%s\n' "$SDK_ROOT" > "$LOCAL_PROPS"
98
+
99
+ if [[ "$SKIP_INSTALL" -eq 0 ]]; then
100
+ if [[ -z "$OHPM" ]]; then
101
+ # 优先同目录 command-line-tools 的 ohpm
102
+ CLT_ROOT="$(cd "$HVIGOR_HOME/.." && pwd)"
103
+ if [[ -x "$CLT_ROOT/ohpm/bin/ohpm" ]]; then
104
+ OHPM="$CLT_ROOT/ohpm/bin/ohpm"
105
+ elif command -v ohpm >/dev/null 2>&1; then
106
+ OHPM="$(command -v ohpm)"
107
+ fi
108
+ fi
109
+ if [[ -n "$OHPM" && -x "$OHPM" ]]; then
110
+ echo ">>> ohpm install ($OHPM)"
111
+ ( cd "$PROJECT" && "$OHPM" install ) || {
112
+ echo "WARN: ohpm install failed; retry with --skip-install if oh_modules is already prepared" >&2
113
+ exit 1
114
+ }
115
+ else
116
+ echo "WARN: ohpm not found; skip install (use --ohpm or prepare oh_modules manually)" >&2
117
+ fi
118
+ fi
119
+
120
+ cd "$PROJECT"
121
+ if [[ "$MODE" == "dyn" ]]; then
122
+ echo ">>> dynamic gate build"
123
+ "$HVIGOR_HOME/bin/hvigorw" --mode module -p module=entry@ohosTest assembleHap \
124
+ -p debuggable=false -p hvigor-obfuscation=false --no-daemon
125
+ HAP_DIR="entry/build/default/outputs/ohosTest"
126
+ else
127
+ echo ">>> static build (gate 7.26.0.static preferred; 5.14.2 is approximate)"
128
+ "$HVIGOR_HOME/bin/hvigorw" --mode project -p product=default assembleApp \
129
+ -p debuggable=false -p hvigor-obfuscation=false --no-daemon
130
+ HAP_DIR="entry/build/default/outputs/default"
131
+ fi
132
+
133
+ HAP="$(find "$HAP_DIR" -maxdepth 2 -name '*-unsigned.hap' -print -quit 2>/dev/null || true)"
134
+ if [[ -z "$HAP" ]]; then
135
+ echo "ERROR: no unsigned HAP under $HAP_DIR" >&2
136
+ exit 1
137
+ fi
138
+ echo "BUILD OK: $PROJECT/$HAP"
@@ -0,0 +1,13 @@
1
+ # Copy to <suite>/BUILD.gn and replace <...>.
2
+ # Dynamic (ArkTS-Dyn) suite.
3
+
4
+ import("//test/xts/tools/build/suite.gni")
5
+
6
+ ohos_js_app_suite("<Target>") {
7
+ test_hap = true
8
+ testonly = true
9
+ certificate_profile = "./signature/openharmony_sx.p7b"
10
+ hap_name = "Acts<SuiteName>"
11
+ part_name = "<part_name>"
12
+ subsystem_name = "<subsystem_name>"
13
+ }
@@ -0,0 +1,14 @@
1
+ # Copy to <suite>/BUILD.gn and replace <...>.
2
+ # Static (ArkTS-Sta / arkTSVersion 1.2) suite.
3
+ # test_hap MUST stay commented: static suites have no ohosTest target.
4
+
5
+ import("//test/xts/tools/build/suite.gni")
6
+
7
+ ohos_js_app_static_suite("<Target>") {
8
+ # test_hap = true
9
+ testonly = true
10
+ certificate_profile = "./signature/openharmony_sx.p7b"
11
+ hap_name = "Acts<SuiteName>StaticTest"
12
+ part_name = "<part_name>"
13
+ subsystem_name = "<subsystem_name>"
14
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "description": "Configuration for <suite> Tests",
3
+ "driver": {
4
+ "type": "OHJSUnitTest",
5
+ "test-timeout": "600000",
6
+ "bundle-name": "<bundleName>",
7
+ "module-name": "<entry_test | entry>",
8
+ "shell-timeout": "600000",
9
+ "testcase-timeout": "30000"
10
+ },
11
+ "kits": [
12
+ {
13
+ "test-file-name": [
14
+ "<hap_name>.hap"
15
+ ],
16
+ "type": "AppInstallKit",
17
+ "cleanup-apps": true
18
+ },
19
+ {
20
+ "type": "ShellKit",
21
+ "run-command": [
22
+ "power-shell wakeup",
23
+ "power-shell timeout -o 86400000",
24
+ "power-shell setmode 602"
25
+ ]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "modelVersion": "26.0.0", // gate hvigor 26.x; local hvigor 5.14.2 uses "6.1.1"
3
+ "dependencies": {},
4
+ "properties": {
5
+ "ohos.byteCodeHar.integratedOptimization": true
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ # WSL/Linux gate build
2
+ sdk.dir=/root/ohos-gate/sdk
3
+
4
+ # nodejs.dir is optional; gate compile_app.py writes it. For manual builds:
5
+ # nodejs.dir=/root/ohos-gate/toolchain/node-v18.20.1-linux-x64
@@ -0,0 +1,33 @@
1
+ // Put this inside "module" in the correct module.json5:
2
+ // dynamic: entry/src/ohosTest/module.json5
3
+ // static : entry/src/main/module.json5
4
+ //
5
+ // Do NOT put "process" under extensionAbilities.
6
+ // Use extensionProcessMode when the extension must run in its own process:
7
+ // bundle - same process as the app
8
+ // type - extensions of the same type share a process
9
+ // instance - one process per extension instance (usually what kill-by-pid tests need)
10
+ {
11
+ "module": {
12
+ "name": "entry",
13
+ "type": "entry",
14
+ "extensionAbilities": [
15
+ {
16
+ "name": "<ExtAbility>",
17
+ "srcEntry": "./ets/<path>/<ExtAbility>.ets",
18
+ "type": "service",
19
+ "exported": true,
20
+ "extensionProcessMode": "instance"
21
+ }
22
+ ],
23
+ "requestPermissions": []
24
+ }
25
+ }
26
+
27
+ // syscap.json (same directory as module.json5, or ohosTest for dynamic):
28
+ // {
29
+ // "devices": {
30
+ // "general": [],
31
+ // "custom": [{ "xts": ["SystemCapability.Ability.AbilityRuntime.Core"] }]
32
+ // }
33
+ // }