Home > Blockchain >  Azure devops pipeline for building an ios bundle with iphone app and watchos app
Azure devops pipeline for building an ios bundle with iphone app and watchos app

Time:11-30

I'd like to use an Azure devops pipeline for building ios bundle that contains both an iphone app and a watchos app.

There is a workspace that contains the 3 apps (one for the phone and two for the watch)

MyWorkspace:

  • MyPhoneApp
  • MyWatchApp
  • MyWatchApp Extension

I use the following XCode task

- task: Xcode@5
  inputs:
    actions: 'build'
    scheme: 'MyApp'
    sdk: 'iphoneos'  
    configuration: 'Release'
    xcWorkspacePath: '$(system.defaultworkingdirectory)/MyWorkspace.xcworkspace'
    xcodeVersion: '12'

This task launches xcodebuild

xcodebuild -sdk iphoneos -configuration Release -workspace /Users/runner/work/1/s/MyApp/MyWorkspace.xcworkspace -scheme MyApp build

and it fails with the following errors:

error: unable to resolve product type 'com.apple.product-type.application.watchapp2' for platform 'iphoneos' (in target 'MyWatchApp' from project 'MyApp')

error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphoneos' (in target 'MyWatchApp Extension' from project 'MyApp')

What kind of SDK do I need to specify to build it?

CodePudding user response:

The command that I'd like to run using azure pipeline xcode task is the folowing:

xcodebuild -configuration Release -workspace /Users/runner/work/1/s/MyApp/MyWorkspace.xcworkspace -scheme MyApp build

Without the sdk specification

-sdk iphoneos

In this way the build of each component will follow the project default and the phone app will be built using iphoneos SDK and watch app will be built using watchos SDK.

Unfortunately if I remove the sdk specification from the xcode task

- task: Xcode@5
  inputs:
    actions: 'build'
    scheme: 'MyApp'
    configuration: 'Release'
    xcWorkspacePath: '$(system.defaultworkingdirectory)/MyWorkspace.xcworkspace'
    xcodeVersion: '12'

then it uses its own default

-sdk $(SDK)

and it causes an error because the $(SDK) is not defined.

The right (but pretty odd) syntax for this use case is

- task: Xcode@5
  inputs:
    actions: 'build'
    scheme: 'MyApp'
    sdk:   
    configuration: 'Release'
    xcWorkspacePath: '$(system.defaultworkingdirectory)/MyWorkspace.xcworkspace'
    xcodeVersion: '12'

leaving the sdk specification empty without any value.

  • Related