IC: add destination dir to start of classpath instead of end

Otherwise IC fails when a project declares a class with the same name
as in one of its dependencies.
The issue is relevant only for non-JPS IC (Gradle, Maven, etc.),
but I added the test for JPS too.

  #KT-20516 fixed
This commit is contained in:
Alexey Tsvetkov
2018-03-21 14:35:57 +03:00
parent 55cbd28910
commit 605bcc66a1
26 changed files with 93 additions and 1 deletions
@@ -22,6 +22,21 @@ class IncrementalCompilationMultiProjectIT : BaseGradleIT() {
override fun defaultBuildOptions(): BuildOptions =
super.defaultBuildOptions().copy(withDaemon = true, incremental = true)
@Test
fun testDuplicatedClass() {
val project = Project("duplicatedClass")
project.build("build") {
assertSuccessful()
}
val usagesFiles = listOf("useBuzz.kt", "useA.kt").map { project.projectFile(it) }
usagesFiles.forEach { file -> file.modify { "$it\n " } }
project.build("build") {
assertSuccessful()
assertCompiledKotlinSources(project.relativize(usagesFiles))
}
}
@Test
fun testMoveFunctionFromLib() {
@@ -0,0 +1,5 @@
apply plugin: 'kotlin'
dependencies {
compile project(':lib')
}
@@ -0,0 +1,9 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -19,6 +19,8 @@ package org.jetbrains.kotlin.incremental
import org.gradle.api.Project
import java.io.File
// todo: Move all files under org.jetbrains.kotlin.gradle package to avoid class clash (KT-18621, KT-20516)
internal fun File.isJavaFile() =
extension.equals("java", ignoreCase = true)