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

Adding a swift package with multiple products was confusing #1182

Closed
brandtdaniels opened this issue Feb 23, 2022 · 4 comments
Closed

Adding a swift package with multiple products was confusing #1182

brandtdaniels opened this issue Feb 23, 2022 · 4 comments

Comments

@brandtdaniels
Copy link

I've been trying to migrate Firebase from a Cocoapod to a Swift package for the longest time. I finally decided to not give up this time and was constantly using this syntax and it never added the package/product to the target

        - package: Firebase
          product: FirebaseAnalytics
          product: FirebaseCrashlytics
          product: FirebaseMessaging
          product: FirebasePerformance
          product: FirebaseInAppMessaging
          product: FirebaseRemoteConfig

Finally I decided to try this nonsense and it worked adding the products to the target

        - package: Firebase
          product: FirebaseAnalytics
        - package: Firebase
          product: FirebaseCrashlytics
        - package: Firebase
          product: FirebaseMessaging
        - package: Firebase
          product: FirebasePerformance
        - package: Firebase
          product: FirebaseInAppMessaging
        - package: Firebase
          product: FirebaseRemoteConfig

This was very unintuitive....please improve!

@chrisg123
Copy link

chrisg123 commented Mar 28, 2022

Wow... I just wasted so much time trying to figure this out... of course now that I know the answer I easily found it mentioned in the documentation but passed over it several times. ughh...

From the Project Spec:

Package dependency

[ ] product: String - The product to use from the package. This defaults to the package name, so is only required if a Package has multiple libraries or a library with a differing name

packages:
  Yams:
    url: https://github.com/jpsim/Yams
    majorVersion: 2.0.0
  SwiftPM:
    url: https://github.com/apple/swift-package-manager
    branch: swift-5.0-branch
targets:
  App:
    dependencies:
      - package: Yams 
      - package: SwiftPM
        product: SPMUtility

@yonaskolb
Copy link
Owner

I'm happy to accept a PR that adds a products array, but otherwise this is how Xcode models it.

@tyten
Copy link

tyten commented May 12, 2022

Updated documentation would be nice. It took me forever to find this but I'm not sure it necessarily warrants a change.

@yonaskolb
Copy link
Owner

#1395 has been merged which allows for specifying multiple products at once for each package

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

4 participants