com.github.psxpaul.task.JavaExecFork.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-execfork-plugin Show documentation
Show all versions of gradle-execfork-plugin Show documentation
A gradle plugin to execute applications in the background
package com.github.psxpaul.task
import org.gradle.api.file.FileCollection
import org.gradle.internal.jvm.Jvm
open class JavaExecFork : AbstractExecFork() {
var classpath: FileCollection? = null
var main:CharSequence? = null
var jvmArgs:List = listOf()
override fun getProcessArgs(): List? {
val processArgs:MutableList = mutableListOf()
processArgs.add(Jvm.current().javaExecutable.absoluteFile.absolutePath)
processArgs.add("-cp")
processArgs.add(classpath!!.asPath)
processArgs.addAll(jvmArgs.map({ s:CharSequence ->
if (s.startsWith("-D"))
return@map s.toString()
else
"-D" + s
}))
processArgs.add(main!!.toString())
processArgs.addAll(args.map(CharSequence::toString))
return processArgs
}
}