[K/N][build] Move stdlib caching to runtime project
This commit is contained in:
@@ -471,7 +471,7 @@ targetList.each { target ->
|
|||||||
if (target in cacheableTargetNames) {
|
if (target in cacheableTargetNames) {
|
||||||
task ("${target}StdlibCache", type: Copy) {
|
task ("${target}StdlibCache", type: Copy) {
|
||||||
dependsOn "${target}CrossDistStdlib"
|
dependsOn "${target}CrossDistStdlib"
|
||||||
dependsOn ":kotlin-native:platformLibs:${target}StdlibCache"
|
dependsOn ":kotlin-native:runtime:${target}StdlibCache"
|
||||||
|
|
||||||
destinationDir project.file("$distDir/klib/cache/")
|
destinationDir project.file("$distDir/klib/cache/")
|
||||||
|
|
||||||
|
|||||||
@@ -55,17 +55,6 @@ rootProject.project("kotlin-native").ext.platformManager.enabled.each { target -
|
|||||||
ArrayList<TaskProvider> installTasks = []
|
ArrayList<TaskProvider> installTasks = []
|
||||||
ArrayList<TaskProvider> cacheTasks = []
|
ArrayList<TaskProvider> cacheTasks = []
|
||||||
|
|
||||||
if (target in cacheableTargets) {
|
|
||||||
tasks.register("${targetName}StdlibCache", KonanCacheTask) {
|
|
||||||
it.target = targetName
|
|
||||||
def runtimeBuild = project(":kotlin-native:runtime").buildDir
|
|
||||||
it.originalKlib = project.file("$runtimeBuild/${target}Stdlib")
|
|
||||||
it.cacheRoot = project.file("$runtimeBuild/cache/$target").path
|
|
||||||
|
|
||||||
it.dependsOn ":kotlin-native:${targetName}CrossDistRuntime"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
targetDefFiles(target).each { df ->
|
targetDefFiles(target).each { df ->
|
||||||
def libName = defFileToLibName(targetName, df.name)
|
def libName = defFileToLibName(targetName, df.name)
|
||||||
def fileNamePrefix = PlatformLibsInfo.namePrefix
|
def fileNamePrefix = PlatformLibsInfo.namePrefix
|
||||||
@@ -107,7 +96,7 @@ rootProject.project("kotlin-native").ext.platformManager.enabled.each { target -
|
|||||||
def cacheTask = tasks.register("${libName}Cache", KonanCacheTask) {
|
def cacheTask = tasks.register("${libName}Cache", KonanCacheTask) {
|
||||||
it.target = targetName
|
it.target = targetName
|
||||||
it.originalKlib = tasks[libName].installDir.get()
|
it.originalKlib = tasks[libName].installDir.get()
|
||||||
it.cacheRoot = file("$konanHome/klib/cache")
|
it.cacheRoot = file("$konanHome/klib/cache").absolutePath
|
||||||
|
|
||||||
it.dependsOn ":kotlin-native:${targetName}StdlibCache"
|
it.dependsOn ":kotlin-native:${targetName}StdlibCache"
|
||||||
it.dependsOn tasks[libName]
|
it.dependsOn tasks[libName]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import org.jetbrains.kotlin.*
|
import org.jetbrains.kotlin.*
|
||||||
import org.jetbrains.kotlin.testing.native.*
|
import org.jetbrains.kotlin.testing.native.*
|
||||||
import org.jetbrains.kotlin.bitcode.CompileToBitcode
|
import org.jetbrains.kotlin.bitcode.CompileToBitcode
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.konan.tasks.KonanCacheTask
|
||||||
import org.jetbrains.kotlin.konan.properties.loadProperties
|
import org.jetbrains.kotlin.konan.properties.loadProperties
|
||||||
import org.jetbrains.kotlin.konan.properties.saveProperties
|
import org.jetbrains.kotlin.konan.properties.saveProperties
|
||||||
import org.jetbrains.kotlin.konan.target.*
|
import org.jetbrains.kotlin.konan.target.*
|
||||||
@@ -437,27 +438,39 @@ konanArtifacts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
targetList.forEach { target ->
|
targetList.forEach { targetName ->
|
||||||
tasks.register("${target}Stdlib", Copy::class.java) {
|
tasks.register("${targetName}Stdlib", Copy::class.java) {
|
||||||
require(::stdlibBuildTask.isInitialized)
|
require(::stdlibBuildTask.isInitialized)
|
||||||
dependsOn(stdlibBuildTask)
|
dependsOn(stdlibBuildTask)
|
||||||
dependsOn("${target}Runtime")
|
dependsOn("${targetName}Runtime")
|
||||||
|
|
||||||
destinationDir = project.buildDir.resolve("${target}Stdlib")
|
destinationDir = project.buildDir.resolve("${targetName}Stdlib")
|
||||||
from(project.buildDir.resolve("stdlib/${hostName}/stdlib"))
|
from(project.buildDir.resolve("stdlib/${hostName}/stdlib"))
|
||||||
|
|
||||||
if (target != hostName) {
|
if (targetName != hostName) {
|
||||||
doLast {
|
doLast {
|
||||||
// Change target in manifest file
|
// Change target in manifest file
|
||||||
with(KFile(destinationDir.resolve("default/manifest").absolutePath)) {
|
with(KFile(destinationDir.resolve("default/manifest").absolutePath)) {
|
||||||
loadProperties().also {
|
loadProperties().also {
|
||||||
it[KLIB_PROPERTY_NATIVE_TARGETS] = target
|
it[KLIB_PROPERTY_NATIVE_TARGETS] = targetName
|
||||||
saveProperties(it)
|
saveProperties(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val cacheableTargetNames: List<String> by project
|
||||||
|
|
||||||
|
if (targetName in cacheableTargetNames) {
|
||||||
|
tasks.register("${targetName}StdlibCache", KonanCacheTask::class.java) {
|
||||||
|
target = targetName
|
||||||
|
originalKlib = project.buildDir.resolve("${targetName}Stdlib")
|
||||||
|
cacheRoot = project.buildDir.resolve("cache/$targetName").absolutePath
|
||||||
|
|
||||||
|
dependsOn(":kotlin-native:${targetName}CrossDistRuntime")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
Reference in New Issue
Block a user