Fix internals with symlinked friend paths (KT-35341)
The friend paths converted to canonical paths didn't match absolute paths in the compiler code in case of symlinked directories. This fixes a regression. Issue #KT-35341 Fixed
This commit is contained in:
+17
-2
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.gradle.util.*
|
|||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.nio.file.Files
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertNotEquals
|
import kotlin.test.assertNotEquals
|
||||||
@@ -678,8 +679,22 @@ class KotlinGradleIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testInternalTest() {
|
fun testInternalTest() = with(
|
||||||
Project("internalTest").build("build") {
|
Project("internalTest")
|
||||||
|
) {
|
||||||
|
build("build") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertReportExists()
|
||||||
|
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check KT-35341: use symlinked build dir
|
||||||
|
val buildDir = projectDir.resolve("build")
|
||||||
|
buildDir.deleteRecursively()
|
||||||
|
val externalBuildDir = Files.createTempDirectory(workingDir.toPath(), "externalBuild")
|
||||||
|
Files.createSymbolicLink(buildDir.toPath(), externalBuildDir)
|
||||||
|
|
||||||
|
build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertReportExists()
|
assertReportExists()
|
||||||
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
||||||
|
|||||||
+1
-1
@@ -256,7 +256,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
|||||||
associateWithTransitiveClosure
|
associateWithTransitiveClosure
|
||||||
.flatMap { it.output.classesDirs }
|
.flatMap { it.output.classesDirs }
|
||||||
.plus(friendArtifacts)
|
.plus(friendArtifacts)
|
||||||
.map { it.canonicalPath }.toTypedArray()
|
.map { it.absolutePath }.toTypedArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user