开发过程中,总免不了为测试打包,过程重复且耗费时间,所幸,可以选择自动化打包
xcodebuild
xcodebuild 是苹果发布自动构建的工具,
xcodebuild -h
xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild [-project <projectname>] -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -workspace <workspacename> -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]
xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]] [-json]
xcodebuild -showsdks
xcodebuild -exportArchive -archivePath <xcarchivepath> -exportPath <destinationpath> -exportOptionsPlist <plistpath>
xcodebuild -exportLocalizations -localizationPath <path> -project <projectname> [-exportLanguage <targetlanguage>...]
xcodebuild -importLocalizations -localizationPath <path> -project <projectname>
前三条命令是比较常用的
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
编译过程中会打印诸多编译信息,不出错的话基本没必要看所打印的信息(太多啦),下面展示一张出错的图:
改错,再来一遍!Again!!!
Success!!!
libimobiledevice
官方github地址:https://github.com/libimobiledevice/libimobiledevice