Skip to content

Include GraphAPI and GraphAPITestMocks targets using SPM#2592

Merged
amy-at-kickstarter merged 7 commits into
mainfrom
feat/adyer/graphql-as-spm
Aug 19, 2025
Merged

Include GraphAPI and GraphAPITestMocks targets using SPM#2592
amy-at-kickstarter merged 7 commits into
mainfrom
feat/adyer/graphql-as-spm

Conversation

@amy-at-kickstarter

@amy-at-kickstarter amy-at-kickstarter commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

📲 What

  • Add the GraphAPI and GraphAPITestMocks targets to the project as a local swift package, instead of as individual targets.
  • Link the Apollo library statically, instead of dynamically
  • Link GraphAPI and GraphAPITestMocks statically, instead of dynamically
Screenshot 2025-08-19 at 9 33 52 AM

🤔 Why

  • Using SPM means we have fewer targets to configure and manage in XCode. We had some signing issues last release because of how these targets were configured - my hope is that fewer targets = fewer places we can make that kind of mistake.
  • Using SPM also means all these files and folders are added automatically, so you no longer have to individually add generated files.
  • We link basically all of our dependencies statically and not dynamically, so this is more consistent with the rest of the app.

👀 How

I created a beta distribution build to test this - the build builds and runs!

@amy-at-kickstarter amy-at-kickstarter changed the title WIP: Feat/adyer/graphql as spm WIP: Include GraphAPI and GraphAPITestMocks using SPM Aug 18, 2025
@nativeksr

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@amy-at-kickstarter amy-at-kickstarter changed the title WIP: Include GraphAPI and GraphAPITestMocks using SPM Include GraphAPI and GraphAPITestMocks targets using SPM Aug 19, 2025
@amy-at-kickstarter amy-at-kickstarter marked this pull request as ready for review August 19, 2025 13:45

@scottkicks scottkicks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Excited to see how this impacts!

Just one clarifying change question

@@ -7,7 +7,7 @@ import XCTest
final class WatchProjectResponseEnvelope_WatchProjectMutationTests: XCTestCase {
func test_envelopeFrom() {
let mock = Mock<GraphAPITestMocks.Mutation>()
mock.watchProject = Mock<GraphAPITestMocks.WatchProjectPayload>()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! So it turns out there's a bug with the generator - or maybe with our GraphQL schema. We have two mutations, WatchProjectMutation and UnwatchProjectMutation, both of which return a watchProject object. However, they each return two different types. Every time we re-generate our GraphQL objects, it switches which type it defines, and one of these tests breaks 🤦‍♀️

The tests aren't terrible useful, so one solution would be to delete them. I'm not sure we can fix the backend issue.

@amy-at-kickstarter amy-at-kickstarter merged commit 4fd067a into main Aug 19, 2025
5 checks passed
@amy-at-kickstarter amy-at-kickstarter deleted the feat/adyer/graphql-as-spm branch August 19, 2025 17:22
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

Successfully merging this pull request may close these issues.

4 participants