allow relative friend paths matching relative classpaths
This commit is contained in:
committed by
Alexander Udalov
parent
68deedb589
commit
5c9cbf7e77
@@ -90,7 +90,7 @@ class CliModuleVisibilityManagerImpl(override val enabled: Boolean) : ModuleVisi
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun addFriendPath(path: String) {
|
override fun addFriendPath(path: String) {
|
||||||
friendPaths.add(path)
|
friendPaths.add(File(path).absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
|||||||
@@ -25,22 +25,25 @@ class FriendPathsTest : TestCaseWithTmpdir() {
|
|||||||
private fun getTestDataDirectory(): File = File("compiler/testData/friendPaths/")
|
private fun getTestDataDirectory(): File = File("compiler/testData/friendPaths/")
|
||||||
|
|
||||||
fun testArchive() {
|
fun testArchive() {
|
||||||
val libSrc = File(getTestDataDirectory(), "lib.kt")
|
doTestFriendPaths(File(tmpdir, "lib.jar"))
|
||||||
val libDest = File(tmpdir, "lib.jar")
|
}
|
||||||
CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf("-d", libDest.path, libSrc.path))
|
|
||||||
|
|
||||||
CompilerTestUtil.executeCompilerAssertSuccessful(
|
/** Regression test for KT-29933. */
|
||||||
K2JVMCompiler(),
|
fun testArchiveWithRelativePath() {
|
||||||
listOf(
|
doTestFriendPaths(File(tmpdir, "lib.jar").relativeTo(File("").absoluteFile))
|
||||||
"-d", tmpdir.path, "-cp", libDest.path, File(getTestDataDirectory(), "usage.kt").path,
|
|
||||||
"-Xfriend-paths=${libDest.path}"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testDirectory() {
|
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 libSrc = File(getTestDataDirectory(), "lib.kt")
|
||||||
val libDest = File(tmpdir, "lib")
|
|
||||||
CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf("-d", libDest.path, libSrc.path))
|
CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf("-d", libDest.path, libSrc.path))
|
||||||
|
|
||||||
CompilerTestUtil.executeCompilerAssertSuccessful(
|
CompilerTestUtil.executeCompilerAssertSuccessful(
|
||||||
|
|||||||
Reference in New Issue
Block a user