Skip to content

Commit b23b9ab

Browse files
ALikhachevSpace Team
authored and
Space Team
committed
[Gradle] Add an integration test for KT-59256
1 parent 1373288 commit b23b9ab

File tree

4 files changed

+61
-0
lines changed
  • libraries/tools/kotlin-gradle-plugin-integration-tests/src/test

4 files changed

+61
-0
lines changed

libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/Kapt3IT.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,4 +1269,15 @@ open class Kapt3IT : Kapt3BaseIT() {
12691269
}
12701270
}
12711271
}
1272+
1273+
@DisplayName("KT-59256: kapt generated files are included into the test runtime classpath")
1274+
@GradleTest
1275+
@Disabled("The fix is not yet provided")
1276+
fun testKaptGeneratedInTestRuntimeClasspath(gradleVersion: GradleVersion) {
1277+
project("kapt-in-test-runtime-classpath".withPrefix, gradleVersion) {
1278+
build("test") {
1279+
assertFileInProjectExists("build/tmp/kapt3/classes/main/META-INF/services/com.example.SomeInterface")
1280+
}
1281+
}
1282+
}
12721283
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
plugins {
2+
id("org.jetbrains.kotlin.jvm")
3+
id("org.jetbrains.kotlin.kapt")
4+
}
5+
6+
repositories {
7+
mavenLocal()
8+
mavenCentral()
9+
}
10+
11+
dependencies {
12+
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
13+
implementation("com.google.auto.service:auto-service:1.0-rc3")
14+
kapt("com.google.auto.service:auto-service:1.0-rc3")
15+
testImplementation'junit:junit:4.13.2'
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
3+
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
4+
*/
5+
6+
package com.example
7+
8+
import com.google.auto.service.AutoService
9+
import javax.annotation.processing.AbstractProcessor
10+
import javax.annotation.processing.Processor
11+
import javax.annotation.processing.RoundEnvironment
12+
import javax.lang.model.element.TypeElement
13+
import javax.tools.Diagnostic.Kind.MANDATORY_WARNING
14+
15+
interface SomeInterface
16+
17+
@AutoService(SomeInterface::class)
18+
class SomeService : SomeInterface
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
3+
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
4+
*/
5+
6+
package com.example
7+
8+
import org.junit.Test
9+
import java.util.ServiceLoader
10+
11+
class Tests {
12+
@Test
13+
fun testServiceLoading() {
14+
ServiceLoader.load(SomeInterface::class.java).singleOrNull() ?: error("Cannot load SomeInterface implementation, perhaps the service declaration couldn't be found")
15+
}
16+
}

0 commit comments

Comments
 (0)