[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,
|
||||
classpath: List<File>,
|
||||
logger: KotlinLogger,
|
||||
buildDir: File
|
||||
buildDir: File,
|
||||
jvmArgs: List<String> = emptyList()
|
||||
): ExitCode {
|
||||
val javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"
|
||||
val classpathString = classpath.map { it.absolutePath }.joinToString(separator = File.pathSeparator)
|
||||
|
||||
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 process = launchProcessWithFallback(builder, DaemonReportingTargets(messageCollector = messageCollector))
|
||||
|
||||
|
||||
+5
-1
@@ -71,6 +71,9 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
||||
keep += fqn
|
||||
}
|
||||
|
||||
@Input
|
||||
var jvmArgs = mutableListOf<String>()
|
||||
|
||||
@TaskAction
|
||||
fun performDce() {
|
||||
val inputFiles = (listOf(source) + classpath
|
||||
@@ -91,7 +94,8 @@ open class KotlinJsDce : AbstractKotlinCompileTool<K2JSDceArguments>(), KotlinJs
|
||||
K2JSDce::class.java.name,
|
||||
computedCompilerClasspath,
|
||||
log,
|
||||
project.buildDir
|
||||
project.buildDir,
|
||||
jvmArgs
|
||||
)
|
||||
throwGradleExceptionIfError(exitCode)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user