0

I'm using xcodebuild with the -workspace . option to build a Swift Package (a framework) for iOS (swiftbuild only builds for MacOS) in a Github Action. It works for all of our packages, except 2, where we get the error

xcodebuild: error: The workspace named "MyFramework" does not contain a scheme named "MyFramework". The "-list" option can be used to find the names of the schemes in the workspace.

But if I add xcodebuild -workspace . -list to the start of the build script, it shows that the scheme exists.

Anyone have an idea why it can't see the scheme that clearly is there, and what we can do to fix our script so this won't happen?

PS - This script runs fine locally.

Full build log:

xcodebuild -workspace . -list
2022-07-28 11:51:00.798 xcodebuild[2020:7121] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 11:51:00.799 xcodebuild[2020:7121] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
Command line invocation:
    /Applications/Xcode_13.4.1.app/Contents/Developer/usr/bin/xcodebuild -workspace . -list

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph

Fetching from git@github.com:me/aaa.git

Fetching from git@github.com:me/bbb.git

Cloning local copy of package ‘aaa’

Checking out 2.1.2 of package ‘aaa’

Cloning local copy of package ‘bbb’

Checking out 10.1.0 of package ‘bbb’

Resolved source packages:
  MyFramework: /Users/runner/work/MyFramework/MyFramework
  aaa: git@github.com:me/aaa.git @ 2.1.2
  bbb: git@github.com:me/bbb.git @ 10.1.0

Information about workspace "MyFramework":
    Schemes:
        MyFramework

set -o pipefail && xcodebuild -configuration Debug -derivedDataPath .derivedData -destination platform='iOS Simulator,name=iPhone 12,OS=latest' -scheme MyFramework -workspace . build | xcbeautify
2022-07-28 11:51:38.874 xcodebuild[3034:9866] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 11:51:38.875 xcodebuild[3034:9866] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 11:51:50.008 xcodebuild[3034:9866] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-20504/IDEFoundation/Execution/RunContextManager/IDERunContextManager.m:823
Details:  Error deleting scheme: Cannot modify data because the process disallows saving.
Object:   <IDERunContextManager: 0x60000399aac0>
Method:   -deleteRunContexts:completionQueue:completionBlock:
Thread:   <_NSMainThread: 0x600001eac3c0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2022-07-28 11:51:50.009 xcodebuild[3034:9866] could not delete old scheme: Error Domain=DVTCustomDataStoringErrors Code=0 "Cannot modify data because the process disallows saving." UserInfo={NSLocalizedDescription=Cannot modify data because the process disallows saving.}
xcodebuild: error: The workspace named "MyFramework" does not contain a scheme named "MyFramework". The "-list" option can be used to find the names of the schemes in the workspace.
Resolve Package Graph
make: *** [build-ios] Error 65
Resolve Package Graph
Resolved source packages
aaa - git@github.com:me/aaa.git @ 2.0.1
bbb - git@github.com:me/bbb.git @ 10.1.0
Error: Process completed with exit code 2.
uliwitness
  • 8,532
  • 36
  • 58
  • Does your Swift package have bundled resources? I'm also running into the "Cannot modify data because the process disallows saving" error on GH Actions, but it seems to stop as soon as I remove bundled resources. – Andrew Hershberger Mar 14 '23 at 04:09

1 Answers1

0

I may have found a workaround (since I thought the same thing back when I adjusted the Xcode version, I'm not willing to commit just yet ):

Given the error message xcodebuild[3034:9866] could not delete old scheme: Error Domain=DVTCustomDataStoringErrors Code=0 "Cannot modify data because the process disallows saving.", I wondered if maybe the current directory is not writable, and changed the code to use the runner's temp directory in the Makefile:

ifeq ($(origin RUNNER_TEMP),undefined)
    DERIVED_DATA_PATH=.derivedData
else
    DERIVED_DATA_PATH="$(RUNNER_TEMP)/derivedData"
endif

...

xcodebuild -configuration Debug -derivedDataPath "$(DERIVED_DATA_PATH)" ...

This seems a bit inconsistent though, since it sometimes worked with .derivedData in the current directory. But then again, maybe something somewhere changes the current directory to a writeable directory occasionally, and that hid the bug ...

uliwitness
  • 8,532
  • 36
  • 58