Kctf is a Gradle Plugin for the Kotlin Compiler Test Framework (KCTF).
It factors some of the Gradle configuration and boilerplate needed to setup tests for your Kotlin compiler plugin.
Configure your build
plugins { id("org.jetbrains.kotlin.jvm") id("com.gradleup.kctf").version("2.2.20-RC-0.0.1")}dependencies {// Add the kctf runtime, it pulls the kotlin test framework transitively testImplementation("org.gradleup.kctf:kctf-runtime:2.2.20-RC-0.0.1")}Write your abstract tests insrc/test/kotlin/com/example:
@TestMetadata("compiler-tests/src/test/data/box")openclassAbstractBoxTest :AbstractFirLightTreeBlackBoxCodegenTest() {overridefunconfigure(builder:TestConfigurationBuilder) {super.configure(builder)with(builder) { configurePlugin() defaultDirectives {+FULL_JDK+WITH_STDLIB+IGNORE_DEXING } } }}Call thekctfGenerateSources task:
./gradlew kctfGenerateSources
Kctf generates your test insrc/test/java:
/** This class is generated by {@link kctf.MainKt}. DO NOT MODIFY MANUALLY */@SuppressWarnings("all")@TestMetadata("compiler-tests/src/test/data/diagnostic")@TestDataPath("$PROJECT_ROOT")publicclassDiagnosticTestGeneratedextendsAbstractDiagnosticTest {// ...}