iOS自动化打包

开发过程中,总免不了为测试打包,过程重复且耗费时间,所幸,可以选择自动化打包

xcodebuild

xcodebuild 是苹果发布自动构建的工具,

xcodebuild -h

       xcodebuild [-project ] [[-target ]...|-alltargets] [-configuration ] [-arch ]... [-sdk [|]] [-showBuildSettings] [=]... []...
       xcodebuild [-project ] -scheme  [-destination ]... [-configuration ] [-arch ]... [-sdk [|]] [-showBuildSettings] [=]... []...
       xcodebuild -workspace  -scheme  [-destination ]... [-configuration ] [-arch ]... [-sdk [|]] [-showBuildSettings] [=]... []...
       xcodebuild -version [-sdk [|] [] ]
       xcodebuild -list [[-project ]|[-workspace ]] [-json]
       xcodebuild -showsdks
       xcodebuild -exportArchive -archivePath  -exportPath  -exportOptionsPlist 
       xcodebuild -exportLocalizations -localizationPath  -project  [-exportLanguage ...]
       xcodebuild -importLocalizations -localizationPath  -project 

前三条命令是比较常用的

xcodebuild -list

xcodebuild -list:lists the targets and configurations in a project, or the schemes in a workspace
定位到工程目录下,执行 xcodebuild -list,以我的工程为例,输出如下:

➜  SAUserModuleTest git:(master) ✗ xcodebuild -list
Information about project "SAUserModuleTest":
    Targets:
        SAUserModuleEnterprise
        SAUserModuleCompany

    Build Configurations:
        Dev
        Debug
        Cit
        Release

    If no build configuration is specified and -scheme is not passed then "Release" is used.

    Schemes:
        SAUserModuleTest
        SAUserModuleEnterprise
        SAUserModuleCompany

编译

我的工程中使用了cocoapods,因此在编译时使用了 -workspace,并指定所需要build的 Configuration 和 Scheme,如下:

xcodebuild -workspace SAUserModuleTest.xcworkspace -configuration Cit -scheme SAUserModuleEnterprise
编译过程中会打印诸多编译信息,不出错的话基本没必要看所打印的信息(太多啦),下面展示一张出错的图:

iOS自动化打包_第1张图片
build_failed.png

改错,再来一遍!Again!!!

Build_Success.png

Success!!!

libimobiledevice

官方github地址:https://github.com/libimobiledevice/libimobiledevice


未完,待续~~

你可能感兴趣的:(iOS自动化打包)