Skip to content

Commit

Permalink
Merge pull request #143 from fourlastor-forks/java-home-package-task
Browse files Browse the repository at this point in the history
Use `BaseTask` java home in jpackage tasks
  • Loading branch information
hakanai authored Oct 10, 2023
2 parents 862f6ea + 9abbb5b commit bec21b3
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/main/groovy/org/beryx/runtime/JPackageImageTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class JPackageImageTask extends BaseTask {
def taskData = new JPackageTaskData()
taskData.distDir = distDir.asFile
taskData.jpackageData = jpackageData
taskData.javaHome = javaHomeOrDefault

def jreTask = (JreTask) project.tasks.getByName(RuntimePlugin.TASK_NAME_JRE)
taskData.configureRuntimeImageDir(jreTask)
Expand Down
1 change: 1 addition & 0 deletions src/main/groovy/org/beryx/runtime/JPackageTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class JPackageTask extends BaseTask {
void jpackageTaskAction() {
def taskData = new JPackageTaskData()
taskData.jpackageData = jpackageData
taskData.javaHome = javaHomeOrDefault
taskData.configureAppImageDir()

def taskImpl = new JPackageTaskImpl(project, taskData)
Expand Down
18 changes: 0 additions & 18 deletions src/main/groovy/org/beryx/runtime/data/JPackageData.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,4 @@ class JPackageData {
File getInstallerOutputDirOrDefault() {
this.@installerOutputDir ?: project.file("$project.buildDir/$outputDir")
}

@Internal
String getJPackageHomeOrDefault() {
return jpackageHome ?: defaultJPackageHome
}

@Internal
String getDefaultJPackageHome() {
def value = System.properties['badass.runtime.jpackage.home']
if(value) return value
value = System.getenv('BADASS_RUNTIME_JPACKAGE_HOME')
if(value) return value
value = Util.getDefaultToolchainJavaHome(project)
if(value) return value
value = System.properties['java.home']
if(new File("$value/bin/jpackage$EXEC_EXTENSION").file) return value
return System.getenv('JAVA_HOME')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class JPackageTaskData {
File appImageDir

JPackageData jpackageData
String javaHome

void configureAppImageDir() {
final def imgOutDir = jpackageData.imageOutputDirOrDefault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class JPackageImageTaskImpl extends BaseTaskImpl<JPackageTaskData> {
def outputDir = jpd.imageOutputDirOrDefault
project.delete(outputDir)

def jpackageExec = "${jpd.getJPackageHomeOrDefault()}/bin/jpackage$EXEC_EXTENSION"
def jpackageExec = "${td.javaHome}/bin/jpackage$EXEC_EXTENSION"
Util.checkExecutable(jpackageExec)

def inputSuffix = project.tasks.findByName('installShadowDist') ? '-shadow' : ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class JPackageTaskImpl extends BaseTaskImpl<JPackageTaskData> {
project.ext.jpackageInstallerOutput = {
return standardOutput.toString()
}
def jpackageExec = "${jpd.getJPackageHomeOrDefault()}/bin/jpackage$EXEC_EXTENSION"
def jpackageExec = "${td.javaHome}/bin/jpackage$EXEC_EXTENSION"
Util.checkExecutable(jpackageExec)

def appVersion = (jpd.appVersion ?: project.version).toString()
Expand Down

0 comments on commit bec21b3

Please sign in to comment.