-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_android_tests.sh
More file actions
executable file
·52 lines (40 loc) · 1.28 KB
/
Copy pathrun_android_tests.sh
File metadata and controls
executable file
·52 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# LayoutX2C Android 等价性测试运行脚本
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
if command -v adb >/dev/null 2>&1; then
if ! adb devices | awk 'NR > 1 && $2 == "device" { found = 1 } END { exit found ? 0 : 1 }'; then
echo "未检测到可用 Android 设备或模拟器。"
echo "请连接设备后重试。"
exit 1
fi
fi
echo "=========================================="
echo " LayoutX2C Android 等价性测试"
echo "=========================================="
echo ""
echo "步骤 1: 清理构建缓存..."
./gradlew :demo:clean
echo ""
echo "步骤 2: 生成 KSP 代码 (包括 DataBinding)..."
./gradlew :demo:kspDebugKotlin
echo ""
echo "步骤 3: 编译 Debug 版本..."
./gradlew :demo:assembleDebug
echo ""
echo "步骤 4: 编译测试 APK..."
./gradlew :demo:assembleDebugAndroidTest
echo ""
echo "步骤 5: 运行 Android 等价性测试..."
echo "注意: 需要连接 Android 设备或启动模拟器"
echo ""
./gradlew :demo:connectedDebugAndroidTest
echo ""
echo "=========================================="
echo " 测试完成!"
echo "=========================================="
echo ""
echo "查看测试报告:"
echo " open demo/build/reports/androidTests/connected/index.html"
echo ""