分享方式:


Xcode@4 - Xcode v4 工作

使用此工作在 macOS 上建置、測試或封存 Xcode 工作區,並選擇性地封裝應用程式。

Syntax

# Xcode v4
# Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
- task: Xcode@4
  inputs:
    actions: 'build' # string. Required. Actions. Default: build.
    #configuration: '$(Configuration)' # string. Configuration. Default: $(Configuration).
    #sdk: '$(SDK)' # string. SDK. Default: $(SDK).
    #xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace' # string. Workspace or project path. Default: **/*.xcodeproj/project.xcworkspace.
    #scheme: # string. Scheme. 
    #xcodeVersion: 'default' # '8' | '9' | 'default' | 'specifyPath'. Xcode version. Default: default.
    #xcodeDeveloperDir: # string. Optional. Use when xcodeVersion == specifyPath. Xcode developer path. 
  # Package options
    #packageApp: false # boolean. Create app package. Default: false.
    #archivePath: # string. Optional. Use when packageApp == true. Archive path. 
    #exportPath: 'output/$(SDK)/$(Configuration)' # string. Optional. Use when packageApp == true. Export path. Default: output/$(SDK)/$(Configuration).
    #exportOptions: 'auto' # 'auto' | 'plist' | 'specify'. Optional. Use when packageApp == true. Export options. Default: auto.
    #exportMethod: 'development' # string. Required when exportOptions == specify. Export method. Default: development.
    #exportTeamId: # string. Optional. Use when exportOptions == specify. Team ID. 
    #exportOptionsPlist: # string. Required when exportOptions == plist. Export options plist. 
    #exportArgs: # string. Optional. Use when packageApp == true. Export arguments. 
  # Signing & provisioning
    #signingOption: 'nosign' # 'nosign' | 'default' | 'manual' | 'auto'. Signing style. Default: nosign.
    #signingIdentity: # string. Optional. Use when signingOption = manual. Signing identity. 
    #provisioningProfileUuid: # string. Optional. Use when signingOption = manual. Provisioning profile UUID. 
    #teamId: # string. Optional. Use when signingOption = auto. Team ID. 
  # Devices & simulators
    #destinationPlatformOption: 'default' # 'default' | 'iOS' | 'tvOS' | 'macOS' | 'custom'. Destination platform. Default: default.
    #destinationPlatform: # string. Optional. Use when destinationPlatformOption == custom. Custom destination platform. 
    #destinationTypeOption: 'simulators' # 'simulators' | 'devices'. Optional. Use when destinationPlatformOption != default && destinationPlatformOption != macOS. Destination type. Default: simulators.
    #destinationSimulators: 'iPhone 7' # string. Optional. Use when destinationPlatformOption != default && destinationPlatformOption != macOS && destinationTypeOption == simulators. Simulator. Default: iPhone 7.
    #destinationDevices: # string. Optional. Use when destinationPlatformOption != default && destinationPlatformOption != macOS && destinationTypeOption == devices. Device. 
  # Advanced
    #args: # string. Arguments. 
    #workingDirectory: # string. Alias: cwd. Working directory. 
    #outputPattern: # string. Output directory. 
    #useXcpretty: false # boolean. Use xcpretty. Default: false.
    #publishJUnitResults: false # boolean. Publish test results to VSTS/TFS. Default: false.

輸入

actions - 行動
string. 必要。 預設值:build

指定以空格分隔的動作清單。 有效的選項為 buildcleantestanalyzearchive。 例如, clean build 執行全新組建。 請參閱 Apple:使用 Xcode 常見問題從命令列建置。


configuration - 配置
string. 預設值:$(Configuration)

指定要建置的 Xcode 專案或工作區組態。 使用變數時,請在 [變數] 索引標籤上指定值 (,例如 Release ,) 。


sdk - Sdk
string. 預設值:$(SDK)

指定建置 Xcode 專案或工作區時要使用的 SDK。 從 macOS 終端機應用程式執行 xcodebuild -showsdks 以顯示 SDK 的有效清單。 使用變數時,請在 [變數] 索引標籤上指定值 (,例如 iphonesimulator ,) 。


