Do not remove annotations.txt (kapt1) file before kotlin compiler is called
#KT-14250 fixed Before this change the following could happen: 0. Successful build. 1. Only java files are changed. 2. CompileKotlin task starts because java files are also input files for kotlin. 3. annotations.txt file is deleted, but kotlin compiler is not called, so it is not regenerated. 4. Javac fails.
This commit is contained in:
+18
@@ -202,4 +202,22 @@ class KaptIT: BaseGradleIT() {
|
||||
assertCompiledKotlinSources(project.relativize(internalDummyUserKt, internalDummyTestKt))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testKotlinCompilerNotCalledStubsIC() {
|
||||
val options = defaultBuildOptions().copy(incremental = true)
|
||||
val project = Project("kaptStubs", GRADLE_VERSION)
|
||||
|
||||
project.build("build", options = options) {
|
||||
assertSuccessful()
|
||||
}
|
||||
|
||||
val javaDummy = project.projectDir.getFileByName("JavaDummy.java")
|
||||
javaDummy.modify { it + " " }
|
||||
|
||||
project.build("build", options = options) {
|
||||
assertSuccessful()
|
||||
assertCompiledKotlinSources(emptyList())
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package javaPackage;
|
||||
|
||||
public class JavaDummy {
|
||||
}
|
||||
-1
@@ -534,7 +534,6 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
kaptAnnotationsFileUpdater = AnnotationFileUpdater(kaptAnnotationsFile)
|
||||
}
|
||||
|
||||
if (kaptAnnotationsFile.exists()) kaptAnnotationsFile.delete()
|
||||
pluginOptions.addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "output", kaptAnnotationsFile.canonicalPath)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user