转自: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. css中的垂直居中方法

    单行文字 (外行高度固定) line-height 行高, 将line-height值与外部标签盒子的高度值设置成一致就可以了. height:3em; line-height:3em; 多行文字 图 ...

  2. css01入门小例子

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  3. python的数与字符串

    双引号 c1="sldkjf"print c1c2="It's a dog"print c2 单引号c1='sldkjf'print c1c2='It" ...

  4. 如何使用css、布局横向导航栏

    使用css布局横向导航栏,css应用给网页样式的方式,就相当于,给人怎么去穿上衣服,不同的衣服有不同的穿法,这里我们使用的是内联式.在这里 我们可以适当的把值调的大一点,这样我们就可以很容易的对比. ...

  5. 还是把一个课程设计作为第一篇文章吧——学生学籍管理系统(C语言)

    #include <stdio.h> #include<stdlib.h> #include<string.h> typedef struct student { ...

  6. linux jdk,java ee ,tomcat 安装配置

    1.把mypagekage.iso 挂载到linux操作系统中. 在VM做好配置,使用 mount /mnt/cdrom 2.把安装文件拷贝到/home cp 文件名 /home (快捷键tab) 3 ...

  7. Shell中的${},##和%%的使用

    假设我们定义了一个变量为: file=/dir1/dir2/dir3/my.file.txt 可以用${ }分别替换得到不同的值: ${file#*/}:删掉第一个/ 及其左边的字符串:dir1/di ...

  8. 如何安装Git到MAC OS X

    这里介绍两种方式:一,使用Git command-line二,使用GUI工具SourceTree,功能很强大,很方便 在进行安装前,要说一下,Git和SVN一样,都需要创建一个服务器的,他们都可以创建 ...

  9. PHP SimpleXML

    安装 SimpleXML 扩展需要 PHP 5 支持. 自 PHP 5 起,SimpleXML 函数是 PHP 核心的组成部分.无需安装即可使用这些函数. PHP 5 SimpleXML 函数 函数 ...

  10. 学习OpenSeadragon之四(导航视图)

    OpenSeadragon介绍以及上手:学习OpenSeadragon之一 OpenSeadragon主要用于地图.医学图像等需要放大缩小分层显示的图像显示. 1.简单例子 导航视图就是在一个小框中显 ...