[K/N] Speedup defFileDependencies by running it in parallel
This commit is contained in:
+5
-3
@@ -8,6 +8,8 @@ import org.jetbrains.kotlin.native.interop.indexer.NativeLibraryHeaders
|
|||||||
import org.jetbrains.kotlin.native.interop.indexer.getHeaderPaths
|
import org.jetbrains.kotlin.native.interop.indexer.getHeaderPaths
|
||||||
import org.jetbrains.kotlin.native.interop.tool.CInteropArguments
|
import org.jetbrains.kotlin.native.interop.tool.CInteropArguments
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.util.stream.Collectors
|
||||||
|
import kotlin.streams.toList
|
||||||
|
|
||||||
fun defFileDependencies(args: Array<String>) {
|
fun defFileDependencies(args: Array<String>) {
|
||||||
val defFiles = mutableListOf<File>()
|
val defFiles = mutableListOf<File>()
|
||||||
@@ -40,14 +42,14 @@ private fun makeDependencyAssignerForTarget(target: String, defFiles: List<File>
|
|||||||
val tool = prepareTool(target, KotlinPlatform.NATIVE)
|
val tool = prepareTool(target, KotlinPlatform.NATIVE)
|
||||||
val cinteropArguments = CInteropArguments()
|
val cinteropArguments = CInteropArguments()
|
||||||
cinteropArguments.argParser.parse(arrayOf())
|
cinteropArguments.argParser.parse(arrayOf())
|
||||||
val libraries = defFiles.associateWith {
|
val libraries = defFiles.parallelStream().map {
|
||||||
buildNativeLibrary(
|
it to buildNativeLibrary(
|
||||||
tool,
|
tool,
|
||||||
DefFile(it, tool.substitutions),
|
DefFile(it, tool.substitutions),
|
||||||
cinteropArguments,
|
cinteropArguments,
|
||||||
ImportsImpl(emptyMap())
|
ImportsImpl(emptyMap())
|
||||||
).getHeaderPaths()
|
).getHeaderPaths()
|
||||||
}
|
}.toList().toMap()
|
||||||
return SingleTargetDependencyAssigner(libraries)
|
return SingleTargetDependencyAssigner(libraries)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user