cd `dirname $0`
if[ -d build ];then
rm -f -r build
fi
build_type=Debug
project_name="需要打包的工程名"
scheme_name="工程中需要导出ipa的scheme"
archivepath=$(pwd)
build_path=${archivepath}/build
exportOptionsPlistPath=$archivepath/exportOptionsPlist.plist
exportIpaPath=$archivepath/IPADir/${build_type}
xcodebuild clean -configuration ${build_type} -quiet ||exit
xcodebuild archive -project ${archivepath}/${project_name}.xcodeproj -scheme ${scheme_name} -configuration ${build_type} -archivePath ${build_path}/${project_name}.xcarchive -quiet ||exit
echo '///--------'
echo '/// 编译完成'
echo '///--------'
echo ''
echo '///----------'
echo '/// 开始ipa打包'
echo '///----------'
xcodebuild -exportArchive -archivePath ${build_path}/${project_name}.xcarchive \
-configuration ${build_type} \
-exportPath ${exportIpaPath} \
-exportOptionsPlist ${exportOptionsPlistPath} -quiet ||exit
if[ -e $exportIpaPath/$scheme_name.ipa ];
then
echo '///----------'
echo '/// ipa包已导出'
echo '///----------'
open $exportIpaPath
else
echo '///-------------'
echo '/// ipa包导出失败 '
echo '///-------------'
fi
echo '///------------'
echo '/// 打包ipa完成 '
echo '///-----------='
if[[ ! -d ./IPADir ]];then
echo '打包失败'
exit 0
fi
exit 0
网友评论