Skip to content

Commit

Permalink
Changed to ZuluFX JRE. Removed Runtime plugin as it's not longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohaker committed Feb 3, 2020
1 parent a82a0db commit 493ddb4
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 271 deletions.
23 changes: 23 additions & 0 deletions BUILD.MD
Expand Up @@ -32,6 +32,29 @@ everything up into Zip and Tar formats.
$ ./gradlew packageApp
```

## Distributing JREs

There are a number of JRE related tasks in [jre.gradle](../gradle/jre.gradle) that will download a specific JRE from
[Zulu Community JREs](https://www.azul.com/downloads/zulu-community), that include JavaFX.
Each platform has the same tasks;
* Download the JRE
* Unzip the JRE to your Maven local repository
* Copy the JRE to the build folder when creating distributions.

Before running `distribution` for the first time, you must run
```
> gradlew downloadAndExtractJREs
$ ./gradlew downloadAndExtractJREs
```

The JREs will be downloaded to your local Maven repository. By default, this will be `/home/user/.m2/repository/jre` on
UNIX, and `C:\Users\current user\.m2\repository\jre` on Windows.

Any future builds will rely on these folders being present locally. You can always rerun the task to restore your
repository.

The JRE can then be found in [the build folder](../build/jre) and will be built into the distribution for the relevant OS.

## How to release the software, for version tagging in the official SCM and binary distribution
```
# Make sure local repository is clean, so that you get the same result as a first time user
Expand Down
28 changes: 8 additions & 20 deletions build.gradle
Expand Up @@ -7,7 +7,6 @@ plugins {
id 'com.github.hierynomus.license-report' version '0.15.0'
id 'com.github.spotbugs' version '2.0.0'
id 'net.researchgate.release' version '2.6.0'
id 'org.beryx.runtime' version '1.3.0'
id "de.undercouch.download" version '4.0.4'

id 'org.springframework.boot' version '2.2.1.RELEASE'
Expand All @@ -24,7 +23,6 @@ ext.javafxVersion = "11.0.2"

apply from: "${rootDir}/gradle/package.gradle"
apply from: "${rootDir}/gradle/installer.gradle"
apply from: "${rootDir}/gazeplay-dist/build.gradle"
apply from: "${rootDir}/gradle/jre.gradle"

allprojects {
Expand Down Expand Up @@ -169,29 +167,15 @@ distributions {
}
}

windowsX64 {
windows {
setDistributionBaseName "${project.name}-windows-x64"
contents {
with distributions.main.contents
from("build/reports")
from("build/bin/gazeplay-windows.bat") {
into 'bin'
}
from("build/jre/gazeplay-project-windows-x64") {
into 'lib/jre'
}
}
}

windowsX86 {
setDistributionBaseName "${project.name}-windows-x86"
contents {
with distributions.main.contents
from("build/reports")
from("build/bin/gazeplay-windows.bat") {
into 'bin'
}
from("build/jre/gazeplay-project-windows-x86") {
from("build/jre/windows-x64") {
into 'lib/jre'
}
}
Expand All @@ -205,7 +189,7 @@ distributions {
from("build/bin/gazeplay-linux.sh") {
into 'bin'
}
from("build/jre/gazeplay-project-linux-x64") {
from("build/jre/linux-x64") {
into 'lib/jre'
}
}
Expand All @@ -218,13 +202,17 @@ distributions {
from("build/bin/gazeplay-macos.sh") {
into 'bin'
}
from("build/jre/gazeplay-project-macos") {
from("build/jre/macos") {
into 'lib/jre'
}
}
}
}

macosDistTar.dependsOn(copyMacosJRE)
linuxDistTar.dependsOn(copyLinuxJRE)
windowsDistZip.dependsOn(copyWindowsJRE)

tasks.withType(Tar){
compression = Compression.GZIP
archiveExtension.set('tar.gz')
Expand Down
31 changes: 0 additions & 31 deletions gazeplay-dist/README.md

This file was deleted.

73 changes: 0 additions & 73 deletions gazeplay-dist/build.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/innosetup/setup.iss.skel
Expand Up @@ -34,7 +34,7 @@ DefaultGroupName=GazePlay
LicenseFile=licence.txt

OutputDir=..\\distributions
OutputBaseFilename=GazePlay-installer-${applicationVersion}-${architecture}
OutputBaseFilename=GazePlay-installer-${applicationVersion}-x64
;Compression=lzma
SolidCompression=yes

Expand Down
45 changes: 18 additions & 27 deletions gradle/installer.gradle
Expand Up @@ -2,48 +2,44 @@ task generateWindowsInstaller(dependsOn: ['unzipx64Distribution', 'unzipx86Distr
doLast {

def innoSetupDir = new File("${buildDir}/innosetup")

// I'm leaving this line in so we can quickly sign installers if/when we decide to do so.
// def signtool = "/SStandard=\"C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.18362.0\\x64\\signtool.exe sign /a /n \$qGazePlay\$q /tr http://timestamp.comodoca.com/ /d \$qGazePlay\$q \$f\""

['x64', 'x86'].each { arch ->
exec {
commandLine "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe", "${innoSetupDir}\\setup-${arch}.iss"
}
exec {
commandLine "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe", "${innoSetupDir}\\setup.iss"
}

}
}

task generateWindowsInstallerInDocker(dependsOn: ['unzipx64Distribution', 'unzipx86Distribution', 'prepareInnoSetupFiles'], group: 'distribution') {
doLast {
['x64', 'x86'].each {
exec {
workingDir rootDir
commandLine "docker", "run", "--rm", "-i", "-v", "${buildDir}:/work", "amake/innosetup", "innosetup/setup-${it}.iss"
}
exec {
workingDir rootDir
commandLine "docker", "run", "--rm", "-i", "-v", "${buildDir}:/work", "amake/innosetup", "innosetup/setup.iss"
}
}
}


task prepareInnoSetupFiles(group: 'distribution') {
doLast {
def innoSetupDir = new File("${buildDir}/innosetup")

innoSetupDir.mkdir()

['x64', 'x86'].each { arch ->
copy {
from("${rootDir}/gradle/innosetup/setup.iss.skel")
rename("setup.iss.skel", "setup-${arch}.iss")
expand([
applicationVersion: "${version}",
architecture: "${arch}",
unpackedDirectory : "gazeplay-project-windows-${arch}-${version}"
])
into(innoSetupDir)
}
copy {
from("${rootDir}/gradle/innosetup/setup.iss.skel")
rename("setup.iss.skel", "setup.iss")
expand([
applicationVersion: "${version}",
unpackedDirectory : "gazeplay-project-windows-${version}"
])
into(innoSetupDir)
}


copy {
from("${rootDir}/gazeplay/src/main/resources/data/common/licence.txt")
expand([
Expand All @@ -65,12 +61,7 @@ task prepareInnoSetupFiles(group: 'distribution') {
}
}

task unzipx64Distribution(dependsOn: ['packageApp'], type: Copy, group: 'distribution') {
task unzipDistribution(dependsOn: ['packageApp'], type: Copy, group: 'distribution') {
from zipTree("${buildDir}/distributions/gazeplay-project-windows-x64-${version}.zip")
into buildDir
}

task unzipx86Distribution(dependsOn: ['packageApp'], type: Copy, group: 'distribution') {
from zipTree("${buildDir}/distributions/gazeplay-project-windows-x86-${version}.zip")
into buildDir
}
34 changes: 6 additions & 28 deletions gradle/jre.gradle
@@ -1,43 +1,21 @@
String.metaClass.encodeURL = {
java.net.URLEncoder.encode(delegate, "UTF-8")
}

String.metaClass.decodeURL = {
java.net.URLDecoder.decode(delegate, "UTF-8")
}

ext.jdkSource = 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download'
ext.jdkVersion = '11.0.6_10'
ext.jdkTag = jdkVersion.replace('_', '+').encodeURL()
ext.jdkFolder = "jdk-${jdkVersion.replace('_', '+')}"

ext.jmodsVersion = '11.0.2'
ext.jmodsSource = "https://gluonhq.com/download/javafx-${jmodsVersion.replace('.', '-')}-jmods"
ext.jreSource = 'https://cdn.azul.com/zulu/bin/'
ext.zuluVersion = '11.35.15'
ext.jreVersion = '11.0.5'
ext.jreFolder = "${buildDir}/jre"

ext.downloadLocation = new File(project.repositories.mavenLocal().url).getAbsolutePath();

apply from: "${rootDir}/gradle/jre/linux.gradle"
apply from: "${rootDir}/gradle/jre/macos.gradle"
apply from: "${rootDir}/gradle/jre/windows.gradle"

runtime {
options = ['--compress', '2', '--no-header-files', '--no-man-pages']
modules = jreModules
jreDir = file("${buildDir}/jre")

targetPlatform('linux-x64', "${project.ext.downloadLocation}/jre/linux-x64/${project.ext.jdkFolder}")
targetPlatform('windows-x64', "${project.ext.downloadLocation}/jre/windows-x64/${project.ext.jdkFolder}")
targetPlatform('windows-x86', "${project.ext.downloadLocation}/jre/windows-x86/${project.ext.jdkFolder}")
targetPlatform('macos', "${project.ext.downloadLocation}/jre/macos/${project.ext.jdkFolder}/Contents/Home")
}

task clearJREFolder(type: Delete) {
delete fileTree("${project.ext.downloadLocation}/jre") {
include '*.zip', '*.tar.gz'
}
}

task('downloadAndExtractJDKs', group: 'custom jre') {
dependsOn addJmodsToLinux64JDK, addJmodsToWindows64JDK, addJmodsToWindows86JDK, addJmodsToMacosJDK
task('downloadAndExtractJREs', group: 'custom jre') {
dependsOn downloadAndExtractLinuxJRE, downloadAndExtractWindowsJRE, downloadAndExtractMacosJRE
finalizedBy clearJREFolder
}
38 changes: 14 additions & 24 deletions gradle/jre/linux.gradle
@@ -1,34 +1,24 @@
def jdkSource = project.ext.jdkSource
def jdkTag = project.ext.jdkTag
def jdkVersion = project.ext.jdkVersion
def jdkFolder = project.ext.jdkFolder
def downloadLocation = project.ext.downloadLocation
def jmodsSource = project.ext.jmodsSource
def jmodsVersion = project.ext.jmodsVersion

task downloadLinux64JDK(type: Download, group: 'custom jre') {
src "${jdkSource}/jdk-${jdkTag}/OpenJDK11U-jdk_x64_linux_hotspot_${jdkVersion}.tar.gz"
dest new File("${downloadLocation}/jre", 'linux-x64.tar.gz')
overwrite false
}
def jreSource = project.ext.jreSource
def zuluVersion = project.ext.zuluVersion
def jreVersion = project.ext.jreVersion
def jreFolder = project.ext.jreFolder

def filename = "zulu${zuluVersion}-ca-fx-jre${jreVersion}-linux_x64"

task downloadLinuxJmods(type: Download, group: 'custom jre') {
src "${jmodsSource}-linux"
dest new File("${downloadLocation}/jre", 'linux-jmods.zip')
task downloadLinuxJRE(type: Download, group: 'custom jre') {
src "${jreSource}/${filename}.tar.gz"
dest new File("${downloadLocation}/jre", 'linux.tar.gz')
overwrite false
}

task downloadAndExtractLinux64JDK(dependsOn: downloadLinux64JDK, type: Copy, group: 'custom jre') {
from tarTree(downloadLinux64JDK.dest)
task downloadAndExtractLinuxJRE(dependsOn: downloadLinuxJRE, type: Copy, group: 'custom jre') {
from tarTree(downloadLinuxJRE.dest)
into "${downloadLocation}/jre/linux-x64"
}

task downloadAndExtractLinuxJmods(dependsOn: downloadLinuxJmods, type: Copy, group: 'custom jre') {
from zipTree(downloadLinuxJmods.dest)
into "${downloadLocation}/jre/linux-jmods"
}

task addJmodsToLinux64JDK(dependsOn: [downloadAndExtractLinuxJmods, downloadAndExtractLinux64JDK], type: Copy, group: 'custom jre') {
from "${downloadAndExtractLinuxJmods.destinationDir}/javafx-jmods-${jmodsVersion}"
into "${downloadAndExtractLinux64JDK.destinationDir}/${jdkFolder}/jmods"
task copyLinuxJRE(type: Copy, group: 'custom jre') {
from "${downloadAndExtractLinuxJRE.destinationDir}/${filename}"
into "${jreFolder}/linux-x64"
}

0 comments on commit 493ddb4

Please sign in to comment.