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>()
+7 -5
View File
@@ -231,13 +231,15 @@ task distRuntime(type: Copy) {
dependsOn('commonDistRuntime')
}
def stdlib = 'klib/common/stdlib'
task commonDistRuntime(type: Copy) {
destinationDir file('dist')
// Target independant common part.
from(project(':runtime').file("build/${hostName}Stdlib")) {
include('**')
into('klib/stdlib')
into(stdlib)
}
}
@@ -260,19 +262,19 @@ targetList.each { target ->
from(project(':runtime').file("build/$target")) {
include("*.bc")
into("klib/stdlib/targets/$target/native")
into("$stdlib/targets/$target/native")
}
from(project(':runtime').file("build/${target}Stdlib")) {
include('**')
into('klib/stdlib')
into(stdlib)
}
from(project(':runtime').file("build/${target}Start.bc")) {
rename("${target}Start.bc", 'start.bc')
into("klib/stdlib/targets/$target/native")
into("$stdlib/targets/$target/native")
}
if (target == 'wasm32') {
from(project(':runtime').file('src/launcher/js')) {
into('klib/stdlib/targets/wasm32/included')
into('$stdlib/targets/wasm32/included')
}
}
}
+2 -2
View File
@@ -20,7 +20,7 @@ konanArtifacts {
defFile gradle.startParameter.projectProperties.defFile
noDefaultLibs true
libraries {
files libs.collect { "$konanHome/klib/$targetName/$it" }
files libs.collect { "$konanHome/klib/platform/$targetName/$it" }
}
}
}
@@ -29,7 +29,7 @@ def suffix = gradle.startParameter.projectProperties['suffix']
def klibProgram = suffix?"$konanHome/bin/klib.$suffix" : "$konanHome/bin/klib"
task klibInstall(type:Exec) {
String repo = "$konanHome/klib/$targetName"
String repo = "$konanHome/klib/platform/$targetName"
doFirst {
new File(repo).mkdirs()
}