Connecting source sets


By default, Apollo Kotlin adds the generated files to the main (for JVM/Android projects) or commonMain (for multiplatform projects) source sets.

If you only need them in a specific source set, you can use outputDirConnection to add them to a different source set.

For an example, you can add them to the "test" source set:

Kotlin
1apollo {
2  service("service") {
3    outputDirConnection {
4      connectToKotlinSourceSet("test")
5    }
6  }
7}

On Android, because the generated files are added to the main source set, they are available in all your build variants. If you need them available to only a specific build variant, you can do so with:

Kotlin
1apollo {
2  service("service") {
3    outputDirConnection {
4      connectToAndroidSourceSet("demoDebug")
5    }
6  }
7}

Edit on GitHub

Forums