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:
committed by
alexander-gorshenev
parent
0f693d63e4
commit
7ade68452e
+1
-1
@@ -44,7 +44,7 @@ class Distribution(val targetManager: TargetManager,
|
|||||||
val properties = File(propertyFileName).loadProperties()
|
val properties = File(propertyFileName).loadProperties()
|
||||||
|
|
||||||
val klib = "$konanHome/klib"
|
val klib = "$konanHome/klib"
|
||||||
val stdlib = "$klib/stdlib"
|
val stdlib = "$klib/common/stdlib"
|
||||||
val runtime = runtimeFileOverride ?: "$stdlib/targets/${targetName}/native/runtime.bc"
|
val runtime = runtimeFileOverride ?: "$stdlib/targets/${targetName}/native/runtime.bc"
|
||||||
|
|
||||||
val dependenciesDir = "$konanHome/dependencies"
|
val dependenciesDir = "$konanHome/dependencies"
|
||||||
|
|||||||
+7
-5
@@ -130,10 +130,10 @@ class KonanLibrarySearchPathResolver(
|
|||||||
get() = localKonanDir?.File()?.klib
|
get() = localKonanDir?.File()?.klib
|
||||||
|
|
||||||
val distHead: File?
|
val distHead: File?
|
||||||
get() = distributionKlib?.File()
|
get() = distributionKlib?.File()?.child("common")
|
||||||
|
|
||||||
val distPlatformHead: File?
|
val distPlatformHead: File?
|
||||||
get() = targetManager?.let { distHead?.child(targetManager.targetName) }
|
get() = targetManager?.let { distributionKlib?.File()?.child("platform")?.child(targetManager.targetName) }
|
||||||
|
|
||||||
val currentDirHead: File?
|
val currentDirHead: File?
|
||||||
get() = if (!skipCurrentDir) File.userDir else null
|
get() = if (!skipCurrentDir) File.userDir else null
|
||||||
@@ -176,11 +176,13 @@ class KonanLibrarySearchPathResolver(
|
|||||||
get() = File(this, "klib")
|
get() = File(this, "klib")
|
||||||
|
|
||||||
// The libraries from the default root are linked automatically.
|
// The libraries from the default root are linked automatically.
|
||||||
val defaultRoot: File?
|
val defaultRoots: List<File>
|
||||||
get() = if (distPlatformHead?.exists ?: false) distPlatformHead else null
|
get() = listOf(distHead, distPlatformHead)
|
||||||
|
.filterNotNull()
|
||||||
|
.filter{ it.exists }
|
||||||
|
|
||||||
override fun defaultLinks(nostdlib: Boolean, noDefaultLibs: Boolean): List<File> {
|
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" }
|
.filterNot { it.name.removeSuffixIfPresent(".klib") == "stdlib" }
|
||||||
.map { File(it.absolutePath) }
|
.map { File(it.absolutePath) }
|
||||||
val result = mutableListOf<File>()
|
val result = mutableListOf<File>()
|
||||||
|
|||||||
+7
-5
@@ -231,13 +231,15 @@ task distRuntime(type: Copy) {
|
|||||||
dependsOn('commonDistRuntime')
|
dependsOn('commonDistRuntime')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def stdlib = 'klib/common/stdlib'
|
||||||
|
|
||||||
task commonDistRuntime(type: Copy) {
|
task commonDistRuntime(type: Copy) {
|
||||||
destinationDir file('dist')
|
destinationDir file('dist')
|
||||||
|
|
||||||
// Target independant common part.
|
// Target independant common part.
|
||||||
from(project(':runtime').file("build/${hostName}Stdlib")) {
|
from(project(':runtime').file("build/${hostName}Stdlib")) {
|
||||||
include('**')
|
include('**')
|
||||||
into('klib/stdlib')
|
into(stdlib)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,19 +262,19 @@ targetList.each { target ->
|
|||||||
|
|
||||||
from(project(':runtime').file("build/$target")) {
|
from(project(':runtime').file("build/$target")) {
|
||||||
include("*.bc")
|
include("*.bc")
|
||||||
into("klib/stdlib/targets/$target/native")
|
into("$stdlib/targets/$target/native")
|
||||||
}
|
}
|
||||||
from(project(':runtime').file("build/${target}Stdlib")) {
|
from(project(':runtime').file("build/${target}Stdlib")) {
|
||||||
include('**')
|
include('**')
|
||||||
into('klib/stdlib')
|
into(stdlib)
|
||||||
}
|
}
|
||||||
from(project(':runtime').file("build/${target}Start.bc")) {
|
from(project(':runtime').file("build/${target}Start.bc")) {
|
||||||
rename("${target}Start.bc", 'start.bc')
|
rename("${target}Start.bc", 'start.bc')
|
||||||
into("klib/stdlib/targets/$target/native")
|
into("$stdlib/targets/$target/native")
|
||||||
}
|
}
|
||||||
if (target == 'wasm32') {
|
if (target == 'wasm32') {
|
||||||
from(project(':runtime').file('src/launcher/js')) {
|
from(project(':runtime').file('src/launcher/js')) {
|
||||||
into('klib/stdlib/targets/wasm32/included')
|
into('$stdlib/targets/wasm32/included')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ konanArtifacts {
|
|||||||
defFile gradle.startParameter.projectProperties.defFile
|
defFile gradle.startParameter.projectProperties.defFile
|
||||||
noDefaultLibs true
|
noDefaultLibs true
|
||||||
libraries {
|
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"
|
def klibProgram = suffix?"$konanHome/bin/klib.$suffix" : "$konanHome/bin/klib"
|
||||||
|
|
||||||
task klibInstall(type:Exec) {
|
task klibInstall(type:Exec) {
|
||||||
String repo = "$konanHome/klib/$targetName"
|
String repo = "$konanHome/klib/platform/$targetName"
|
||||||
doFirst {
|
doFirst {
|
||||||
new File(repo).mkdirs()
|
new File(repo).mkdirs()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user