-
Notifications
You must be signed in to change notification settings - Fork 5
/
export_ipa.sh
executable file
·47 lines (43 loc) · 1.42 KB
/
export_ipa.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash -il
export LC_ALL=en_US.UTF-8
source ~/.bashrc
Enviroment=$1
echo ${Enviroment}
echo "-------------------------------------进入APP打包环节-------------------------------------------"
# 打包ipa
rm -rf Package
cd ./Native/YourProjectDir/
Workspace='YourApp.xcworkspace'
Scheme='YourAppScheme'
PackageDir=../../Package
ArchivePath=${PackageDir}/${Scheme}.xcarchive
ExportIpaPath=${PackageDir}/${Scheme}
ExportPlistDir=../ExportOptions
echo ${Enviroment}
if [ ${Enviroment} = "development" ] || [ ${Enviroment} = "test" ] || [ ${Enviroment} = "demo" ]; then
echo "开发环境打包"
# 打包配置文件绝对路径
ExportPlistPath=${ExportPlistDir}/DevelopmentExportOptionsPlist.plist
Configuration=`echo ${Enviroment} | perl -pe 's/.*/\u$&/'`
elif [ ${Enviroment} = "production" ]; then
echo "生产环境打包"
# 打包配置文件绝对路径
ExportPlistPath=${ExportPlistDir}/DistributionExportOptionsPlist.plist
Configuration='Release'
else
echo "替换文件失败"
exit 1
fi
echo ${Configuration}
# 编译前清理工程
xcodebuild clean -workspace ${Workspace} \
-scheme ${Scheme} \
-configuration ${Configuration}
xcodebuild archive -workspace ${Workspace} \
-scheme ${Scheme} \
-configuration ${Configuration} \
-archivePath ${ArchivePath}
xcodebuild -exportArchive \
-archivePath ${ArchivePath} \
-exportPath ${ExportIpaPath} \
-exportOptionsPlist ${ExportPlistPath}