Brought back our ability to have non-platform specific default libraries.

Separated dist/klib libraries into common and platform parts to exclude name clash.
This commit is contained in:
Alexander Gorshenev
2017-10-19 20:23:06 +03:00
committed by alexander-gorshenev
parent 0f693d63e4
commit 7ade68452e
4 changed files with 17 additions and 13 deletions
@@ -44,7 +44,7 @@ class Distribution(val targetManager: TargetManager,
val properties = File(propertyFileName).loadProperties()
val klib = "$konanHome/klib"
val stdlib = "$klib/stdlib"
val stdlib = "$klib/common/stdlib"
val runtime = runtimeFileOverride ?: "$stdlib/targets/${targetName}/native/runtime.bc"
val dependenciesDir = "$konanHome/dependencies"
@@ -130,10 +130,10 @@ class KonanLibrarySearchPathResolver(
get() = localKonanDir?.File()?.klib
val distHead: File?
get() = distributionKlib?.File()
get() = distributionKlib?.File()?.child("common")
val distPlatformHead: File?
get() = targetManager?.let { distHead?.child(targetManager.targetName) }
get() = targetManager?.let { distributionKlib?.File()?.child("platform")?.child(targetManager.targetName) }
val currentDirHead: File?
get() = if (!skipCurrentDir) File.userDir else null
@@ -176,11 +176,13 @@ class KonanLibrarySearchPathResolver(
get() = File(this, "klib")
// The libraries from the default root are linked automatically.
val defaultRoot: File?
get() = if (distPlatformHead?.exists ?: false) distPlatformHead else null
val defaultRoots: List<File>
get() = listOf(distHead, distPlatformHead)
.filterNotNull()
.filter{ it.exists }
override fun defaultLinks(nostdlib: Boolean, noDefaultLibs: Boolean): List<File> {
val defaultLibs = defaultRoot?.listFiles.orEmpty()
val defaultLibs = defaultRoots.flatMap{ it.listFiles }
.filterNot { it.name.removeSuffixIfPresent(".klib") == "stdlib" }
.map { File(it.absolutePath) }
val result = mutableListOf<File>()