Use argument file to run Kotlin/Native compiler
This commit is contained in:
committed by
Ilya Matveev
parent
7d6adbd088
commit
b469afdfcb
+26
-3
@@ -113,6 +113,8 @@ internal abstract class KonanCliRunner(
|
|||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun transformArgs(args: List<String>): List<String> = args
|
||||||
|
|
||||||
override fun run(args: List<String>) {
|
override fun run(args: List<String>) {
|
||||||
project.logger.info("Run tool: $toolName with args: ${args.joinToString(separator = " ")}")
|
project.logger.info("Run tool: $toolName with args: ${args.joinToString(separator = " ")}")
|
||||||
if (classpath.isEmpty) {
|
if (classpath.isEmpty) {
|
||||||
@@ -132,7 +134,7 @@ internal abstract class KonanCliRunner(
|
|||||||
.toMap()
|
.toMap()
|
||||||
)
|
)
|
||||||
spec.systemProperties(additionalSystemProperties)
|
spec.systemProperties(additionalSystemProperties)
|
||||||
spec.args(listOf(toolName) + args)
|
spec.args(listOf(toolName) + transformArgs(args))
|
||||||
blacklistEnvironment.forEach { spec.environment.remove(it) }
|
blacklistEnvironment.forEach { spec.environment.remove(it) }
|
||||||
spec.environment(environment)
|
spec.environment(environment)
|
||||||
}
|
}
|
||||||
@@ -152,8 +154,29 @@ internal class KonanInteropRunner(project: Project, additionalJvmArgs: List<Stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class KonanCompilerRunner(project: Project, additionalJvmArgs: List<String> = emptyList())
|
internal class KonanCompilerRunner(
|
||||||
: KonanCliRunner("konanc", "Kotlin/Native compiler", project, additionalJvmArgs)
|
project: Project,
|
||||||
|
additionalJvmArgs: List<String> = emptyList(),
|
||||||
|
val useArgFile: Boolean = true
|
||||||
|
) : KonanCliRunner("konanc", "Kotlin/Native compiler", project, additionalJvmArgs)
|
||||||
|
{
|
||||||
|
override fun transformArgs(args: List<String>): List<String> {
|
||||||
|
if (!useArgFile) {
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
|
val argFile = createTempFile(prefix = "konancArgs", suffix = ".lst").apply {
|
||||||
|
deleteOnExit()
|
||||||
|
}
|
||||||
|
argFile.printWriter().use { writer ->
|
||||||
|
args.forEach {
|
||||||
|
writer.println(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return listOf("@${argFile.absolutePath}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal class KonanKlibRunner(project: Project, additionalJvmArgs: List<String> = emptyList())
|
internal class KonanKlibRunner(project: Project, additionalJvmArgs: List<String> = emptyList())
|
||||||
: KonanCliRunner("klib", "Klib management tool", project, additionalJvmArgs)
|
: KonanCliRunner("klib", "Klib management tool", project, additionalJvmArgs)
|
||||||
|
|||||||
Reference in New Issue
Block a user