diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt index 68831472742..833f367c41a 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt @@ -1269,4 +1269,15 @@ open class Kapt3IT : Kapt3BaseIT() { } } } + + @DisplayName("KT-59256: kapt generated files are included into the test runtime classpath") + @GradleTest + @Disabled("The fix is not yet provided") + fun testKaptGeneratedInTestRuntimeClasspath(gradleVersion: GradleVersion) { + project("kapt-in-test-runtime-classpath".withPrefix, gradleVersion) { + build("test") { + assertFileInProjectExists("build/tmp/kapt3/classes/main/META-INF/services/com.example.SomeInterface") + } + } + } } diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/build.gradle new file mode 100644 index 00000000000..654ef69ffa1 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/build.gradle @@ -0,0 +1,16 @@ +plugins { + id("org.jetbrains.kotlin.jvm") + id("org.jetbrains.kotlin.kapt") +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") + implementation("com.google.auto.service:auto-service:1.0-rc3") + kapt("com.google.auto.service:auto-service:1.0-rc3") + testImplementation'junit:junit:4.13.2' +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/src/main/kotlin/service.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/src/main/kotlin/service.kt new file mode 100644 index 00000000000..dd3d3cd4786 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/src/main/kotlin/service.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package com.example + +import com.google.auto.service.AutoService +import javax.annotation.processing.AbstractProcessor +import javax.annotation.processing.Processor +import javax.annotation.processing.RoundEnvironment +import javax.lang.model.element.TypeElement +import javax.tools.Diagnostic.Kind.MANDATORY_WARNING + +interface SomeInterface + +@AutoService(SomeInterface::class) +class SomeService : SomeInterface diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/src/test/kotlin/test.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/src/test/kotlin/test.kt new file mode 100644 index 00000000000..a42db83bf54 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/kapt2/kapt-in-test-runtime-classpath/src/test/kotlin/test.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package com.example + +import org.junit.Test +import java.util.ServiceLoader + +class Tests { + @Test + fun testServiceLoading() { + ServiceLoader.load(SomeInterface::class.java).singleOrNull() ?: error("Cannot load SomeInterface implementation, perhaps the service declaration couldn't be found") + } +} \ No newline at end of file