Some checks failed
flutter analysis / check (push) Has been cancelled
- Update site title and description - Add OpenCode integration documentation - Update installation guides with custom build instructions - Update quick start guides - Update building documentation - Add build status reporting scripts - Update Chinese translations
95 lines
3.2 KiB
Bash
Executable File
95 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# 自动构建进度检查和汇报脚本 - 发送消息到 OpenClaw
|
|
|
|
REPORT_FILE="/tmp/build_progress_report.txt"
|
|
GIT_REPO="/root/.openclaw/workspace/flutter_opencode_client"
|
|
APK_OUTPUT="$GIT_REPO/build/app/outputs/flutter-apk/app-release.apk"
|
|
|
|
# 生成报告
|
|
echo "=== OpenCode Client 构建进度报告 ===" > $REPORT_FILE
|
|
echo "时间: $(date '+%Y-%m-%d %H:%M:%S')" >> $REPORT_FILE
|
|
echo "" >> $REPORT_FILE
|
|
|
|
# 检查 Flutter SDK 状态
|
|
echo "📦 Flutter SDK 状态:" >> $REPORT_FILE
|
|
if [ -f "/opt/flutter/bin/cache/dart-sdk/bin/dart" ]; then
|
|
echo " ✅ Dart SDK: 已就绪" >> $REPORT_FILE
|
|
export PATH="$PATH:/opt/flutter/bin"
|
|
cd $GIT_REPO
|
|
FLUTTER_VERSION=$(/opt/flutter/bin/flutter --version 2>/dev/null | head -1 || echo "无法获取版本")
|
|
echo " 📋 $FLUTTER_VERSION" >> $REPORT_FILE
|
|
else
|
|
echo " ⏳ Dart SDK: 下载/解压中..." >> $REPORT_FILE
|
|
if [ -f "/opt/flutter/bin/cache/dart-sdk-linux-x64.zip" ]; then
|
|
ZIP_SIZE=$(ls -lh /opt/flutter/bin/cache/dart-sdk-linux-x64.zip 2>/dev/null | awk '{print $5}')
|
|
echo " 📊 下载文件大小: $ZIP_SIZE" >> $REPORT_FILE
|
|
fi
|
|
fi
|
|
|
|
echo "" >> $REPORT_FILE
|
|
|
|
# 检查 Android SDK
|
|
echo "📱 Android SDK 状态:" >> $REPORT_FILE
|
|
if [ -d "/opt/android-sdk/platforms" ]; then
|
|
PLATFORM_COUNT=$(ls /opt/android-sdk/platforms/ 2>/dev/null | wc -l)
|
|
echo " ✅ 已安装平台: $PLATFORM_COUNT 个" >> $REPORT_FILE
|
|
else
|
|
echo " ❌ 平台未安装" >> $REPORT_FILE
|
|
fi
|
|
|
|
if [ -d "/opt/android-sdk/build-tools" ]; then
|
|
BUILD_TOOLS=$(ls /opt/android-sdk/build-tools/ 2>/dev/null | tr '\n' ', ')
|
|
echo " ✅ 构建工具: $BUILD_TOOLS" >> $REPORT_FILE
|
|
else
|
|
echo " ❌ 构建工具未安装" >> $REPORT_FILE
|
|
fi
|
|
|
|
echo "" >> $REPORT_FILE
|
|
|
|
# 检查 APK 构建状态
|
|
echo "🔨 APK 构建状态:" >> $REPORT_FILE
|
|
if [ -f "$APK_OUTPUT" ]; then
|
|
APK_SIZE=$(ls -lh $APK_OUTPUT | awk '{print $5}')
|
|
echo " ✅ APK 构建成功!" >> $REPORT_FILE
|
|
echo " 📦 文件大小: $APK_SIZE" >> $REPORT_FILE
|
|
echo " 📍 路径: $APK_OUTPUT" >> $REPORT_FILE
|
|
else
|
|
echo " ⏳ APK 尚未构建" >> $REPORT_FILE
|
|
fi
|
|
|
|
echo "" >> $REPORT_FILE
|
|
|
|
# 检查活跃进程
|
|
echo "🔄 活跃进程:" >> $REPORT_FILE
|
|
FLUTTER_PUB=$(pgrep -f "flutter.*pub.get" 2>/dev/null)
|
|
FLUTTER_BUILD=$(pgrep -f "flutter.*build" 2>/dev/null)
|
|
CURL_FLUTTER=$(pgrep -f "curl.*flutter" 2>/dev/null)
|
|
|
|
if [ -n "$FLUTTER_PUB" ]; then
|
|
echo " 📦 flutter pub get 运行中 (PID: $FLUTTER_PUB)" >> $REPORT_FILE
|
|
fi
|
|
if [ -n "$FLUTTER_BUILD" ]; then
|
|
echo " 🔨 flutter build 运行中 (PID: $FLUTTER_BUILD)" >> $REPORT_FILE
|
|
fi
|
|
if [ -n "$CURL_FLUTTER" ]; then
|
|
echo " ⬇️ Flutter SDK 下载中 (PID: $CURL_FLUTTER)" >> $REPORT_FILE
|
|
fi
|
|
|
|
if [ -z "$FLUTTER_PUB" ] && [ -z "$FLUTTER_BUILD" ] && [ -z "$CURL_FLUTTER" ]; then
|
|
echo " ⏸️ 无活跃构建进程" >> $REPORT_FILE
|
|
fi
|
|
|
|
echo "" >> $REPORT_FILE
|
|
|
|
# 检查 Git 状态
|
|
cd $GIT_REPO 2>/dev/null || true
|
|
echo "📤 Git 推送状态:" >> $REPORT_FILE
|
|
COMMIT_COUNT=$(git rev-list --count opencode/main 2>/dev/null || echo "0")
|
|
echo " 📊 远程仓库提交数: $COMMIT_COUNT" >> $REPORT_FILE
|
|
|
|
echo "" >> $REPORT_FILE
|
|
echo "⏰ 下次检查: $(date -d '+20 minutes' '+%H:%M')" >> $REPORT_FILE
|
|
|
|
# 输出报告到 stdout
|
|
cat $REPORT_FILE
|