This commit is contained in:
+3
-1
@@ -360,7 +360,8 @@ task distDef(type: Copy) {
|
|||||||
destinationDir distDir
|
destinationDir distDir
|
||||||
|
|
||||||
from(project("platformLibs").file("src/platform")) {
|
from(project("platformLibs").file("src/platform")) {
|
||||||
into('klib/platformDef')
|
into('konan/platformDef')
|
||||||
|
include '**/*.def'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,6 +466,7 @@ task crossDist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task bundle(type: (isWindows()) ? Zip : Tar) {
|
task bundle(type: (isWindows()) ? Zip : Tar) {
|
||||||
|
dependsOn("distDef")
|
||||||
if (isMac()) {
|
if (isMac()) {
|
||||||
dependsOn('bundleRestricted')
|
dependsOn('bundleRestricted')
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-18
@@ -34,14 +34,6 @@ fun generatePlatformLibraries(args: Array<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class DefFile(val name: String, val depends: MutableList<DefFile>) {
|
private class DefFile(val name: String, val depends: MutableList<DefFile>) {
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
|
||||||
return name.hashCode()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
|
||||||
return other is DefFile && other.name == name
|
|
||||||
}
|
|
||||||
override fun toString(): String = "$name: [${depends.joinToString(separator = ", ") { it.name }}]"
|
override fun toString(): String = "$name: [${depends.joinToString(separator = ", ") { it.name }}]"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,13 +75,16 @@ private fun generatePlatformLibraries(target: String, inputDirectory: File, outp
|
|||||||
"-no-default-libs", "-no-endorsed-libs", "-Xpurge-user-libs",
|
"-no-default-libs", "-no-endorsed-libs", "-Xpurge-user-libs",
|
||||||
*def.depends.flatMap { listOf("-l", "$outputDirectory/${it.name}") }.toTypedArray())
|
*def.depends.flatMap { listOf("-l", "$outputDirectory/${it.name}") }.toTypedArray())
|
||||||
println("Processing ${def.name}...")
|
println("Processing ${def.name}...")
|
||||||
invokeInterop("native", args)?.let { K2Native.mainNoExit(it) }
|
try {
|
||||||
org.jetbrains.kotlin.cli.klib.main(arrayOf("install", outKlib,
|
invokeInterop("native", args)?.let { K2Native.mainNoExit(it) }
|
||||||
"-target", target,
|
org.jetbrains.kotlin.cli.klib.main(arrayOf("install", outKlib,
|
||||||
"-repository", "${outputDirectory.absolutePath}"
|
"-target", target,
|
||||||
))
|
"-repository", "${outputDirectory.absolutePath}"
|
||||||
if (!saveTemps) {
|
))
|
||||||
File("$outputDirectory/build-${def.name}").deleteRecursively()
|
} finally {
|
||||||
|
if (!saveTemps) {
|
||||||
|
File("$outputDirectory/build-${def.name}").deleteRecursively()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println("generate platform libraries from $inputDirectory to $outputDirectory for $target")
|
println("generate platform libraries from $inputDirectory to $outputDirectory for $target")
|
||||||
@@ -116,7 +111,7 @@ private fun generatePlatformLibraries(target: String, inputDirectory: File, outp
|
|||||||
val numCores = Runtime.getRuntime().availableProcessors()
|
val numCores = Runtime.getRuntime().availableProcessors()
|
||||||
val executorPool = ThreadPoolExecutor(numCores, numCores,
|
val executorPool = ThreadPoolExecutor(numCores, numCores,
|
||||||
10, TimeUnit.SECONDS, ArrayBlockingQueue(1000),
|
10, TimeUnit.SECONDS, ArrayBlockingQueue(1000),
|
||||||
Executors.defaultThreadFactory(), RejectedExecutionHandler { r, executor ->
|
Executors.defaultThreadFactory(), RejectedExecutionHandler { r, _ ->
|
||||||
println("Execution rejected: $r")
|
println("Execution rejected: $r")
|
||||||
throw Error("Must not happen!")
|
throw Error("Must not happen!")
|
||||||
})
|
})
|
||||||
@@ -128,9 +123,20 @@ private fun generatePlatformLibraries(target: String, inputDirectory: File, outp
|
|||||||
while (def.depends.any { built[it] == 0 }) {
|
while (def.depends.any { built[it] == 0 }) {
|
||||||
Thread.sleep(100)
|
Thread.sleep(100)
|
||||||
}
|
}
|
||||||
buildKlib(def)
|
try {
|
||||||
built[def] = 1
|
if (def.depends.any { built[it] == 2 }) {
|
||||||
|
throw Error("There are failed dependencies for $def")
|
||||||
|
}
|
||||||
|
buildKlib(def)
|
||||||
|
built[def] = 1
|
||||||
|
} catch(e: Throwable) {
|
||||||
|
built[def] = 2
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
executorPool.shutdown()
|
executorPool.shutdown()
|
||||||
|
if (!saveTemps) {
|
||||||
|
File("$outputDirectory/clangModulesCache").deleteRecursively()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user