-
Notifications
You must be signed in to change notification settings - Fork 32
/
build.gradle
105 lines (93 loc) · 2.68 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
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.3'
classpath 'org.javamodularity:moduleplugin:1.8.12'
classpath 'org.beryx:badass-jlink-plugin:2.26.0'
}
}
plugins {
id 'java-library'
id 'application'
id 'com.google.osdetector' version '1.7.3'
id 'org.javamodularity.moduleplugin' version '1.8.12'
id 'org.beryx.jlink' version '2.26.0'
}
ext.platform = osdetector.os == 'osx' ? osdetector.arch == 'aarch_64' ? 'mac-aarch64' : 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os == 'linux' ? osdetector.arch == 'aarch_64' ? 'linux-aarch64' : 'linux' : osdetector.os
normalization {
runtimeClasspath {
ignore('/META-INF/MANIFEST.MF')
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.google.gradle:osdetector-gradle-plugin:1.7.3'
implementation "org.openjfx:javafx-base:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-graphics:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-controls:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-media:${javafxVersion}:${platform}"
}
ext.moduleName = 'eu.hansolo.spacefx'
mainClassName = 'eu.hansolo.spacefx.Launcher'
jar {
from {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
manifest {
attributes(
'Implementation-Title': 'SpaceFX',
'Class-Path': 'SpaceFX-17.0.0.jar',
'Main-Class': 'eu.hansolo.spacefx.Launcher'
)
}
}
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'eu.hansolo.spacefx'
}
}
/*
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += "--enable-preview"
}
*/
// start the from gradle
task Main(type: JavaExec) {
main = "eu.hansolo.spacefx.Launcher"
classpath = sourceSets.main.runtimeClasspath
}
// Fix problems with loading resources
sourceSets {
main {
output.setResourcesDir(java.classesDirectory)
}
}
run {
inputs.property("moduleName", moduleName)
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--module', mainClassName
]
classpath = files()
}
}