apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.87k stars 717 forks source link

apollo-ios-xcframework is built twice by Carthage #3308

Closed CraigSiemens closed 8 months ago

CraigSiemens commented 9 months ago

Summary

When apollo-ios-xcframework is added as a dependency using Carthage, it is built two times even though it only produces one framework.

Version

1.7.1

Steps to reproduce the behavior

Logs

*** Building scheme "Apollo" in Apollo.xcworkspace
*** Building scheme "Apollo" in Apollo.xcworkspace

Anything else?

It appears to be caused by there being two schemes in the workspace with the name Apollo. Running xcodebuild -list in the repo shows the following.

Information about project "Apollo":
    Targets:
        Apollo
        ApolloAPI
        ApolloSQLite
        ApolloWebSocket

    Build Configurations:
        Debug
        Release

    If no build configuration is specified and -scheme is not passed then "Release" is used.

    Schemes:
        Apollo
        Apollo
        Apollo-Dynamic
        ApolloAPI
        ApolloSQLite
        ApolloTestSupport
        ApolloWebSocket
        InstallCLI

One is the shared scheme in the project and the other is autogenerated from the swift package target also called Apollo. Carthage then builds each scheme it finds that has the same name as a shared scheme in the project. Since two have the same name, it builds them twice.

A workaround seems to be renaming the scheme before running Carthage, then there's only one listed scheme that matches the name of a shared scheme.

mv Carthage/Checkouts/apollo-ios-xcframework/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo.xcscheme \
Carthage/Checkouts/apollo-ios-xcframework/Apollo.xcodeproj/xcshareddata/xcschemes/Apollo-Framework.xcscheme

Related issue https://github.com/Carthage/Carthage/issues/3358

BobaFetters commented 9 months ago

@CraigSiemens Thanks for reporting this, I will take a look at this as soon as I can to see what I can do to resolve it

BobaFetters commented 8 months ago

@CraigSiemens Turns out this was a pretty simple fix, PR is up here and it will go out when we do our next release.