[Gradle, JS] Add possibility to set jvmArgs for dce process
^KT-44104 fixed
This commit is contained in:
+10
-2
@@ -90,14 +90,22 @@ internal fun runToolInSeparateProcess(
|
|||||||
compilerClassName: String,
|
compilerClassName: String,
|
||||||
classpath: List<File>,
|
classpath: List<File>,
|
||||||
logger: KotlinLogger,
|
logger: KotlinLogger,
|
||||||
buildDir: File
|
buildDir: File,
|
||||||
|
jvmArgs: List<String> = emptyList()
|
||||||
): ExitCode {
|
): ExitCode {
|
||||||
val javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"
|
val javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"
|
||||||
val classpathString = classpath.map { it.absolutePath }.joinToString(separator = File.pathSeparator)
|
val classpathString = classpath.map { it.absolutePath }.joinToString(separator = File.pathSeparator)
|
||||||
|
|
||||||
val compilerOptions = writeArgumentsToFile(buildDir, argsArray)
|
val compilerOptions = writeArgumentsToFile(buildDir, argsArray)
|
||||||
|
|
||||||
val builder = ProcessBuilder(javaBin, "-cp", classpathString, compilerClassName, "@${compilerOptions.absolutePath}")
|
val builder = ProcessBuilder(
|
||||||
|
javaBin,
|
||||||
|
*(jvmArgs.toTypedArray()),
|
||||||
|
"-cp",
|
||||||
|
classpathString,
|
||||||
|
compilerClassName,
|
||||||
|
"@${compilerOptions.absolutePath}"
|
||||||
|
)
|
||||||
val messageCollector = createLoggingMessageCollector(logger)
|
val messageCollector = createLoggingMessageCollector(logger)
|
||||||
val process = launchProcessWithFallback(builder, DaemonReportingTargets(messageCollector = messageCollector))
|
val process = launchProcessWithFallback(builder, DaemonReportingTargets(messageCollector = messageCollector))
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -71,6 +71,9 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
|||||||
keep += fqn
|
keep += fqn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Input
|
||||||
|
var jvmArgs = mutableListOf<String>()
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
fun performDce() {
|
fun performDce() {
|
||||||
val inputFiles = (listOf(source) + classpath
|
val inputFiles = (listOf(source) + classpath
|
||||||
@@ -91,7 +94,8 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
|||||||
K2JSDce::class.java.name,
|
K2JSDce::class.java.name,
|
||||||
computedCompilerClasspath,
|
computedCompilerClasspath,
|
||||||
log,
|
log,
|
||||||
project.buildDir
|
project.buildDir,
|
||||||
|
jvmArgs
|
||||||
)
|
)
|
||||||
throwGradleExceptionIfError(exitCode)
|
throwGradleExceptionIfError(exitCode)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user