-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
59 lines (50 loc) · 1.49 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
import java.nio.file.Path
plugins {
id 'java'
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
version = '2024feb15'
}
def smppguiFilename = 'smppgui.jar'
jar {
archiveFileName = smppguiFilename
metaInf {
from 'README.md'
from 'LICENSE.txt'
}
manifest {
attributes('Main-Class': 'com.ukarim.smppgui.Main')
}
filesMatching('**/about.txt') { fcp ->
fcp.filter { line ->
def date = (new Date()).format('MMM dd, yyyy')
line.replace('{buildInfo}', "Built on ${date}. Version: ${version}")
}
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
test {
useJUnitPlatform()
}
clean {
// remove dir created by jlink task
delete 'smppgui'
}
// This task builds custom jre images with only necessary modules included
tasks.register('jlink', Exec) {
dependsOn 'build'
def modulePath = Path.of(buildDir.absolutePath, "libs", smppguiFilename)
commandLine ([
'jlink', // jlink must be preinstalled on your machine
'--module-path', modulePath, // Smppgui jar file
'--add-modules', 'smppgui',
'--output', 'smppgui', // Output directory
'--launcher', 'smppgui=smppgui/com.ukarim.smppgui.Main' // Launcher shell script. See smppgui/bin directory
])
}