zoukankan      html  css  js  c++  java
  • xcode8.3 shell 自动打包脚本

    题记

    xcode升级8.3后发现之前所用的xcode自动打包基本无法使用,因此在网上零碎找到些资料,将之前的脚本简化。此次脚本是基于xcode证书配置进行打包(之前是指定描述文件、相对繁琐)。因此代码较为简单使用。

    xcodebuild

    自动打包是基于xcodebuild工具进行打包(xcode本身也是基于此打包)。在终端我们可以通过 man xcodebuild 指令查看了解xcodebuild工具

    接着通过xcodebuild --help可直接得到其使用示例

    非cocoapods管理项目,只需要对单个工程进行打包处理,使用如下方法

    xcodebuild [-project <projectname>] -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
    

    由于笔者使用cocoapods管理第三方库,因此直接使用进行打包

    xcodebuild -workspace <workspacename> -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
    

    当打包完成后只需要对压缩包解压即可得到对应的ipa安装包

    xcodebuild -exportArchive -archivePath <xcarchivepath> -exportPath <destinationpath> -exportOptionsPlist <plistpath>
    

    主要代码

    #清理工程
    xcodebuild clean -configuration ${development_mode} -quiet  || exit
    #编译工程
    xcodebuild archive -workspace ${project_name}.xcworkspace -scheme ${scheme_name} -configuration ${development_mode} -archivePath build/${project_name}.xcarchive -quiet  || exit
    #打包
    xcodebuild -exportArchive -archivePath build/${project_name}.xcarchive -configuration ${development_mode} -exportPath ${exportFilePath} -exportOptionsPlist ${exportOptionsPlistPath} -quiet || exit
    //todo ..应用上传分发操作
    
    参数说明
    cleaen 清理工程
    quiet 不输出警告或错误
    exit 命令未完成退出shell脚本
    projectname 工程名
    workspacename 工程名
    schemeName 一般也为工程名(个人理解为应用调起标示)
    configuration 打包模式(Debug/Release)
    exportOptionsPlist ipa导出方式(分为app-store、ad-hoc、enterprise、development)
    此项由plist文件构成的字典key:method, value:development(上述四个其中一个)
    

    自动打包文件

    自动打包脚本已上传至github有需要的朋友可自行下载自动打包脚本文件链接

    上述如有不妥之处请指正参考链接

  • 相关阅读:
    修改服务器时间以后 cookie无法保存
    SqlServer 2017 下载地址及密钥
    ASP.NET CORE 开发路线
    在ASP.NET CORE下生成PDF文档
    Redis 学习笔记2
    Redis 学习笔记1
    notepad++文件对比
    Notepad++主题设置与推荐
    Vivado HLx 2019.1下载、安装与激活
    Tensorflow机器学习入门——cifar10数据集的读取、展示与保存
  • 原文地址:https://www.cnblogs.com/purple-sweet-pottoes/p/6947500.html
Copyright © 2011-2022 走看看