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) {
|
||||
friendPaths.add(path)
|
||||
friendPaths.add(File(path).absolutePath)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user