xcWorkspacePath - 工作區或專案路徑
string. 預設值:**/*.xcodeproj/project.xcworkspace

選擇性。 指定從存放庫根目錄到 Xcode 工作區或專案的相對路徑。 如果您指定值,您也必須指定配置。 如果您要在進階引數中指定 -target flag ,請勿指定值。 例如,MyApp/MyApp.xcworkspaceMyApp/MyApp.xcodeproj


scheme - 方案
string.

選擇性。 指定 Xcode 配置名稱。 必須是 Xcode ) 中受控配置底下的共用配置 (共用核取方塊。 如果您未指定配置,且指定的工作區具有單一共用配置,則會使用工作區配置。


xcodeVersion - Xcode 版本
string. 允許的值: 8 (Xcode 8) 、 9 (Xcode 9) 、 defaultspecifyPath (指定路徑) 。 預設值:default

指定 Xcode 的目標版本。 選取 Default 以在代理程式電腦上使用預設版本的 Xcode。 例如,指定版本號碼 (, Xcode 9) 依賴代理程式電腦上的環境變數所設定的版本位置, XCODE_9_DEVELOPER_DIR=/Applications/Xcode_9.0.0.app/Contents/Developer 例如 (,) 。 選取 Specify path 以提供 Xcode 開發人員目錄的特定路徑。


xcodeDeveloperDir - Xcode 開發人員路徑
string. 選擇性。 使用 時 xcodeVersion == specifyPath

指定特定 Xcode 開發人員目錄的路徑,例如 /Applications/Xcode_9.0.0.app/Contents/Developer () 。 當代理程式機器上安裝多個 Xcode 版本時,此輸入很有用。


packageApp - 建立應用程式套件
boolean. 預設值:false

指定是否應該產生 IPA 應用程式套件檔案作為組建的一部分。


archivePath - 封存路徑
string. 選擇性。 使用 時 packageApp == true

指定放置已建立封存的目錄。


exportPath - 匯出路徑
string. 選擇性。 使用 時 packageApp == true 。 預設值:output/$(SDK)/$(Configuration)

指定從封存匯出的產品目的地。


exportOptions - 匯出選項
string. 選擇性。 使用 時 packageApp == true 。 允許的值: auto (自動) 、 plistspecify 。 預設值:auto

指定匯出封存的選項。 選取 的預設值 Automatic 時,會自動從封存偵測匯出方法。 選取 Plist 以指定包含匯出選項的 plist 檔案。 選取 Specify 以提供特定的匯出方法和小組識別碼


exportMethod - Export 方法
string. 需要 。 exportOptions == specify 預設值:development

指定 Xcode 用來匯出封存的方法。 例如:app-storepackagead-hocenterprisedevelopment


exportTeamId - 小組識別碼
string. 選擇性。 使用 時 exportOptions == specify

指定要在匯出期間使用的 Apple Developer Portal 10 字元小組識別碼。


exportOptionsPlist - 匯出選項 plist
string. 需要 。 exportOptions == plist

指定 plist 檔案的路徑,其中包含匯出期間要使用的選項。


exportArgs - 匯出引數
string. 選擇性。 使用 時 packageApp == true

指定匯出期間所使用的其他命令列引數。


signingOption - 簽署樣式
string. 允許的值: nosign (不要) 碼符號、 (Project 預設值) 、 defaultmanual (手動簽署) , auto (自動簽署) 。 預設值:nosign

指定簽署組建的方法。 選取 Do not code sign 以停用簽署。 選取 Project defaults 即可只使用專案的簽署組態。 選取 Manual signing 以強制手動簽署,並選擇性地指定簽署身分識別和布建設定檔。 選取 Automatic signing 以強制自動簽署,並選擇性地指定開發小組識別碼。 如果您的專案需要簽署,請使用 安裝 Apple... 工作,在 Xcode 組建之前安裝憑證和布建設定檔。


signingIdentity - 簽署身分識別
string. 選擇性。 使用 時 signingOption = manual

指定要用來簽署組建的簽署身分識別覆寫。 可能需要解除鎖定代理程式電腦上的預設金鑰鏈。 如果未輸入任何值,則會使用 Xcode 專案的設定。


provisioningProfileUuid - 布建設定檔 UUID
string. 選擇性。 使用 時機 signingOption = manual

指定用於組建之已安裝布建設定檔的 UUID。 在 iOS、tvOS、watchOS () 的單一工作區中,使用不同的配置或目標來指定布建設定檔。


teamId - 小組識別碼
string. 選擇性。 使用 時機 signingOption = auto

如果您是多個開發小組的成員,則為必要專案。 指定 10 個字元的開發小組識別碼。


destinationPlatformOption - 目的地平臺
string. 允許的值: default 、 (iOS 和 watchOS) 、、 tvOSmacOScustomiOS 預設值:default

指定當泛型組建裝置無效時,用於 UI 測試的目的地裝置平臺。 選擇 Custom 指定清單中未包含的平臺。 選取時 Default ,不會將模擬器或裝置設為目標。


destinationPlatform - 自訂目的地平臺
string. 選擇性。 使用 時機 destinationPlatformOption == custom

指定當泛型組建裝置無效時,用於 UI 測試的目的地裝置平臺。


destinationTypeOption - 目的地類型
string. 選擇性。 使用 時機 destinationPlatformOption != default && destinationPlatformOption != macOS 。 允許的值: simulators (模擬器) , devices (連線的裝置) 。 預設值:simulators

指定用於 UI 測試的目的地類型。 裝置必須透過纜線或網路連線連接到執行組建的 Mac。 如需詳細資訊,請參閱 Xcode 中的 裝置和模擬器


destinationSimulators - 類比
string. 選擇性。 使用 時機 destinationPlatformOption != default && destinationPlatformOption != macOS && destinationTypeOption == simulators 。 預設值:iPhone 7

指定用於 UI 測試的 Xcode 模擬器名稱。 例如, iPhone X (iOS 和 watchOS) 或 Apple TV 4K (tvOS) 。 選擇性的目標 OS 版本可以指定為 格式 OS=<versionNumber> ,例如 iPhone X,OS=11.1 。 深入瞭解託管 macOS 預覽代理程式上安裝的模擬器


destinationDevices - 裝置
string. 選擇性。 使用 時機 destinationPlatformOption != default && destinationPlatformOption != macOS && destinationTypeOption == devices

指定用於 UI 測試的裝置名稱,例如 Raisa's iPad


args - 參數
string.

選擇性。 指定要建置的其他命令列引數。 此輸入適用于指定 -target-project 引數,而不是工作區/專案和配置。 請參閱 Apple:使用 Xcode 常見問題從命令列建置


workingDirectory - 工作目錄
輸入別名: cwdstring.

選擇性。 指定要在其中執行組建的工作目錄。 如果未輸入任何值,則會使用存放庫的根目錄。


outputPattern - 輸出目錄
string.

選擇性。 指定工作目錄的相對路徑,其中會放置建置輸出 (二進位檔) 。 例如:output/$(SDK)/$(Configuration)output/$(TestSDK)/$(TestConfiguration)。 封存和匯出路徑會個別設定。 在 [ 變數] 索引標籤上指定值。


useXcpretty - 使用 xcpretty
boolean. 預設值:false

指定是否要使用 xcpretty 來格式化 xcodebuild 輸出,並產生 JUnit 測試結果。 xcpretty 必須安裝在代理程式電腦上, (它預先安裝在 VSTS 裝載的組建代理程式) 上。 如需詳細資訊,請參閱 xcpretty


publishJUnitResults - 將測試結果發佈至 VSTS/TFS
boolean. 預設值:false

如果 xcpretty 已啟用,此輸入會指定是否要將 JUnit 測試結果發佈至 VSTS/TFS。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制項選項和一般工作屬性

輸出變數

無。

備註

使用此工作在 macOS 上建置 Xcode 工作區。

範例

規格需求

需求 描述
管線類型 YAML,傳統組建
執行于 Agent、DeploymentGroup
要求 自我裝載代理程式必須具備符合下列需求的功能,才能執行使用此工作的作業:xcode
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任意
Settable 變數 任意
代理程式版本 所有支援的代理程式版本。
工作類別 組建