apollographql / apollo-ios

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

Codegen CLI versioning between Swift packages and Xcode project #3311

Closed swizzlr closed 8 months ago

swizzlr commented 10 months ago

Summary

Users may inadvertently generate Apollo code using a version different to that resolved by Xcode.

Version

n/a

Steps to reproduce the behavior

When using the command line to install the Apollo codegen CLI, the CLI is resolved by SPM to either that specified in the lockfile, or the latest satisfiable.

Xcode projects that use Swift Packages will not use the Package.resolved for these packages since the only sensible pinning is provided by Xcode itself. For example, an overall Xcode project using 1.6.1 may inadvertently have 1.7.1 code generated if the Apollo dependency is specified within a Swift Package.

I encountered this with an automated script we use and don't currently have a good workaround. I wanted to report this "bug" here since it seemed prudent for it to be noted in documentation that when using Apollo from a package within an Xcode project, the CLI MUST be installed via the Xcode right click action, so that it uses the appropriate Apollo version.

Logs

No response

Anything else?

No response

calvincestari commented 10 months ago

Hi @swizzlr 👋🏻 - can you please share more details about your project and the need for two Apollo iOS dependencies. You mentioned an automated script but it's not a typical configuration and could lead to some adverse behaviour besides what you're seeing here.

AnthonyMDev commented 8 months ago

I'm closing this issue due to inactivity. If this is still unresolved, feel free to provide more information and we can re-open this, or create a new issue.

github-actions[bot] commented 8 months ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.