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:
Sergey Igushkin
2020-06-22 13:29:51 +03:00
parent 5b1d019bb0
commit cb936dd82e
2 changed files with 18 additions and 3 deletions
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.gradle.util.*
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.junit.Test
import java.io.File
import java.nio.file.Files
import java.util.zip.ZipFile
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
@@ -678,8 +679,22 @@ class KotlinGradleIT : BaseGradleIT() {
}
@Test
fun testInternalTest() {
Project("internalTest").build("build") {
fun testInternalTest() = with(
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()
assertReportExists()
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
@@ -256,7 +256,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
associateWithTransitiveClosure
.flatMap { it.output.classesDirs }
.plus(friendArtifacts)
.map { it.canonicalPath }.toTypedArray()
.map { it.absolutePath }.toTypedArray()
}
}