This commit is contained in:
+3
-1
@@ -360,7 +360,8 @@ task distDef(type: Copy) {
|
||||
destinationDir distDir
|
||||
|
||||
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) {
|
||||
dependsOn("distDef")
|
||||
if (isMac()) {
|
||||
dependsOn('bundleRestricted')
|
||||
}
|
||||
|
||||
+24
-18
@@ -34,14 +34,6 @@ fun generatePlatformLibraries(args: Array<String>) {
|
||||
}
|
||||
|
||||
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 }}]"
|
||||
}
|
||||
|
||||
@@ -83,13 +75,16 @@ private fun generatePlatformLibraries(target: String, inputDirectory: File, outp
|
||||
"-no-default-libs", "-no-endorsed-libs", "-Xpurge-user-libs",
|
||||
*def.depends.flatMap { listOf("-l", "$outputDirectory/${it.name}") }.toTypedArray())
|
||||
println("Processing ${def.name}...")
|
||||
invokeInterop("native", args)?.let { K2Native.mainNoExit(it) }
|
||||
org.jetbrains.kotlin.cli.klib.main(arrayOf("install", outKlib,
|
||||
"-target", target,
|
||||
"-repository", "${outputDirectory.absolutePath}"
|
||||
))
|
||||
if (!saveTemps) {
|
||||
File("$outputDirectory/build-${def.name}").deleteRecursively()
|
||||
try {
|
||||
invokeInterop("native", args)?.let { K2Native.mainNoExit(it) }
|
||||
org.jetbrains.kotlin.cli.klib.main(arrayOf("install", outKlib,
|
||||
"-target", target,
|
||||
"-repository", "${outputDirectory.absolutePath}"
|
||||
))
|
||||
} finally {
|
||||
if (!saveTemps) {
|
||||
File("$outputDirectory/build-${def.name}").deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
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 executorPool = ThreadPoolExecutor(numCores, numCores,
|
||||
10, TimeUnit.SECONDS, ArrayBlockingQueue(1000),
|
||||
Executors.defaultThreadFactory(), RejectedExecutionHandler { r, executor ->
|
||||
Executors.defaultThreadFactory(), RejectedExecutionHandler { r, _ ->
|
||||
println("Execution rejected: $r")
|
||||
throw Error("Must not happen!")
|
||||
})
|
||||
@@ -128,9 +123,20 @@ private fun generatePlatformLibraries(target: String, inputDirectory: File, outp
|
||||
while (def.depends.any { built[it] == 0 }) {
|
||||
Thread.sleep(100)
|
||||
}
|
||||
buildKlib(def)
|
||||
built[def] = 1
|
||||
try {
|
||||
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()
|
||||
if (!saveTemps) {
|
||||
File("$outputDirectory/clangModulesCache").deleteRecursively()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user