转自: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" in
h)
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 ;then
echo "Error argument value for option $tmp_optname"
exit 2
fi

可以判断参数值是否是下个参数名称,如果是,就退出

#判断输入参数是否大与0
if [ $# -lt 1 ];then
echo "Error! Should enter the root directory of xcode project after the ipa-build command."
exit 2
fi #判断第一个参数是否是目录
if [ ! -d $1 ];then
echo "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

  

(转) xcodebuild和xcrun自动化编译ipa包 笔记的更多相关文章

  1. xcodebuild和xcrun实现自动打包iOS应用程序

    随着苹果手持设备用户的不断增加,ios应用也增长迅速,同时随着iphone被越狱越来越多的app 的渠道也不断增多,为各个渠道打包成了一件费时费力的工作,本文提供一种比较智能的打包方式来减少其带来的各 ...

  2. iOS自动化编译

    最近研究了一下iOS的自动化编译,目的是为了简化测试和开发的同学沟通协调的次数,实现测试同学可以随时从网页操作编译SVN最新源码并打包ipa进行测试. 具体思路是通过从配置文件读取需要编译的项目配置列 ...

  3. iOS 导出 ipa 包时 四个选项的意义

    iOS 导出 ipa 包时 四个选项的意义 如图  在 iOS 到处 ipa包的时候 会有四个选项 1.Save for iOS App Store Deployment 保存到本地 准备上传App ...

  4. 不用开发者账号打ipa包

    编译一下 , if -> Build Success  -> Show in Finder之后,将文件夹里的app直接拖入到iTunes里, 接着再iTunes里选中app -> S ...

  5. mac命令行对复杂ipa包重新签名

    最近在做ios的自动化平台,需要通过命令行安装卸载ipa包 好了问题来,别人上传的ipa包,很可能是开发签名了只能在特定手机上安装的测试ipa包,那我们如何将其安装在我们的自动化的iphone上呢? ...

  6. iOS导出ipa包时四个选项的意义

    1. Save for iOS App Store Deployment 保存到本地 准备上传App Store 或者在越狱的iOS设备上使用 2. Save for Ad Hoc Deploymen ...

  7. iOS ipa包瘦身,iOS8及以下text段超60MB

    前沿 很早之前写过一篇相关文章,不过博客主机上跑路了之后数据没了,凭着记忆补了下相关资料 ipa安装包瘦身 清理无用图片,图片压缩(PNG换WebP和JPG),处于某种不可抗拒的原因,导致有部分3X图 ...

  8. 构建Jenkins自动化编译管理环境

    今天研究了一下Jenkins,有了一个粗浅的认识,顺手把构建的过程说一下,后续慢慢补充: (1)Secure CRT 连接到Linux服务器 要注意的一点是,要搞好一个文件传输的路子,否则不好传东西. ...

  9. Gradle Android最新自动化编译脚本教程

    转自:http://blog.csdn.net/changemyself/article/details/39927381 一.前言 Gradle 是以 Groovy 语言为基础,面向Java应用为主 ...

随机推荐

  1. 使用nice命令调整进程优先级

    Adjusting Process Priority with nice   When Linux processes are started, they are started with a spe ...

  2. Wijmo 日历插件

    说明: 因为项目(OA)的需要,我负责开发日程的模块,相信大家用过谷歌的日历了吧,是不是觉得挺好用,但又苦于无法实现? 这里告诉你一个很好的插件,Wijmo,而里面有一个类似谷歌的日历事件插件,真的很 ...

  3. JAVAEE学习

    首先要明白Java体系设计到得三个方面:J2SE,J2EE,J2ME(KJAVA).J2SE,Java 2 Platform Standard Edition,我们经常说到的JDK,就主要指的这个,它 ...

  4. 关于数据库中varchar/nvarchar类型数据的获取注意事项

    当在页面后台获取数据库表中某字段的数据时,需注意该数据的类型.防止因实际数据的字符长度因达不到指定数据类型规定的字符长度而导致空格的占位符. 比如: MSSQL中某一表的结构如下:   表中的数据: ...

  5. Win8 IE10 只能以管理员打开的解决方法

    Win8 IE10 只能以管理员打开的解决方法 使用 Windows8 一段时间后,最近遇到 IE10 打不开,只能以管理员身份打开,很是郁闷.无论禁用IE加载项还是恢复默认设置都无效,也看到论坛不少 ...

  6. oracle 中如何定位重要(消耗资源多)的SQL【转】

    1.查看值得怀疑的SQL )||'%'load, s.executions executes, p.sql_text from(select address, disk_reads, executio ...

  7. QT参考录

    源码参考: #include "CServerManager.h" CServerManager* CServerManager::m_pInstance = NULL; CSer ...

  8. jQuery extend方法介绍

    jQuery为开发插件提拱了两个方法,分别是: jQuery.fn.extend(object); jQuery.extend(object); jQuery.extend(object);为扩展jQ ...

  9. scrapy1.1入门用例简介-2

    写一个小的scrapy project,爬取相关网页内容并保存为.json文件 0.创建project,genspider等. 1.修改items.py,内容如下: 2.修改dmoz.py,内容如下: ...

  10. python 多层装饰器

    25.多层装饰器:      1.原理:执行顺序从上往下,#2和#3组成一个函数假设为nf1,#1和nf1组成一个函数nnf1           f1成为ck_ty_of_us的inner函数即nf ...