Skip to content

Generating schemes with BuildableProductRunnable for watchOS targets causes errors in Xcode 14 beta #1226

@SSheldon

Description

@SSheldon

With an example project.yml like this:

name: Foo

targets:
  Foo:
    type: framework
    platform: watchOS

schemes:
  Foo:
    build:
      targets:
        Foo: build

And performing the following steps:

xcodegen -s project.yml
xcodebuild -project Foo.xcodeproj -scheme Foo -showBuildSettings

When using Xcode 14 beta 2, the final step errors with:

[MT] DVTAssertions: ASSERTION FAILURE in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot8/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-21257.0.0.0.25/IDEFoundation/Execution/RunDestinations/IDERunDestinationCLI.m:565
Details:  Unhandled/unexpected case where no run destinations were produced.
Object:   <IDERunDestinationCLI>
Method:   +resolveRunDestinationsWithWorkspace:scheme:buildAction:schemeCommand:schemeTask:destinationSpecifications:architectures:timeout:runDestinationManager:deviceManager:fallbackPreferredSDK:fallbackPreferredArchitectures:skipUnsupportedDestinations:shouldSkipRunDestinationValidation:didDisambiguate:disambiguatedMatches:disambiguatedMatchesDescription:error:
Thread:   <_NSMainThread: 0x60000213c280>{number = 1, name = main}
Hints: 

Backtrace:
  0   -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
  1   _DVTAssertionHandler (in DVTFoundation)
  2   _DVTAssertionFailureHandler (in DVTFoundation)
  3   _sortDevicesForDisplay (in IDEFoundation)
  4   -[Xcode3CommandLineBuildTool _resolveRunDestinationsForBuildAction:] (in Xcode3Core)
  5   -[Xcode3CommandLineBuildTool _resolveInputOptionsWithTimingSection:] (in Xcode3Core)
  6   -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
  7   XcodeBuildMain (in libxcodebuildLoader.dylib)
  8   start (in dyld)

The cause appears to be in the profile action of the scheme. If we manually edit the generated scheme in the follow way:

--- a/Foo.xcodeproj/xcshareddata/xcschemes/Foo.xcscheme
+++ b/Foo.xcodeproj/xcshareddata/xcschemes/Foo.xcscheme
@@ -67,8 +67,7 @@
       savedToolIdentifier = ""
       useCustomWorkingDirectory = "NO"
       debugDocumentVersioning = "YES">
-      <BuildableProductRunnable
-         runnableDebuggingMode = "0">
+      <MacroExpansion>
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "8F0F80D982E77483A25959A4"
@@ -76,7 +75,7 @@
             BlueprintName = "Foo"
             ReferencedContainer = "container:Foo.xcodeproj">
          </BuildableReference>
-      </BuildableProductRunnable>
+      </MacroExpansion>
    </ProfileAction>
    <AnalyzeAction
       buildConfiguration = "Debug">

Then the assertion failure stops and the xcodebuild command completes successfully.

A couple projects appear to have run into versions of this issue: Swinject/Swinject#511, square/Valet#282.

This seems like a bug in Xcode 14 which may be fixed in future betas, but I wanted to let you know in the meantime!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions