自习室优化ok

This commit is contained in:
zhutao
2025-11-28 13:31:23 +08:00
parent 4ecb0c35d6
commit 57305c5804
57 changed files with 2500 additions and 597 deletions

26
build.prod.sh Normal file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
#当前执行目录
current_dir=$(pwd)
channelPath="$current_dir/build/app/outputs/apk/release"
mkdir -p "$channelPath"
rm -rf "$channelPath"/*
#定义环境变量和 Android 设备品牌
declare -a APP_CHANNELS=("release")
# 遍历每个环境配置并执行构建
for index in "${APP_CHANNELS[@]}"; do
ENV=${APP_CHANNELS[$index]}
flutter build apk -Penv=prod -Pchannel=$ENV
# 检查构建是否成功
if [ $? -ne 0 ]; then
echo "Build failed for ENV=$ENV"
exit 1
fi
apkFile=$(find $(pwd)/build/app/outputs/apk/release/ -name "*.apk" -print -quit)
# 获取 .apk 文件的文件名
apkFileName=$(basename "$apkFile")
mv $apkFile "$channelPath/$apkFileName"
done
echo "All builds completed successfully."