帶{}都是需要自己填寫(xiě)的大磺,例如{shell所在路徑}改成/Users/iosdemac/Desktop/AutoScript
1杠愧、腳本1
##!/bin/sh
# 工程絕對(duì)路徑 (這里注意是shell腳本所在的路徑)
project_path=$(cd "{shell所在路徑}";pwd)
# 工程名
project_name = {your project name}
# Scheme名
project_scheme = {your scheme name}
# 編譯模式 Release|Debug
build_type = {Debug}
# workspace名
project_workspace = {your workspace path}
# archive_path自己設(shè)置的文件存放路徑 eg:$project_path/$project_name.xcarchive
archive_path = {your archive path}
# ipa自己設(shè)置的文件存放路徑 eg:$project_path/$project_name.ipa
export_ipa_path = {your export ipa path}
# exportOptions plist eg:$project_path/ExportOptions.plist
export_options_plist = {your export options plist} 從手動(dòng)打包的文件夾里面拖拽出來(lái)ExportOptions.plist
2锐锣、腳本2
echo "--------------------------------------------------------------------------------"
echo "Please enter the number you want to export ? [ 1:app-store 2:ad-hoc 3:develop ] "
echo "--------------------------------------------------------------------------------"
read number
while [[ $number != 1 ]] && [[ $number != 2 ]] && [[ $number != 3 ]]; do
#statements
echo "Error! Should enter 1 or 2 or 3"
echo "Please enter the number you want to export ? [ 1:app-store 2:ad-hoc 3:develop ] "
read number
done
if [[ $number == 1 ]]; then
build_type=Release
export_options_plist = {project_path/ExportOptions_appstore.plist}
elif [[ $number == 2 ]]; then
build_type=Release
export_options_plist = {project_path/ExportOptions_adhoc.plist}
else
build_type=Debug
export_options_plist = {project_path/ExportOptions_dev.plist}
fi
3雕憔、腳本3
echo "http:///-----------"
echo "http:/// 正在清理工程"
echo "http:///-----------"
xcodebuild clean -workspace {project_workspace項(xiàng)目絕對(duì)路徑} -scheme {project_scheme} -configuration {build_type} -quiet || exit
echo "http:///-----------"
echo "http:/// 正在編譯工程: ${build_type:Debug|Release}"
echo "http:///-----------"
xcodebuild archive -workspace {project_workspace} -scheme {project_scheme} -configuration {build_type} -archivePath {archive_path存放路徑} || exit
echo "http:///-----------"
echo "http:/// 開(kāi)始導(dǎo)出ipa: ${export_ipa_path}"
echo "http:///-----------"
xcodebuild -exportArchive -archivePath {archive_path} -exportPath {export_ipa_path} -exportOptionsPlist {export_options_plist} -quiet || exit