Hey :wave: I'm trying to do an implementation simi...
# apollo-kotlin
e
Hey πŸ‘‹ I'm trying to do an implementation similar to the one discussed in this comment, where we have a
debug
endpoint and a
release
endpoint and have a service set up for each. Each schema is then downloaded to a separate source set location, and the queries are in the
main
source set, so shared with both variants. The idea here is the debug schema can be updated (e.g. a new field has been added) before the release schema, and I can update the queries to include this new field. Ideally then I'd like the debug version to still compile, but the release to fail due to the missing field, until that change is pushed to the release endpoint/the release schema is updated also. The issue I'm seeing with this however, is when I build the debug version the
generateReleaseApolloSources
task is also run, and that fails the build because the field doesn't exist yet in the release schema. Is there any way around this issue? I'm new to GraphQL so appreciate I may be aiming at the incorrect solution here! Thanks πŸ™‚
βœ… 1
m
when I build the debug version the
generateReleaseApolloSources
task is also run
Welp, that's unexpected πŸ€” . Can you try
./gradlew assembleDebug -m
?
e
Yeah so turns out I lied πŸ˜… that works fine, it's complaining during project sync πŸ€”
m
Ah yea, that could happen
I'am assuming you selected "debug" as the build variant in the IDE?
Screenshot 2023-12-11 at 13.39.43.png
(that's just a sample)
e
Yeah, seems to try run all of the generatexApolloSources tasks
m
There's a setting that runs the
generateXyz()
task automatically, let me check
s
Could this
generateSourcesDuringGradleSync.set(false)
help in this case?
🎯 1
m
Exactly!
e
That did it! I presume the only downside of this is I'd need to build first to get the generated sources (which is totally fine)
nod 1
m
generateSourcesDuringGradleSync
is removed in v4 though because the IDE plugin makes it automagically (and I don't think there's a proper solution there besides removing the IJ plugin altogether πŸ€” )
e
Yeah I know nothing about v4 πŸ˜… does that translate to "you may have issues when upgrading to v4"?
m
Roughly speaking yes πŸ˜… . I meant this as an issue for us for the time being so hopefully you don't have an issue πŸ™‚
FWIW, the issue (if there's one) is mainly with the IJ plugin so it's not like it's going to break your v3 code. It's more that it'd be nice for the IJ plugin to support that use case
e
Ah do you mean v4 doesn't generate during gradle sync anymore, which is basically the same as setting
generateSourcesDuringGradleSync
to false in v3?
m
Exactly, v4 relies on an Android Studio plugin for IDE integration
An the Android Studio plugin calls
generateSources
by default IIRC
Not sure what happens one service fails, we should double check that
e
Cool, I'll let future me worry about this issue if it ever turns into one πŸ˜…, thanks for your help and let me know if you want me to test anything with v4 and this use case πŸ™‚
thank you color 1
πŸ‘ 1
b
(The IJ plugin ignores codegen fails)
πŸ™Œ 2