博客> 123
123
2019-12-15 22:24 评论:0 阅读:268 深山野猪
ios

buildConfig="Release" #编译的方式,有Release,Debug,自定义的AdHoc等

########################################################################################## ##############################以下部分为自动生产部分,不需要手动修改############################ ########################################################################################## projectName=find . -name *.xcodeproj | awk -F "[/.]" '{print $(NF-1)}' #项目名称 target_name="NetArchitecture"
workspace_name="${target_name}.xcworkspace" scheme="$target_name"
ExportOptionsPlistPath="./ExportOptions.plist"

scheme_name="NetArchitecture"

强制删除旧的文件夹

rm -rf ./$scheme_name-IPA

指定输出ipa路径

export_path=./$scheme_name-IPA

指定输出归档文件地址

export_archive_path="$export_path/$scheme_name.xcarchive"

指定输出ipa地址

export_ipa_path="$export_path"

projectDir=pwd #项目所在目录的绝对路径

buildAppToDir=$projectDir/build #编译打包完成后.app文件存放的目录

isWorkSpace=true #判断是用的workspace还是直接project,workspace设置为true,否则设置为false

echo "~~~~~开始编译~~~~~"

###############进入项目目录 cd $projectDir

rm -rf ./build

buildAppToDir=$projectDir/build #编译打包完成后.app文件存放的目录

###############获取版本号,bundleID infoPlist="$projectDir/NetArchitecture/Info.plist"

bundleVersion=/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $infoPlist bundleIdentifier=/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" $infoPlist bundleBuildVersion=/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $infoPlist ###############开始编译app echo "版本信息" echo $bundleVersion echo $bundleIdentifier

echo $bundleBuildVersion

echo $projectName  

echo -workspace
security unlock-keychain -p "103503" ~/Library/Keychains/login.keychain
echo "~~~~~~~~~~~~~~~~~~~pod install~~~~~~~~~~~~~~~~~~~"

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

    #第一次执行了pod之后就不用再次执行了
#pod install --verbose --no-repo-update  
echo  "开始编译workspace...." 

xcodebuild archive -workspace "$workspace_name" -scheme "$scheme" -configuration $buildConfig -archivePath $export_archive_path

echo "~~~~~~~~~~~~~~~~~~~ 编译完成~~~~~~~~~~~~~~~~~~~"

echo "~~~~~~~~~~~~~~~~~~~ 开始打包~~~~~~~~~~~~~~~~~~~"

appDir=$projectDir/  #app所在路径
echo "开始打包$projectName.app成$projectName.ipa....."

echo "打包地址$export_archive_path"
echo "输出地址$export_ipa_path"

xcodebuild -exportArchive -archivePath $export_archive_path -exportPath $export_ipa_path -exportOptionsPlist $ExportOptionsPlistPath CODE_SIGN_IDENTITY="xxxx" PROVISIONING_PROFILE="xxxx"
收藏
0
sina weixin mail 回到顶部