diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt index bebc223c12e..3f55f66e911 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt @@ -90,7 +90,7 @@ class CliModuleVisibilityManagerImpl(override val enabled: Boolean) : ModuleVisi } override fun addFriendPath(path: String) { - friendPaths.add(path) + friendPaths.add(File(path).absolutePath) } override fun dispose() { diff --git a/compiler/tests/org/jetbrains/kotlin/cli/FriendPathsTest.kt b/compiler/tests/org/jetbrains/kotlin/cli/FriendPathsTest.kt index 62e4512db59..543f0771901 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/FriendPathsTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/cli/FriendPathsTest.kt @@ -25,22 +25,25 @@ class FriendPathsTest : TestCaseWithTmpdir() { private fun getTestDataDirectory(): File = File("compiler/testData/friendPaths/") fun testArchive() { - val libSrc = File(getTestDataDirectory(), "lib.kt") - val libDest = File(tmpdir, "lib.jar") - CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf("-d", libDest.path, libSrc.path)) + doTestFriendPaths(File(tmpdir, "lib.jar")) + } - CompilerTestUtil.executeCompilerAssertSuccessful( - K2JVMCompiler(), - listOf( - "-d", tmpdir.path, "-cp", libDest.path, File(getTestDataDirectory(), "usage.kt").path, - "-Xfriend-paths=${libDest.path}" - ) - ) + /** Regression test for KT-29933. */ + fun testArchiveWithRelativePath() { + doTestFriendPaths(File(tmpdir, "lib.jar").relativeTo(File("").absoluteFile)) } fun testDirectory() { + doTestFriendPaths(File(tmpdir, "lib")) + } + + /** Regression test for KT-29933. */ + fun testDirectoryWithRelativePath() { + doTestFriendPaths(File(tmpdir, "lib").relativeTo(File("").absoluteFile)) + } + + private fun doTestFriendPaths(libDest: File) { val libSrc = File(getTestDataDirectory(), "lib.kt") - val libDest = File(tmpdir, "lib") CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf("-d", libDest.path, libSrc.path)) CompilerTestUtil.executeCompilerAssertSuccessful(