committed by
alexander-gorshenev
parent
e327b174a2
commit
dfa509ec5b
@@ -25,9 +25,12 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.konan.DeserializedKlibModuleOrigin
|
||||
import org.jetbrains.kotlin.konan.util.KlibMetadataFactories
|
||||
import org.jetbrains.kotlin.library.*
|
||||
import org.jetbrains.kotlin.library.KotlinAbiVersion
|
||||
import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
import org.jetbrains.kotlin.library.KotlinLibraryVersioning
|
||||
import org.jetbrains.kotlin.library.SerializedMetadata
|
||||
import org.jetbrains.kotlin.library.impl.buildKoltinLibrary
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibraryComponents
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
|
||||
import org.jetbrains.kotlin.library.metadata.parseModuleHeader
|
||||
import org.jetbrains.kotlin.metadata.builtins.BuiltInsBinaryVersion
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -107,8 +110,7 @@ private class KlibMetadataDependencyContainer(
|
||||
val klibFiles = classpathFiles
|
||||
.filter { it.extension == "klib" || it.isDirectory }
|
||||
|
||||
// TODO: need to move K2Metadata to SearchPathResolver.
|
||||
klibFiles.map { resolveSingleFileKlib(org.jetbrains.kotlin.konan.file.File(it.absolutePath)) }
|
||||
klibFiles.map { createKotlinLibrary(org.jetbrains.kotlin.konan.file.File(it.absolutePath)) }
|
||||
}
|
||||
|
||||
private val builtIns
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
import org.jetbrains.kotlin.library.KotlinLibraryProperResolverWithAttributes
|
||||
import org.jetbrains.kotlin.library.UnresolvedLibrary
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibraryComponents
|
||||
import org.jetbrains.kotlin.library.resolver.KotlinLibraryResolveResult
|
||||
import org.jetbrains.kotlin.library.resolver.impl.libraryResolver
|
||||
import org.jetbrains.kotlin.util.Logger
|
||||
@@ -38,7 +37,7 @@ class JsLibraryResolver(
|
||||
emptyList()
|
||||
) {
|
||||
// Stick with the default KotlinLibrary for now.
|
||||
override fun libraryComponentBuilder(file: File, isDefault: Boolean) = createKotlinLibraryComponents(file, isDefault)
|
||||
override fun libraryBuilder(file: File, isDefault: Boolean) = createKotlinLibrary(file, isDefault)
|
||||
}
|
||||
|
||||
// TODO: This is a temporary set of library resolver policies for js compiler.
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.jetbrains.kotlin.konan.util.KlibMetadataFactories
|
||||
import org.jetbrains.kotlin.library.*
|
||||
import org.jetbrains.kotlin.library.impl.buildKoltinLibrary
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibraryComponents
|
||||
import org.jetbrains.kotlin.library.resolver.KotlinLibraryResolveResult
|
||||
import org.jetbrains.kotlin.library.resolver.TopologicalLibraryOrder
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
@@ -74,10 +73,8 @@ val KotlinLibrary.isBuiltIns: Boolean
|
||||
.propertyList(KLIB_PROPERTY_DEPENDS, escapeInQuotes = true)
|
||||
.isEmpty()
|
||||
|
||||
// TODO: The only place loadKlib() is used now is Wasm backend.
|
||||
// Need to move it to SearchPathResolver too.
|
||||
fun loadKlib(klibPath: String) =
|
||||
resolveSingleFileKlib(KFile(KFile(klibPath).absolutePath))
|
||||
createKotlinLibrary(KFile(KFile(klibPath).absolutePath))
|
||||
|
||||
val emptyLoggingContext = object : LoggingContext {
|
||||
override var inVerbosePhase = false
|
||||
|
||||
@@ -23,12 +23,10 @@ const val KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS = "exportForwardDeclarations
|
||||
interface BaseKotlinLibrary {
|
||||
val libraryName: String
|
||||
val libraryFile: File
|
||||
val componentList: List<String>
|
||||
val versions: KotlinLibraryVersioning
|
||||
// Whether this library is default (provided by distribution)?
|
||||
val isDefault: Boolean
|
||||
val manifestProperties: Properties
|
||||
val has_pre_1_4_manifest: Boolean
|
||||
}
|
||||
|
||||
interface MetadataLibrary {
|
||||
|
||||
@@ -30,20 +30,15 @@ interface KotlinLibraryLayout {
|
||||
val libDir: File
|
||||
val libraryName: String
|
||||
get() = libDir.path
|
||||
val component: String?
|
||||
val componentDir: File
|
||||
get() = File(libDir, component!!)
|
||||
val manifestFile
|
||||
get() = File(componentDir, KLIB_MANIFEST_FILE_NAME)
|
||||
val resourcesDir
|
||||
get() = File(componentDir, "resources")
|
||||
val pre_1_4_manifest: File
|
||||
get() = File(libDir, KLIB_MANIFEST_FILE_NAME)
|
||||
val resourcesDir
|
||||
get() = File(libDir, "resources")
|
||||
}
|
||||
|
||||
interface MetadataKotlinLibraryLayout : KotlinLibraryLayout {
|
||||
val metadataDir
|
||||
get() = File(componentDir, "linkdata")
|
||||
get() = File(libDir, "linkdata")
|
||||
val moduleHeaderFile
|
||||
get() = File(metadataDir, KLIB_MODULE_METADATA_FILE_NAME)
|
||||
|
||||
@@ -56,7 +51,7 @@ interface MetadataKotlinLibraryLayout : KotlinLibraryLayout {
|
||||
|
||||
interface IrKotlinLibraryLayout : KotlinLibraryLayout {
|
||||
val irDir
|
||||
get() = File(componentDir, KLIB_IR_FOLDER_NAME)
|
||||
get() = File(libDir, KLIB_IR_FOLDER_NAME)
|
||||
val irDeclarations
|
||||
get() = File(irDir, "irDeclarations.knd")
|
||||
val irSymbols
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.jetbrains.kotlin.library
|
||||
|
||||
import org.jetbrains.kotlin.konan.CompilerVersion
|
||||
import org.jetbrains.kotlin.konan.file.File
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibraryComponents
|
||||
import org.jetbrains.kotlin.library.impl.isPre_1_4_Library
|
||||
import org.jetbrains.kotlin.util.*
|
||||
|
||||
const val KOTLIN_STDLIB_NAME = "stdlib"
|
||||
@@ -23,7 +21,7 @@ interface SearchPathResolverWithAttributes<L: KotlinLibrary>: SearchPathResolver
|
||||
}
|
||||
|
||||
// This is a simple library resolver that only cares for file names.
|
||||
abstract class KotlinLibrarySearchPathResolver<L: KotlinLibrary> (
|
||||
abstract class KotlinLibrarySearchPathResolver<L: KotlinLibrary>(
|
||||
repositories: List<String>,
|
||||
directLibs: List<String>,
|
||||
val distributionKlib: String?,
|
||||
@@ -45,10 +43,10 @@ abstract class KotlinLibrarySearchPathResolver<L: KotlinLibrary> (
|
||||
|
||||
private val repoRoots: List<File> by lazy { repositories.map { File(it) } }
|
||||
|
||||
abstract fun libraryComponentBuilder(file: File, isDefault: Boolean): List<L>
|
||||
abstract fun libraryBuilder(file: File, isDefault: Boolean): L
|
||||
|
||||
private val directLibraries: List<KotlinLibrary> by lazy {
|
||||
directLibs.mapNotNull { found(File(it)) }.flatMap { libraryComponentBuilder(it, false) }
|
||||
directLibs.mapNotNull { found(File(it)) }.map { libraryBuilder(it, false) }
|
||||
}
|
||||
|
||||
// This is the place where we specify the order of library search.
|
||||
@@ -57,7 +55,8 @@ abstract class KotlinLibrarySearchPathResolver<L: KotlinLibrary> (
|
||||
}
|
||||
|
||||
private fun found(candidate: File): File? {
|
||||
fun check(file: File): Boolean = file.exists
|
||||
fun check(file: File): Boolean =
|
||||
file.exists && (file.isFile || File(file, "manifest").exists)
|
||||
|
||||
val noSuffix = File(candidate.path.removeSuffixIfPresent(KLIB_FILE_EXTENSION_WITH_DOT))
|
||||
val withSuffix = File(candidate.path.suffixIfNot(KLIB_FILE_EXTENSION_WITH_DOT))
|
||||
@@ -95,22 +94,11 @@ abstract class KotlinLibrarySearchPathResolver<L: KotlinLibrary> (
|
||||
return sequence.filterNotNull()
|
||||
}
|
||||
|
||||
private fun Sequence<File>.filterOutPre_1_4_libraries(): Sequence<File> = this.filter{
|
||||
if (it.isPre_1_4_Library) {
|
||||
logger.warning("Skipping \"$it\" as it is a pre 1.4 library")
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
override fun resolve(unresolved: UnresolvedLibrary, isDefaultLink: Boolean): L {
|
||||
val givenPath = unresolved.path
|
||||
try {
|
||||
val fileSequence = resolutionSequence(givenPath)
|
||||
val matching = fileSequence
|
||||
.filterOutPre_1_4_libraries()
|
||||
.flatMap { libraryComponentBuilder(it, isDefaultLink).asSequence() }
|
||||
val matching = fileSequence.map { libraryBuilder(it, isDefaultLink) }
|
||||
.map { it.takeIf { libraryMatch(it, unresolved) } }
|
||||
.filterNotNull()
|
||||
|
||||
@@ -225,26 +213,4 @@ abstract class KotlinLibraryProperResolverWithAttributes<L: KotlinLibrary>(
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
class SingleKlibComponentResolver(
|
||||
klibFile: String,
|
||||
knownAbiVersions: List<KotlinAbiVersion>?,
|
||||
logger: Logger
|
||||
) : KotlinLibraryProperResolverWithAttributes<KotlinLibrary>(
|
||||
emptyList(), listOf(klibFile), knownAbiVersions, emptyList(),
|
||||
null, null, false, logger, emptyList()
|
||||
) {
|
||||
override fun libraryComponentBuilder(file: File, isDefault: Boolean) = createKotlinLibraryComponents(file, isDefault)
|
||||
}
|
||||
|
||||
fun resolveSingleFileKlib(libraryFile: File,
|
||||
logger: Logger = object : Logger {
|
||||
override fun log(message: String) {}
|
||||
override fun error(message: String) = kotlin.error("e: $message")
|
||||
override fun warning(message: String) {}
|
||||
override fun fatal(message: String) = kotlin.error("e: $message")
|
||||
}
|
||||
): KotlinLibrary {
|
||||
return SingleKlibComponentResolver(libraryFile.absolutePath, listOf(KotlinAbiVersion.CURRENT), logger).resolve(libraryFile.absolutePath)
|
||||
}
|
||||
@@ -28,21 +28,8 @@ open class BaseKotlinLibraryImpl(
|
||||
override val libraryFile get() = access.klib
|
||||
override val libraryName: String by lazy { access.inPlace { it.libraryName } }
|
||||
|
||||
override val componentList: List<String> by lazy {
|
||||
access.inPlace {
|
||||
it.libDir.listFiles
|
||||
.filter { it.isDirectory }
|
||||
.filter { it.listFiles.map { it.name }.contains(KLIB_MANIFEST_FILE_NAME) }
|
||||
.map { it.name }
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString() = "$libraryName[default=$isDefault]"
|
||||
|
||||
override val has_pre_1_4_manifest: Boolean by lazy {
|
||||
access.inPlace { it.pre_1_4_manifest.exists }
|
||||
}
|
||||
|
||||
override val manifestProperties: Properties by lazy {
|
||||
access.inPlace { it.manifestFile.loadProperties() }
|
||||
}
|
||||
@@ -234,12 +221,11 @@ open class KotlinLibraryImpl(
|
||||
|
||||
fun createKotlinLibrary(
|
||||
libraryFile: File,
|
||||
component: String,
|
||||
isDefault: Boolean = false
|
||||
): KotlinLibrary {
|
||||
val baseAccess = BaseLibraryAccess<KotlinLibraryLayout>(libraryFile, component)
|
||||
val metadataAccess = MetadataLibraryAccess<MetadataKotlinLibraryLayout>(libraryFile, component)
|
||||
val irAccess = IrLibraryAccess<IrKotlinLibraryLayout>(libraryFile, component)
|
||||
val baseAccess = BaseLibraryAccess<KotlinLibraryLayout>(libraryFile)
|
||||
val metadataAccess = MetadataLibraryAccess<MetadataKotlinLibraryLayout>(libraryFile)
|
||||
val irAccess = IrLibraryAccess<IrKotlinLibraryLayout>(libraryFile)
|
||||
|
||||
val base = BaseKotlinLibraryImpl(baseAccess, isDefault)
|
||||
val metadata = MetadataLibraryImpl(metadataAccess)
|
||||
@@ -247,22 +233,4 @@ fun createKotlinLibrary(
|
||||
// val ir = IrPerFileLibraryImpl(irAccess)
|
||||
|
||||
return KotlinLibraryImpl(base, metadata, ir)
|
||||
}
|
||||
|
||||
fun createKotlinLibraryComponents(
|
||||
libraryFile: File,
|
||||
isDefault: Boolean = true
|
||||
) : List<KotlinLibrary> {
|
||||
val baseAccess = BaseLibraryAccess<KotlinLibraryLayout>(libraryFile, null)
|
||||
val base = BaseKotlinLibraryImpl(baseAccess, isDefault)
|
||||
return base.componentList.map {
|
||||
createKotlinLibrary(libraryFile, it, isDefault)
|
||||
}
|
||||
}
|
||||
|
||||
val File.isPre_1_4_Library: Boolean
|
||||
get() {
|
||||
val baseAccess = BaseLibraryAccess<KotlinLibraryLayout>(this, null)
|
||||
val base = BaseKotlinLibraryImpl(baseAccess, false)
|
||||
return base.has_pre_1_4_manifest
|
||||
}
|
||||
}
|
||||
+9
-11
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.library.*
|
||||
import org.jetbrains.kotlin.util.removeSuffixIfPresent
|
||||
import java.nio.file.FileSystem
|
||||
|
||||
open class KotlinLibraryLayoutImpl(val klib: File, override val component: String?) : KotlinLibraryLayout {
|
||||
open class KotlinLibraryLayoutImpl(val klib: File) : KotlinLibraryLayout {
|
||||
val isZipped = klib.isFile
|
||||
|
||||
init {
|
||||
@@ -32,7 +32,7 @@ open class KotlinLibraryLayoutImpl(val klib: File, override val component: Strin
|
||||
|
||||
}
|
||||
|
||||
class MetadataLibraryLayoutImpl(klib: File, component: String) : KotlinLibraryLayoutImpl(klib, component), MetadataKotlinLibraryLayout {
|
||||
class MetadataLibraryLayoutImpl(klib: File) : KotlinLibraryLayoutImpl(klib), MetadataKotlinLibraryLayout {
|
||||
|
||||
override val extractingToTemp: MetadataKotlinLibraryLayout by lazy {
|
||||
ExtractingMetadataLibraryImpl(this)
|
||||
@@ -42,7 +42,7 @@ class MetadataLibraryLayoutImpl(klib: File, component: String) : KotlinLibraryLa
|
||||
FromZipMetadataLibraryImpl(this, zipFileSystem)
|
||||
}
|
||||
|
||||
class IrLibraryLayoutImpl(klib: File, component: String) : KotlinLibraryLayoutImpl(klib, component), IrKotlinLibraryLayout {
|
||||
class IrLibraryLayoutImpl(klib: File) : KotlinLibraryLayoutImpl(klib), IrKotlinLibraryLayout {
|
||||
|
||||
override val extractingToTemp: IrKotlinLibraryLayout by lazy {
|
||||
ExtractingIrLibraryImpl(this)
|
||||
@@ -52,8 +52,8 @@ class IrLibraryLayoutImpl(klib: File, component: String) : KotlinLibraryLayoutIm
|
||||
FromZipIrLibraryImpl(this, zipFileSystem)
|
||||
}
|
||||
|
||||
open class BaseLibraryAccess<L : KotlinLibraryLayout>(val klib: File, component: String?) {
|
||||
open val layout = KotlinLibraryLayoutImpl(klib, component)
|
||||
open class BaseLibraryAccess<L : KotlinLibraryLayout>(val klib: File) {
|
||||
open val layout = KotlinLibraryLayoutImpl(klib)
|
||||
|
||||
fun <T> realFiles(action: (L) -> T): T =
|
||||
if (layout.isZipped)
|
||||
@@ -71,12 +71,12 @@ open class BaseLibraryAccess<L : KotlinLibraryLayout>(val klib: File, component:
|
||||
}
|
||||
|
||||
|
||||
open class MetadataLibraryAccess<L : KotlinLibraryLayout>(klib: File, component: String) : BaseLibraryAccess<L>(klib, component) {
|
||||
override val layout = MetadataLibraryLayoutImpl(klib, component)
|
||||
open class MetadataLibraryAccess<L : KotlinLibraryLayout>(klib: File) : BaseLibraryAccess<L>(klib) {
|
||||
override val layout = MetadataLibraryLayoutImpl(klib)
|
||||
}
|
||||
|
||||
open class IrLibraryAccess<L : KotlinLibraryLayout>(klib: File, component: String) : BaseLibraryAccess<L>(klib, component) {
|
||||
override val layout = IrLibraryLayoutImpl(klib, component)
|
||||
open class IrLibraryAccess<L : KotlinLibraryLayout>(klib: File) : BaseLibraryAccess<L>(klib) {
|
||||
override val layout = IrLibraryLayoutImpl(klib)
|
||||
}
|
||||
|
||||
open class FromZipBaseLibraryImpl(zipped: KotlinLibraryLayoutImpl, zipFileSystem: FileSystem) :
|
||||
@@ -84,7 +84,6 @@ open class FromZipBaseLibraryImpl(zipped: KotlinLibraryLayoutImpl, zipFileSystem
|
||||
|
||||
override val libraryName = zipped.libraryName
|
||||
override val libDir = zipFileSystem.file(zipped.libDir)
|
||||
override val component = zipped.component
|
||||
}
|
||||
|
||||
class FromZipMetadataLibraryImpl(zipped: MetadataLibraryLayoutImpl, zipFileSystem: FileSystem) :
|
||||
@@ -114,7 +113,6 @@ fun KotlinLibraryLayoutImpl.extractDir(directory: File): File = this.klib.withZi
|
||||
open class ExtractingKotlinLibraryLayout(zipped: KotlinLibraryLayoutImpl) : KotlinLibraryLayout {
|
||||
override val libDir: File get() = error("Extracting layout doesn't extract its own root")
|
||||
override val libraryName = zipped.libraryName
|
||||
override val component = zipped.component
|
||||
}
|
||||
|
||||
open class ExtractingBaseLibraryImpl(zipped: KotlinLibraryLayoutImpl) :
|
||||
|
||||
@@ -11,11 +11,8 @@ import org.jetbrains.kotlin.konan.properties.Properties
|
||||
import org.jetbrains.kotlin.konan.properties.saveToFile
|
||||
import org.jetbrains.kotlin.library.*
|
||||
|
||||
const val KLIB_DEFAULT_COMPONENT_NAME = "default"
|
||||
|
||||
open class KotlinLibraryLayoutForWriter(
|
||||
override val libDir: File,
|
||||
override val component: String = KLIB_DEFAULT_COMPONENT_NAME
|
||||
override val libDir: File
|
||||
) : KotlinLibraryLayout, MetadataKotlinLibraryLayout, IrKotlinLibraryLayout
|
||||
|
||||
open class BaseWriterImpl(
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.jetbrains.kotlin.konan.library.KonanFactories
|
||||
import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
|
||||
import org.jetbrains.kotlin.library.isInterop
|
||||
import org.jetbrains.kotlin.library.resolveSingleFileKlib
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.impl.NativeIdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
@@ -189,7 +188,7 @@ class NativeLibraryInfo(project: Project, library: Library, val libraryRoot: Str
|
||||
}
|
||||
}
|
||||
|
||||
private val nativeLibrary = resolveSingleFileKlib(File(libraryRoot))
|
||||
private val nativeLibrary = createKotlinLibrary(File(libraryRoot))
|
||||
|
||||
val isStdlib get() = libraryRoot.endsWith(KONAN_STDLIB_NAME)
|
||||
val metadataInfo by lazy {
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
import org.jetbrains.kotlin.library.SerializedMetadata
|
||||
import org.jetbrains.kotlin.library.impl.BaseWriterImpl
|
||||
import org.jetbrains.kotlin.library.impl.KoltinLibraryWriterImpl
|
||||
import org.jetbrains.kotlin.library.resolveSingleFileKlib
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.konan.impl.KlibResolvedModuleDescriptorsFactoryImpl
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
@@ -143,7 +143,7 @@ class NativeDistributionCommonizer(
|
||||
if (!location.isDirectory)
|
||||
handleError("library not found: $location")
|
||||
|
||||
val library = resolveSingleFileKlib(KFile(location.path))
|
||||
val library = createKotlinLibrary(KFile(location.path))
|
||||
|
||||
if (library.versions.metadataVersion == null)
|
||||
handleError("library does not have metadata version specified in manifest: $location")
|
||||
|
||||
@@ -68,11 +68,10 @@ class Distribution(
|
||||
|
||||
val klib = "$konanHome/klib"
|
||||
val stdlib = "$klib/common/stdlib"
|
||||
val stdlibDefaultComponent = "$stdlib/default"
|
||||
|
||||
fun defaultNatives(target: KonanTarget) = "$konanHome/konan/targets/${target.visibleName}/native"
|
||||
|
||||
fun runtime(target: KonanTarget) = runtimeFileOverride ?: "$stdlibDefaultComponent/targets/${target.visibleName}/native/runtime.bc"
|
||||
fun runtime(target: KonanTarget) = runtimeFileOverride ?: "$stdlib/targets/${target.visibleName}/native/runtime.bc"
|
||||
|
||||
val launcherFiles = listOf("launcher.bc")
|
||||
|
||||
|
||||
+2
-3
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.konan.target.CompilerOutputKind.*
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
|
||||
import org.jetbrains.kotlin.library.resolveSingleFileKlib
|
||||
import org.jetbrains.kotlin.library.uniqueName
|
||||
import org.jetbrains.kotlin.library.unresolvedDependencies
|
||||
import java.io.File
|
||||
@@ -729,7 +728,7 @@ class CacheBuilder(val project: Project, val binary: NativeBinary) {
|
||||
cacheDirectory.mkdirs()
|
||||
|
||||
val artifactsLibraries = artifactsToAddToCache
|
||||
.map { resolveSingleFileKlib(org.jetbrains.kotlin.konan.file.File(it.file.absolutePath)) }
|
||||
.map { createKotlinLibrary(org.jetbrains.kotlin.konan.file.File(it.file.absolutePath)) }
|
||||
.associateBy { it.uniqueName }
|
||||
|
||||
// Top sort artifacts.
|
||||
@@ -798,7 +797,7 @@ class CacheBuilder(val project: Project, val binary: NativeBinary) {
|
||||
val platformLib = platformLibs[platformLibName] ?: error("$platformLibName is not found in platform libs")
|
||||
if (File(rootCacheDirectory, platformLibName.cachedName).exists())
|
||||
return
|
||||
for (dependency in resolveSingleFileKlib(org.jetbrains.kotlin.konan.file.File(platformLib.absolutePath)).unresolvedDependencies)
|
||||
for (dependency in createKotlinLibrary(org.jetbrains.kotlin.konan.file.File(platformLib.absolutePath)).unresolvedDependencies)
|
||||
ensureCompilerProvidedLibPrecached(dependency.path, platformLibs, visitedLibs)
|
||||
project.logger.info("Compiling $platformLibName (${visitedLibs.size}/${platformLibs.size}) to cache")
|
||||
val args = mutableListOf(
|
||||
|
||||
Reference in New Issue
Block a user