All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.psxpaul.task.JavaExecFork.kt Maven / Gradle / Ivy

There is a newer version: 0.1.4
Show newest version
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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy