Filter kapt generate stubs classpath for non-existent entries (KT-37241)

Issue #KT-37241 Fixed
This commit is contained in:
Sergey Igushkin
2020-03-13 21:53:02 +03:00
parent 9daed1f2c6
commit a0aeb1554d
3 changed files with 6 additions and 2 deletions
@@ -541,7 +541,7 @@ open class Kapt3IT : Kapt3BaseIT() {
} }
@Test @Test
fun testKt19179() { fun testKt19179andKt37241() {
val project = Project("kt19179", directoryPrefix = "kapt2") val project = Project("kt19179", directoryPrefix = "kapt2")
project.build("build") { project.build("build") {
@@ -565,6 +565,9 @@ open class Kapt3IT : Kapt3BaseIT() {
":app:kaptGenerateStubsKotlin", ":app:kaptGenerateStubsKotlin",
":app:kaptKotlin" ":app:kaptKotlin"
) )
// Test for KT-37241, check the that non-existent classpath entry is filtered out:
assertNotContains("Classpath entry points to a non-existent location")
} }
project.projectDir.getFileByName("Test.kt").modify { text -> project.projectDir.getFileByName("Test.kt").modify { text ->
@@ -1,4 +1,5 @@
apply plugin: 'kotlin' apply plugin: 'kotlin'
apply plugin: 'java-library'
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
@@ -92,7 +92,7 @@ open class KaptGenerateStubsTask : KotlinCompile() {
args.pluginOptions = (pluginOptionsWithKapt.arguments + args.pluginOptions!!).toTypedArray() args.pluginOptions = (pluginOptionsWithKapt.arguments + args.pluginOptions!!).toTypedArray()
args.verbose = project.hasProperty("kapt.verbose") && project.property("kapt.verbose").toString().toBoolean() == true args.verbose = project.hasProperty("kapt.verbose") && project.property("kapt.verbose").toString().toBoolean() == true
args.classpathAsList = this.compileClasspath.toList() args.classpathAsList = this.compileClasspath.filter { it.exists() }.toList()
args.destinationAsFile = this.destinationDir args.destinationAsFile = this.destinationDir
} }