#!/bin/sh
# Created by ZCD on 2017/09/21.
# Copyright © 2017年 ZCD. All rights reserved.
#注意:变量赋值的时候=号之间不能有空格
workspace="TargetName.xcworkspace"
scheme="TargetName"
#桌面路径
desktop="${HOME}/Desktop"
#输出路径
outputPath="${desktop}/文件名"
echo "输出路径:${outputPath}"
echo "*******************清理*******************"
xcodebuild -workspace $workspace -scheme $scheme clean
echo "*******************清理完成*******************"
编译
echo "*******************开始编译*******************"
xcodebuild -workspace $workspace -scheme $scheme -configuration "release"
echo "*******************编译成功*******************"
echo "*******************开始打包ipa*******************"
xcodebuild archive -workspace $workspace -scheme "TargetName" -archivePath "${outputPath}/TargetName.xcarchive"
xcodebuild -exportArchive -archivePath "${outputPath}/TargetName.xcarchive" -exportPath "${outputPath}" -exportOptionsPlist "TargetName/Info.plist"
rm -r -f "${outputPath}/TargetName.xcarchive"
rm -r -f "${outputPath}/DistributionSummary.plist"
rm -r -f "${outputPath}/ExportOptions.plist"
rm -r -f "${outputPath}/Packaging.log"
echo "*******************打包ipa成功*******************"