(转) xcodebuild和xcrun自动化编译ipa包 笔记
生活随笔
收集整理的這篇文章主要介紹了
(转) xcodebuild和xcrun自动化编译ipa包 笔记
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉自:http://blog.csdn.net/totogo2010/article/details/8883100
打包過程
xcodebuild負責將工程源文件編譯成xxx.app
xcrun負責給xxx.app(簽名并)打包成xxx.ipa
?
第一步清理:xcodebuild ?clean
第二步編譯:xcodebuild
第三步打包:xcrun -sdk iphoneos PackageApplication -v path/To/xxx.app -o xxx.ipa
?
bash shell入門:
http://www.aka.org.cn/Lectures/002/Lecture-2.1.2/index.html
?
使用getopts命令使用
:表示有參數需要值
#!/bin/bash while getopts h:ms option do case "$option" inh)echo "option:h, value $OPTARG"echo "next arg index:$OPTIND";;m)echo "option:m"echo "next arg index:$OPTIND";;s)echo "option:s"echo "next arg index:$OPTIND";;\?)echo "Usage: args [-h n] [-m] [-s]"echo "-h means hours"echo "-m means minutes"echo "-s means seconds"exit 1;;esac done
在使用getopts命令的時候,shell會自動產生兩個變量OPTIND和OPTARG。OPTIND初始值為1,其含義是下一個待處理的參數的索引。只要存在,getopts命令返回true,所以一般getopts命令使用while循環;
在while循環中判斷?
if getopts $param_pattern optname ;thenecho "Error argument value for option $tmp_optname"exit 2fi可以判斷參數值是否是下個參數名稱,如果是,就退出
#判斷輸入參數是否大與0 if [ $# -lt 1 ];thenecho "Error! Should enter the root directory of xcode project after the ipa-build command."exit 2 fi#判斷第一個參數是否是目錄 if [ ! -d $1 ];thenecho "Error! The first param must be a directory."exit 2 fi
xcodebuild使用:
sage: xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [<buildsetting>=<value>]... [<buildaction>]...xcodebuild -workspace <workspacename> -scheme <schemeName> [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [<buildsetting>=<value>]... [<buildaction>]...xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]]xcodebuild -showsdks Options:-usage print full usage-verbose provide additional status output-project NAME build the project NAME-target NAME build the target NAME-alltargets build all targets-workspace NAME build the workspace NAME-scheme NAME build the scheme NAME-configuration NAME use the build configuration NAME for building each target-xcconfig PATH apply the build settings defined in the file at PATH as overrides-arch ARCH build each target for the architecture ARCH; this will override architectures defined in the project-sdk SDK use SDK as the name or path of the base SDK when building the project-parallelizeTargets build independent targets in parallel-jobs NUMBER specify the maximum number of concurrent build operations-showsdks display a compact list of the installed SDKs-list lists the targets and configurations in a project, or the schemes in a workspace-find BINARY display the full path to BINARY in the provided SDK-version display the version of Xcode; with -sdk will display info about one or all installed SDKs
轉載于:https://www.cnblogs.com/greywolf/p/3459589.html
總結
以上是生活随笔為你收集整理的(转) xcodebuild和xcrun自动化编译ipa包 笔记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Listary-不仅仅是快速检索文件
- 下一篇: golang小程序试验(二)