[Jenkins]参数化构建

栏目: 编程语言 · IOS · 发布时间: 8年前

内容简介:[Jenkins]参数化构建

上篇编译cocos2dx项目

不足

你一定会想,真实的打包环境可比这复杂多了,我要这样那样,希望通过参数来解决

为任务添加参数化构建

  • 打开任务
  • 在General中,勾选”参数化构建”
  • 点击添加参数
  • 这里参数种类很多,还可以通过插件扩展,挑几个讲
Boolean value 单选框
Choice 下拉框
String parameter 单行文本
List Subversion tags (and more) SVN tag

添加压缩图片选项(Boolean value)

  • 下载pngquant,确保/usr/local/bin/pngquant可以访问
  • 添加Boolean value
  • Name:Optimize,Default Value:勾选, Description:压缩PNG图片

添加平台选项(Choice)

  • 添加Choice
  • Name:Platform,Choices:ios/android/all(一行一个), Description:目标平台

添加编译选项(String parameter)

  • 添加String parameter
  • Name:Configuration,Default Value:debug,Description:编译选项

添加SVN Tags选项(List Subversion tags)

  • 添加List Subversion tags(and more)
  • Name:Tag,Tags filter:^tags/.*$,Maximum tags to display:10,勾选Sort newest first
  • Repository URL:svn://127.0.0.1/testjenkins
  • Credentials选择一个账号密码
  • 修改源码管理中的Repository URL:svn://127.0.0.1/testjenkins/$Tag

修改脚本

#图片压缩
if [ "$Optimize" = true ]; then
    find Resources -name "*.png" | xargs -I{} /usr/local/bin/pngquant -f --quality=50-80 --ext=.png {}
fi
 
#iOS编译步骤
if [ "$Platform" = "ios" ] || [ "$Platform" = "all" ]; then
        /Applications/Cocos/Cocos2d-x/cocos2d-x-3.10/tools/cocos2d-console/bin/cocoscompile -p ios -m $Configuration
fi
 
#安卓编译步骤
if [ "$Platform" = "android" ] || [ "$Platform" = "all" ]; then
        /Applications/Cocos/Cocos2d-x/cocos2d-x-3.10/tools/cocos2d-console/bin/cocoscompile -p android -m $Configuration
fi

执行任务

在首页点击任务名称

点击左侧”Build With Parameters”

配置参数

点击”开始构建”

最后依照你的项目和喜好 配置属于你项目的脚本吧


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

An Introduction to Probability Theory and Its Applications

An Introduction to Probability Theory and Its Applications

William Feller / Wiley / 1991-1-1 / USD 120.00

Major changes in this edition include the substitution of probabilistic arguments for combinatorial artifices, and the addition of new sections on branching processes, Markov chains, and the De Moivre......一起来看看 《An Introduction to Probability Theory and Its Applications》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

MD5 加密
MD5 加密

MD5 加密工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具