I have 2 GraphQl schemas for debug and prod versions of my app. Also I have 2 build types: debug and release. Obviously, I want to use the debug-schema with the debug build-type, and the production-schema with the release one.
According to this issue, Apollo v2 allows set such configuration using onCompilationUnit, and probably I can write smth like this:
apollo {
onCompilationUnit {
graphqlSourceDirectorySet.srcDirs += "src/main/graphql"
def buildTypeName =(androidVariant as BaseVariant).buildType.name
if (buildTypeName.contains('debug')) {
graphqlSourceDirectorySet.srcDirs += "src/debug/graphql"
} else if (buildTypeName.contains('release')) {
graphqlSourceDirectorySet.srcDirs += "src/release/graphql"
}
}
}
The problem is that I didn't find onCompilationUnit in Apollo v3 (which is used in my project).
The main question is: How to configure gradle to force Apollo v3 use different schemas for different build-types?
I think analogue of onCompilationUnit in Apollo v3 will resolve this question. Please suggest me one if it exists in Apollo v3.
If there are some other ways to resolve the issue, you are welcome to answer :)