[K/N] Normalize klib paths for KonanLibraryImpl
^KT-58979 Fixed Merge-request: KT-MR-10372 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
e11ebcadb4
commit
ebc4cf7f96
@@ -14,7 +14,7 @@ object KonanHomeProvider {
|
||||
/**
|
||||
* Determines a path to the current Kotlin/Native distribution.
|
||||
*
|
||||
* - If the system property "konan.home" is set, the method returns its value.
|
||||
* - If the system property "konan.home" is set, the method returns its normalized value.
|
||||
* - Otherwise, it determines a path to a jar containing this class. If this path corresponds to the jar path
|
||||
* inside a distribution, the method calculates the path to the distribution on the basis of this jar path.
|
||||
* Otherwise an IllegalStateException is thrown.
|
||||
@@ -22,7 +22,9 @@ object KonanHomeProvider {
|
||||
fun determineKonanHome(): String {
|
||||
val propertyValue = kotlinNativeHome
|
||||
return if (propertyValue != null) {
|
||||
File(propertyValue).absolutePath
|
||||
// KT-58979: KonanLibraryImpl needs normalized klib paths to correctly provide symbols from resolved klibs
|
||||
// For extra safety, path to "konan.home" is also normalized here
|
||||
Paths.get(File(propertyValue).absolutePath).normalize().toString()
|
||||
} else {
|
||||
val jarPath = PathUtil.getResourcePathForClass(this::class.java)
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ package org.jetbrains.kotlin.konan.library.impl
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.konan.library.*
|
||||
import org.jetbrains.kotlin.konan.properties.Properties
|
||||
import org.jetbrains.kotlin.konan.properties.loadProperties
|
||||
import org.jetbrains.kotlin.konan.properties.propertyList
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.util.defaultTargetSubstitutions
|
||||
import org.jetbrains.kotlin.konan.util.substitute
|
||||
import org.jetbrains.kotlin.library.*
|
||||
import org.jetbrains.kotlin.library.impl.*
|
||||
import java.nio.file.Paths
|
||||
|
||||
open class TargetedLibraryImpl(
|
||||
private val access: TargetedLibraryAccess<TargetedKotlinLibraryLayout>,
|
||||
@@ -81,11 +81,13 @@ class KonanLibraryImpl(
|
||||
|
||||
|
||||
fun createKonanLibrary(
|
||||
libraryFile: File,
|
||||
libraryFilePossiblyDenormalized: File,
|
||||
component: String,
|
||||
target: KonanTarget? = null,
|
||||
isDefault: Boolean = false
|
||||
): KonanLibrary {
|
||||
// KT-58979: The following access classes need normalized klib path to correctly provide symbols from resolved klibs
|
||||
val libraryFile = Paths.get(libraryFilePossiblyDenormalized.absolutePath).normalize().File()
|
||||
val baseAccess = BaseLibraryAccess<KotlinLibraryLayout>(libraryFile, component)
|
||||
val targetedAccess = TargetedLibraryAccess<TargetedKotlinLibraryLayout>(libraryFile, component, target)
|
||||
val metadataAccess = MetadataLibraryAccess<MetadataKotlinLibraryLayout>(libraryFile, component)
|
||||
|
||||
Reference in New Issue
Block a user