2024-06-12 15:01:54 +08:00
|
|
|
##!/bin/bash
|
|
|
|
SHELL_DIR=$(dirname $0)
|
|
|
|
echo "change dir to $SHELL_DIR"
|
|
|
|
cd "$SHELL_DIR"
|
|
|
|
|
|
|
|
# Source the local environment
|
|
|
|
if [ -f ./local_env.sh ]; then
|
|
|
|
source ./local_env.sh
|
|
|
|
echo "found the local_env file"
|
|
|
|
fi
|
|
|
|
|
2024-07-31 16:37:34 +08:00
|
|
|
# 获取项目相关参数
|
|
|
|
if [ -f ./project_env.sh ]; then
|
|
|
|
source ./project_env.sh
|
|
|
|
echo "found the project_env file"
|
|
|
|
fi
|
|
|
|
|
2024-06-12 15:01:54 +08:00
|
|
|
VERSION="$1"
|
|
|
|
PROFILE="$2"
|
|
|
|
ARTIFACT_URL="$3"
|
|
|
|
ENABLE_HOT_UPDATE="$4"
|
|
|
|
PLATFORM="$5"
|
|
|
|
CLEARCACHED="$6"
|
|
|
|
DEVELPOMENT_BUILD="$7"
|
|
|
|
CHANNEL="$8"
|
|
|
|
AAB="$9"
|
|
|
|
|
|
|
|
|
2024-07-31 16:37:34 +08:00
|
|
|
echo "version="$VERSION", profile="$PROFILE", PLATFORM="$PLATFORM""
|
|
|
|
echo "ARTIFACT_URL="$ARTIFACT_URL", ENABLE_HOT_UPDATE="$ENABLE_HOT_UPDATE""
|
|
|
|
echo "CLEARCACHED="$CLEARCACHED", DEVELPOMENT_BUILD = "$DEVELPOMENT_BUILD""
|
|
|
|
echo "AAB="$AAB", PROJECT_NAME="$PROJECT_NAME""
|
|
|
|
echo "BUILD_NAME="$BUILD_NAME", APP_NAME="$APP_NAME""
|
2024-06-12 15:01:54 +08:00
|
|
|
|
|
|
|
# Set the build folder and name
|
|
|
|
BUILD_FOLDER_FROM_ASSET="../Builds/$PLATFORM/$VERSION" #相对assets路径
|
|
|
|
BUILD_FOLDER="../../Builds/$PLATFORM/$VERSION" #相对脚本路径
|
|
|
|
|
|
|
|
EXECUTE_METHOD="BatchBuild.BuildContentAndPlayer"
|
|
|
|
LOG_FILE="$BUILD_FOLDER/build.log" # 相对脚本路径
|
|
|
|
|
|
|
|
EXECUTE_SETTING_METHOD="BatchBuild.ApplyPlayerSetting"
|
|
|
|
|
|
|
|
echo "Start apply setting ... ... "
|
|
|
|
|
2024-07-31 16:37:34 +08:00
|
|
|
"$UNITY_PATH" -quit -batchmode -projectPath "../../$PROJECT_NAME" -executeMethod "$EXECUTE_SETTING_METHOD" \
|
2024-06-12 15:01:54 +08:00
|
|
|
-platform "$PLATFORM" \
|
|
|
|
-appVersion "$VERSION" \
|
|
|
|
-buildName "$BUILD_NAME" \
|
|
|
|
-profile "$PROFILE" \
|
|
|
|
-outpath "$BUILD_FOLDER_FROM_ASSET" \
|
|
|
|
-appName "$APP_NAME" \
|
|
|
|
-clearCached "$CLEARCACHED" \
|
|
|
|
-enableHotUpdate "$ENABLE_HOT_UPDATE" \
|
|
|
|
-developmentBuild "$DEVELPOMENT_BUILD" \
|
|
|
|
-channel "$CHANNEL" \
|
|
|
|
-aab "$AAB"
|
|
|
|
|
|
|
|
echo "build folder is: "$BUILD_FOLDER" , log is : "$LOG_FILE" , Start building ... ... "
|
|
|
|
|
2024-07-31 16:37:34 +08:00
|
|
|
"$UNITY_PATH" -quit -batchmode -projectPath "../../$PROJECT_NAME" -executeMethod "$EXECUTE_METHOD" \
|
2024-06-12 15:01:54 +08:00
|
|
|
-platform "$PLATFORM" \
|
|
|
|
-appVersion "$VERSION" \
|
|
|
|
-buildName "$BUILD_NAME" \
|
|
|
|
-profile "$PROFILE" \
|
|
|
|
-outpath "$BUILD_FOLDER_FROM_ASSET" \
|
|
|
|
-appName "$APP_NAME" \
|
|
|
|
-clearCached "$CLEARCACHED" \
|
|
|
|
-enableHotUpdate "$ENABLE_HOT_UPDATE" \
|
|
|
|
-developmentBuild "$DEVELPOMENT_BUILD" \
|
|
|
|
-channel "$CHANNEL" \
|
|
|
|
-aab "$AAB" \
|
|
|
|
-logFile "$LOG_FILE"
|
|
|
|
|
|
|
|
build_result=$?
|
|
|
|
|
|
|
|
if [ $build_result -ne 0 ]; then
|
2024-07-31 16:37:34 +08:00
|
|
|
echo "【$APP_NAME】【"$PLATFORM"】【"$VERSION"】 build failed. Check the log for details."
|
|
|
|
sh to_inner_wechat_robot.sh "【$APP_NAME】【$PLATFORM】【$VERSION】【$PROFILE】Failed to build"
|
2024-06-12 15:01:54 +08:00
|
|
|
sh collect_and_send_error.sh $LOG_FILE
|
|
|
|
exit 1
|
|
|
|
else
|
2024-07-31 16:37:34 +08:00
|
|
|
echo "【$APP_NAME】【"$PLATFORM"】【"$VERSION"】Unity build successful."
|
2024-06-12 15:01:54 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# upload remote resource to server
|
|
|
|
#sh upload_to_server.sh "$PLATFORM" "$VERSION"
|
|
|
|
|
|
|
|
SYMBOL_FILE="$BUILD_FOLDER/$BUILD_NAME-$VERSION-v1-IL2CPP.symbols" # 相对脚本路径
|
|
|
|
|
|
|
|
unzip "$SYMBOL_FILE".zip -d "$SYMBOL_FILE"
|
|
|
|
|
|
|
|
java -jar crashSightSymbolTool.jar \
|
|
|
|
-i "$BUILD_FOLDER" \
|
|
|
|
-version "$VERSION" \
|
|
|
|
-p aos \
|
|
|
|
-m win \
|
|
|
|
-u -url https://api.crashsight.qq.com/openapi/file/upload/symbol \
|
|
|
|
-id 669a94ce69 \
|
|
|
|
-key d9412717-2416-4270-b8bc-f7a0805f988f
|
|
|
|
|
|
|
|
upload_result=$?
|
|
|
|
|
|
|
|
if [ $upload_result -eq 0 ]; then
|
|
|
|
echo "Symbol table upload CrashSight successfully!"
|
|
|
|
|
|
|
|
else
|
|
|
|
echo "Symbol table upload CrashSight failed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf "$SYMBOL_FILE"
|