Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging: Implement JPackageTask #6837

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package bisq.gradle.packaging

import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import java.util.concurrent.TimeUnit

abstract class JPackageTask : DefaultTask() {

@get:InputDirectory
abstract val jdkDirectory: DirectoryProperty

@get:InputDirectory
abstract val jarsDirectory: DirectoryProperty

@get:Input
abstract val mainJar: Property<String>

@get:Input
abstract val mainClassName: Property<String>

@get:InputDirectory
abstract val runtimeImageDirectory: DirectoryProperty

@get:OutputDirectory
abstract val outputDirectory: DirectoryProperty

@TaskAction
fun run() {
val jPackagePath = jdkDirectory.asFile.get().toPath().resolve("bin").resolve("jpackage")
val processBuilder = ProcessBuilder(
jPackagePath.toAbsolutePath().toString(),
"--dest", outputDirectory.asFile.get().absolutePath,
"--name", "Bisq",

"--input", jarsDirectory.asFile.get().absolutePath,
"--main-jar", mainJar.get(),
"--main-class", mainClassName.get(),

"--runtime-image", runtimeImageDirectory.asFile.get().absolutePath
)

processBuilder.inheritIO()
val process = processBuilder.start()
process.waitFor(15, TimeUnit.MINUTES)
}
}