Skip to content

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

Open
@CraigSiemens

Description

@CraigSiemens
  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions