[K/N][build] PlatformLibs project small refactorings

This commit is contained in:
Pavel Punegov
2021-10-21 00:10:53 +03:00
committed by Space
parent 04c6e64598
commit 547501865c
+6 -6
View File
@@ -29,13 +29,13 @@ plugins {
val targetsWithoutZlib: List<KonanTarget> by project
// region: Util functions.
fun targetDefFiles(target: KonanTarget) =
project.fileTree("src/platform/${target.family.visibleName}")
fun KonanTarget.defFiles() =
project.fileTree("src/platform/${family.visibleName}")
.filter { it.name.endsWith(".def") }
// The libz.a/libz.so and zlib.h are missing in MIPS sysroots.
// Just workaround it until we have sysroots corrected.
.filter { ! ((target in targetsWithoutZlib) && it.name == "zlib.def") }
.map { DefFile(it, target) }
.filterNot { (this in targetsWithoutZlib) && it.name == "zlib.def" }
.map { DefFile(it, this) }
fun defFileToLibName(target: String, name: String) = "$target-$name"
@@ -55,7 +55,7 @@ konanTargetList.forEach { target ->
val installTasks = mutableListOf<TaskProvider<out Task>>()
val cacheTasks = mutableListOf<TaskProvider<out Task>>()
targetDefFiles(target).forEach { df ->
target.defFiles().forEach { df ->
val libName = defFileToLibName(targetName, df.name)
val fileNamePrefix = PlatformLibsInfo.namePrefix
@@ -104,7 +104,7 @@ konanTargetList.forEach { target ->
cacheRoot = file("$konanHome/klib/cache").absolutePath
dependsOn(":kotlin-native:${targetName}StdlibCache")
dependsOn(tasks[libName])
dependsOn(tasks.named(libName))
dependsOn(df.config.depends.map {
val depName = defFileToLibName(targetName, it)
"${depName}Cache"