Embed GraphQL metadata in the jar/klib
Use case
As of today, we use a separate file to store GraphQL metadata used by the apollo compiler. This means in multi-module scenarios, one typically has to do something like so:
dependencies {
implementation(project(":schema"))
}
apollo {
service("service") {
dependsOn(project(":schema"))
}
}
While working, this setup is a bit cumbersome and error prone. It's possible to forget one of the two dependencies.
Instead, we could embed the required GraphQL information in the .jar/.klib file so that the apollo compiler doesn't have to pull an additional artifact.
See https://github.com/apollographql/apollo-kotlin/pull/6325 See https://youtrack.jetbrains.com/issue/KT-58830
Note: if we're going that road, we might not be able to share the same codegen task between different targets/variants anymore.
KMP has targets and Android have variants. Each target/variant has its own "compileClasspath" that may be different so we'd need to create N schema, Ir, codegen, etc... tasks. That's going to blow up the number of codegen tasks quite a lot. Maybe not an issue but it's added complexity.
Or maybe we can find a "common" "compileClasspath" that we could reuse. This will need to be user-configurable.