[K/N][build] Use Map for cached libraries
This commit is contained in:
@@ -77,7 +77,9 @@ targetList.each { target ->
|
|||||||
cacheRoot = library.project.file("build/cache/$target").path
|
cacheRoot = library.project.file("build/cache/$target").path
|
||||||
compilerDistributionPath.set(distDir)
|
compilerDistributionPath.set(distDir)
|
||||||
// TODO: should depend on stdlib producer task and its properties
|
// TODO: should depend on stdlib producer task and its properties
|
||||||
cachedLibrary = "${dist}/klib/common/stdlib,${dist}/klib/cache/${target}-gSTATIC/stdlib-cache"
|
def clibs = [:]
|
||||||
|
clibs.put(project.file("$dist/klib/common/stdlib"), project.file("$dist/klib/cache/${target}-gSTATIC/stdlib-cache"))
|
||||||
|
cachedLibraries = clibs
|
||||||
|
|
||||||
dependsOn "$library.projectName:${target}${library.taskName}"
|
dependsOn "$library.projectName:${target}${library.taskName}"
|
||||||
dependsOn ":kotlin-native:${target}CrossDistRuntime"
|
dependsOn ":kotlin-native:${target}CrossDistRuntime"
|
||||||
|
|||||||
+2
-3
@@ -49,8 +49,7 @@ open class KonanCacheTask: DefaultTask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@get:Input
|
@get:Input
|
||||||
@get:Optional
|
var cachedLibraries: Map<File, File> = emptyMap()
|
||||||
var cachedLibrary: String? = null
|
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
fun compile() {
|
fun compile() {
|
||||||
@@ -70,7 +69,7 @@ open class KonanCacheTask: DefaultTask() {
|
|||||||
"-produce", cacheKind.outputKind.name.toLowerCase(),
|
"-produce", cacheKind.outputKind.name.toLowerCase(),
|
||||||
"-Xadd-cache=${originalKlib.absolutePath}",
|
"-Xadd-cache=${originalKlib.absolutePath}",
|
||||||
"-Xcache-directory=${cacheDirectory.absolutePath}"
|
"-Xcache-directory=${cacheDirectory.absolutePath}"
|
||||||
) + additionalCacheFlags + (cachedLibrary?.let { "-Xcached-library=$it" } ?: "")
|
) + additionalCacheFlags + cachedLibraries.map { "-Xcached-library=${it.key},${it.value}" }
|
||||||
KonanCompilerRunner(project, konanHome = konanHome).run(args)
|
KonanCompilerRunner(project, konanHome = konanHome).run(args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user