iosxcodebuild

xcodebuild fails to copy SPM bundles


I'm trying to make a build of my app using xcodebuild. However, it is failing in this environment and I don't understand why…

Here's the command I'm running:

xcodebuild \
  build \
  -scheme "My Project" \
  -derivedDataPath './customFolder' \
  -destination 'platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.4' \
  -configuration Release \
  CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

And here's the error I'm encountering:

2024-04-17T13:26:19.3570770Z ** BUILD FAILED **
2024-04-17T13:26:19.3570910Z 
2024-04-17T13:26:19.3570910Z 
2024-04-17T13:26:19.3571000Z The following build commands failed:
2024-04-17T13:26:19.3572940Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_StripeUICore.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_StripeUICore.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3576630Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_StripePaymentsUI.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_StripePaymentsUI.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3581230Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_StripePayments.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_StripePayments.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3585070Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_StripePaymentSheet.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_StripePaymentSheet.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3588560Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_StripeCore.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_StripeCore.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3592190Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_StripeCardScan.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_StripeCardScan.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3596380Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_Stripe3DS2.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_Stripe3DS2.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3599820Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Stripe_Stripe.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Stripe_Stripe.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3603360Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/Sentry_SentryPrivate.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/Sentry_SentryPrivate.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3607080Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/SDWebImage_SDWebImage.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/SDWebImage_SDWebImage.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3611230Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/PhoneNumberKit_PhoneNumberKit.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/PhoneNumberKit_PhoneNumberKit.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3615470Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/MapboxMaps_MapboxMaps.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/MapboxMaps_MapboxMaps.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3619380Z    Copy /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/My\ Project.app/CodeScanner_CodeScanner.bundle /Users/runner/Library/Developer/Xcode/DerivedData/My_Project-ayymvkrodrcpfzfpxkejssmcssuc/Build/Products/Release\ Development-iphonesimulator/CodeScanner_CodeScanner.bundle (in target 'My Project' from project 'My Project')
2024-04-17T13:26:19.3621770Z (13 failures)
2024-04-17T13:26:19.4045210Z ##[error]Process completed with exit code 65.

What should I change for this command to work without error?

Any help would be appreciated.


Solution

  • TLDR

    Improper xcodebuild -configuration argument is causing this issue. Check that the configuration you're providing exists. Use xcodebuild -list to list the available configurations of your project.

    Details

    I initially thought that the issue was that using SPM was incompatible with the xcodebuild -configuration argument after having stumbled upon the accepted answer of this discussion.

    But now, I've realized that the important thing in this case is to just give this argument a configuration that exists.

    In my case, my argument was -configuration Release. However, my project didn't actually had a configuration named Release.

    I just had to go to the root of my project and type this command to get a list of the available configurations:

    xcodebuild -list
    

    Which printed:

    Information about project "My Project":
        Targets:
            My Project
            My Project Tests
            MyProject WidgetExtension
    
        Build Configurations:
            Debug Development
            Debug Production
            Release Development
            Release Production
    
        If no build configuration is specified and -scheme is not passed then "Release Development" is used.
    

    All I had to do after this was to edit my -configuration with one of these configurations.

    xcodebuild \
      build \
      -scheme "My Project" \
      -derivedDataPath './customFolder' \
      -destination 'platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.4'
      -configuration 'Release Development'