I'm developing a Gradle Plugin that needs to read an output generated by an annotation processor with kapt. For that reason I'm depending on kapt task and all of that works fine. But now I want to test it because I want to also support the Android flavours and without tests that's a mess.
When I run:
val project = ProjectBuilder.builder()
.build()
project.pluginManager.apply(KotlinPluginWrapper::class.java)
project.pluginManager.apply(Kapt3GradleSubplugin::class.java)
project.pluginManager.apply(LightsaberPlugin::class.java)
I can see the tasks generated by kotlin and my plugin but I can't see any task generated by kapt. This makes that my tests pointless because want I want is to assert that the tasks that my plugin adds depends on the correct kapt tasks (for example, that
:lightsaberDebugCheck
depends on
:kaptDebugKotlin
). I have some tests using
GradleRunner
but those tests are way slower and I can't assert the dependencies I just can assert that "X" task was executed without knowing the reason. Is there a way to make this work with
ProjectBuilder
? Any other idea to how to test this?