1,下载http://jenkins-ci.org/content/thank-you-downloading-os-x-installer
2,安装插件
Xcode integration:xcode 配置相关Environment Injector Plugin:配置环境变量
3,配置Xcode 编译器
可以通过这个命令查找对应的目录:find / -name xcodebuild编译器如果你电脑有6.1的有7.3的,那么你编译时候 使用你项目对应的编译器
4,创建一个 任务,
任务的名称
SVN的地址,在填写SVN地址的时候,需要输入 SVN的用户名密码
5,辅助的环境变量(插件:Environment Injector Plugin)
6,添加编译序列
添加之后对应的窗体:一个是 execute shell,一个是 Xcode
7,execute shell
在编译前 关联一些shell脚本文件对项目做一些处理,shell 文件目录,config.sh对应的 代码:
$DevMode对于 之前环境参数里面配置的数值,如果是 1,就是开发环境,是0就是生产环境DevModeDefault=‘DevMode 1‘
if [ "$DevMode" = 1 ]thenDevModeDefault=‘DevMode 1‘echo "devmode equal to 1"elseDevModeDefault=‘DevMode 0‘echo "devmode equal to 0"fi
ModifyFilePath="QTui/Common/Constant.h"
echo "modify devmode"
sed -i ‘‘ -e "s%DevMode[[:blank:]].*%$DevModeDefault%"$ModifyFilePath?
8, Xcode编译配置
a,
第二个标记的红框是可以修改 app的 版本号
b,这次的坑在 Target没有设置,总是报错(这一块折腾了有四五个小时,老大的一句话给点透了,膜拜),
xcodebuild: error: The project ‘KLABX_Enterprise.xcodeproj‘ does not
contain a target named ‘‘.
上面提示如果没有的话,默认编译所有的target,结果 不是这样。
9,编译时候提?示没有 schema
c, 打开 Xcode manage schema,然后选择 上 shared就可以了,注意 的是 SVN不要把文件后缀名是,xcuserdatadx,cshareddata,project.pbxproj的过滤掉了,
10,编译关于 签名关于描述?文件的错误
a. "Code Sign error: There are no valid certificate/private key pairsin the default keychain"
Solution: Copy your iPhone developer certificate from "login" keychainto "System" keychain.Detailed steps: open the "Keychain Access" application, click the login tab, rightclick the certificate like "iPhone Developer: your_name (XXXXXXX)",choose copy, then click the "System" tab, right click mouse, choose"Paste 2 items"; you might need to do the same thing with thecertificate like "iPhone Distribution: your_name".
After doing this, you will get the second error.b. "Code Sign error: Provisioning profile ‘xxxxx-xxxx-xxxx-xxxxx‘can‘t be found"Solution: Copy the provision profile to Jenkins user folder.The provision profile is under in the folder/YourUserName/Library/MobileDevice/Provisioning Profiles,for example in my machine, the provision profile files are under /Users/steve/Library/MobileDevice/Provisioning ProfilesIn the mac, the Jenkins will be in /Users/Shared/Jenkins, create thefollowing folder:/Users/Shared/Jenkins/Library/MobileDevice/Provisioning Profile, thencopy the .mobileprovision file to this folder.
对应 描述文件路径:
/Users/Shared/Jenkins/Library/MobileDevice/
/Users/<user>/Library/MobileDevice/Provisioning Profiles
11,生成IPA文件的配置
12,编译成功的样子,