#!/bin/bash # shellcheck disable=SC2154 set -x for i in "$@"; do if [[ $i = *"="* ]]; then eval "$i" fi done cur_dir=$(cd $(dirname $0); pwd) share_dir=$cur_dir/.. root_dir=/Volumes/ProjectDisk/www/arpg if [[ "$uploadDir" != "" ]]; then root_dir=$uploadDir fi www_dir=$root_dir/ios unity_app="/Applications/Unity/Unity.app/Contents/MacOS/Unity" build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph.asset" arpg_cli_dir=$share_dir/../pandora_cli_proj arpg_pro_dir=$arpg_cli_dir/pandora if [ "$publishChannel" == "" ]; then publishChannel="ios_oversea" fi if [ "$isUsingNewAB" == "true" ]; then build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph_new.asset" fi buid_name=arpg_${publishChannel}_${version}_$(date "+%Y%m%d_%H%M%S") output_dir=$share_dir/../build/ios log_dir=$output_dir/../log/ios ###################### xcode build setting ########################## plist_path=$share_dir/MacBuild/InternalExportOptions.plist sign_profile_identity="bbd88fff-a466-4b9c-8470-bcb343882365" code_sign_identity_str="Apple Development: 文凯 刘 (989ZP8BU2Z)" bundle_identifier="com.herogame.ios.redtide2test" develop_team="D5HXNDDEM4" build_destination="generic/platform=iOS,name=Any iOS Device" ##################### xcode build setting ########################### outpath=$output_dir if [ ! -d "$output_dir" ]; then mkdir "$output_dir" else rm -rf "$output_dir" mkdir "$output_dir" fi if [ ! -d "$log_dir" ]; then mkdir "$log_dir" fi cd "$arpg_cli_dir" || exit # svn cleanup --remove-unversioned # svn revert --depth=infinity . # svn update python "$arpg_cli_dir/../arpg_share_proj/MacBuild/build_generate_common.py" debug="$debug" version="$version" disableLog="$disableLog" versionIP="${versionIP}" gameIP="$gameIP" lang="$lang" maintenanceIP="$maintenanceIP" mode="$mode" publishChannel=$publishChannel killall Unity $unity_app -quit -batchmode -projectPath "$arpg_pro_dir" -logFile "$log_dir/$buid_name".log -executeMethod XAsset.Build.AssetBuildScript.RunBuild version="$version" channel="$channel" outpath="$outpath" development="$development" versionIP="$versionIP" lang="$lang" buildNumber="$buildNumber" rebuildBundle="$rebuildBundle" mode="$mode" target="$target" publishChannel=$publishChannel graph=$build_graph thinkingAnalyticsMode="$thinkingAnalyticsMode" ret=$? echo "build xcode project ret:${ret}" if [ $ret != 0 ]; then cat "$log_dir/$buid_name.log" exit $ret fi # resources=$arpg_cli_dir/arpg/Assets/RawResources # svn add $resources/*.meta --force # svn commit $resources -m "builder commit" ui="$arpg_cli_dir/arpg/Assets/RawResources/UI" svn add "$ui"/*.meta --force svn commit "$ui" -m "builder commit sprite tag" ui2="$arpg_cli_dir/arpg/Assets/RawResources/UI2" svn add "$ui2"/*.meta --force svn commit "$ui2" -m "builder commit sprite tag" cd "$outpath" || exit echo "faselane xcode setting" fastlane run update_code_signing_settings path:"./Unity-iPhone.xcodeproj" team_id:"$develop_team" bundle_identifier:"$bundle_identifier" code_sign_identity:"$code_sign_identity_str" profile_uuid:"$sign_profile_identity" targets:"Unity-iPhone" use_automatic_signing:false ret=$? if [ $ret != 0 ]; then exit $ret fi echo "faselane setting success." if [ "$buildType" == "内部测试包" ]; then ###################### 导出内部包 ########################## echo "export internal dev ipa." security unlock-keychain -p "123456" ~/Library/Keychains/login.keychain echo "xcode build" xcodebuild archive -project Unity-iPhone.xcodeproj -scheme Unity-iPhone platform=iOS -UseModernBuildSystem=YES -destination "$build_destination" -archivePath bin/Unity-iPhone.xcarchive ret=$? if [ $ret != 0 ]; then exit $ret fi echo "xcode build success." echo "export ipa." xcodebuild -exportArchive -exportOptionsPlist "$plist_path" -archivePath bin/Unity-iPhone.xcarchive -exportPath bin/ ret=$? if [ $ret != 0 ]; then exit $ret fi echo "export ipa success." # rm -rf *.ipa scp "$outpath/bin/EternalEvolution.ipa" "$www_dir/internal/${buid_name}_internal.ipa" if [ "$push_message" == "true" ]; then curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=228f1071-048b-479a-b250-3d22f2b92425' \ -H 'Content-Type: application/json charset=UTF-8"' \ -d "{\"msgtype\":\"markdown\", \"markdown\":{\"content\":\"## iOS新版本\\n[${buid_name}_internal.ipa](http://192.168.1.245/arpg/ios/internal/${buid_name}_internal.ipa)\"}}" fi else ################### 导出强制开启Debug的内部包 ################### debugOutpath="${output_dir}_debug" env_file_path="$debugOutpath/Data/Raw/Lua/Const/Env.lua" cp -r "$outpath" "$debugOutpath" cd "$debugOutpath" || exit cat>"$env_file_path"<