-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
113 lines (101 loc) · 3.55 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.beryx.jlink' version '2.21.1'
id "de.undercouch.download" version "4.0.0"
}
dependencies {
implementation 'com.github.almasb:fxgl:11.9'
}
repositories {
mavenCentral()
maven {
url 'https://nexus.gluonhq.com/nexus/content/repositories/releases/'
}
}
javafx {
version = '15'
modules = ['javafx.controls', 'javafx.swing', 'javafx.fxml', 'javafx.media']
}
application {
mainClass = "org.beryx.fxgl.puzzle.SlidingPuzzle"
mainModule = "org.beryx.fxgl.puzzle"
}
ext.os = org.gradle.internal.os.OperatingSystem.current()
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'sliding puzzle'
}
jpackage {
// Let the plugin detect the path to the JDK providing the jpackage tool by searching the locations indicated by:
// - the badass.jlink.jpackage.home system property
// - the BADASS_JLINK_JPACKAGE_HOME environment variable
// - the java.home system property
// - the JAVA_HOME environment variable
//
// OR
//
// explicitly configure the below property:
// jpackageHome = '/usr/lib/jvm/jdk14'
//
// OR
//
// download and extract a JDK that contains the jpackage tool by setting the system property 'download.jpackage':
if(Boolean.getBoolean('download.jpackage')) {
jpackageHome = downloadJPackage()
}
if(os.macOsX) {
jvmArgs = ["-Duser.dir=/tmp"]
installerOptions = [
// '--mac-sign',
// '--mac-signing-key-user-name', System.getenv('SIGNING_KEY_USER_NAME'),
// '--mac-signing-keychain', System.getenv('SIGNING_KEYCHAIN_PATH')
]
} else if(os.windows) {
installerOptions = ['--win-per-user-install', '--win-dir-chooser', '--win-menu']
// } else {
// installerType = 'deb' // 'rpm'
}
installerOptions += '--verbose'
}
}
// #### The code below is needed only if you use the downloadJPackage() method to install the jpackage tool ####
/** @return [url, extension, directory] */
String[] getJPackageCoordinates() {
if(os.macOsX) return [
'https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_osx-x64_bin.tar.gz',
'tar.gz',
'jdk-14.jdk/Contents/Home'
]
if(os.windows) return [
'https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_windows-x64_bin.zip',
'zip',
'jdk-14'
]
return [
'https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz',
'tar.gz',
'jdk-14'
]
}
String downloadJPackage() {
def (url, extension, directory) = getJPackageCoordinates()
def downloadDir = "$buildDir/download"
tasks.jpackageImage.doFirst {
def execExt = os.windows ? '.exe' : ''
if(!file("$downloadDir/$directory/bin/jpackage$execExt").file) {
def jdkArchivePath = "$downloadDir/jdk-jpackage.$extension"
download {
src url
dest jdkArchivePath
overwrite false
}
copy {
from ((extension == 'tar.gz') ? tarTree(resources.gzip(jdkArchivePath)) : zipTree(jdkArchivePath))
into downloadDir
}
}
}
return "$downloadDir/$directory"
}