Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds a dependency twice when it contains a SPM target with the same name #3358

Open
CraigSiemens opened this issue Dec 23, 2023 · 0 comments

Comments

@CraigSiemens
Copy link

CraigSiemens commented Dec 23, 2023

  • carthage install method: [ ] .pkg, [x] homebrew, [ ] source
  • which carthage: /opt/homebrew/bin/carthage
  • carthage version: 0.39.1
  • xcodebuild -version: Xcode 14.2 Build version 14C18
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? No
  • Are you using --cache-builds? Yes
  • Are you using --new-resolver? No
  • Are you using --use-xcframeworks? Yes

Cartfile

github "apollographql/apollo-ios-xcframework"

Carthage Output

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

Actual outcome
Carthage builds Apollo twice though it only produces one .xcframework.

Expected outcome
It should only build the scheme once.

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.

Carthage could remove duplicate scheme names before checking for a shared scheme with the same name.

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 apollographql/apollo-ios#3308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant