自動打包工具--xctool

來源:互聯網
上載者:User

前面介紹了HomeBrew的安裝

現在通過命令:sudo brew install xctool完成xctool的安裝


xctool是FaceBook開源的一個命令列工具,用來替代蘋果的xcodebuild工具。

參數:

-workspace 需要打包的workspace 後面接的檔案一定要是.xcworkspace 結尾的

-scheme 需要打包的Scheme

-configuration 需要打包的設定檔,我們一般在項目中添加多個配置,適合不同的環境

命令:

clean 清除編譯產生的問題,下次編譯就是全新的編譯了

archive 打包命令,會產生一個.xcarchive的檔案

註:archive命令需要接一個參數:-archivePath 即你存放Archive檔案的目錄

xctool命令就介紹到這裡,有寫基本上能滿足需求了


xcodebuild

xcodebuild是安裝xocde Command line tools 就有的一個命令

命令介紹:

參數
-exportArchive 告訴xcodebuild需要匯出archive檔案

-exportFormat 告訴xcodebuild需要匯出的archive檔案最後格式 後面接IPA 就是archive檔案匯出的格式為ipa檔案

-archivePath archive檔案目錄

-exportPath 匯出的ipa存放目錄

-exportProvisioningProfile 打包的目錄

xcodebuild命令介紹完畢


Summary

一般什麼bundle id 都會在Xcode裡面配置好,這裡面就不需要在進行配置了



一個整的自動打包shell指令碼:

#!/bin/sh #
cd AutoProject

#
buildDay=$(date +%Y%m%d)
buildTime=$(date +%Y%m%d%H%M)

profile=”xxxx”

#
buildConfiguration=”QA”
buildPath=”../ArchiveProduction/QA/${buildDay}/Auto_QA_${buildTime}.xcarchive”
ipaName=”../ipa/QA/${buildDay}/Auto_QA_${buildTime}.ipa”

#
xctool -scheme AutoProject -configuration ${buildConfiguration} clean
xctool -scheme AutoProject -configuration ${buildConfiguration} archive -archivePath ${buildPath}

xcodebuild -exportArchive -exportFormat IPA -archivePath ${buildPath} -exportPath ${ipaName} -exportProvisioningProfile “$profile”



進階iOS開發技術交流群:415239068,歡迎大家加入



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.