@@ -21,10 +21,9 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
21
21
22
22
plugins {
23
23
id ' application'
24
- id ' com.github.ben-manes.versions' version ' 0.46 .0'
25
- id ' org.beryx.jlink' version ' 2.26 .0'
24
+ id ' com.github.ben-manes.versions' version ' 0.48 .0'
25
+ id ' org.beryx.jlink' version ' 3.0 .0'
26
26
id ' org.openjfx.javafxplugin' version ' 0.1.0'
27
- id ' org.javamodularity.moduleplugin' version ' 1.8.12'
28
27
29
28
id ' idea'
30
29
}
@@ -37,11 +36,11 @@ version = '3.5.2'
37
36
description = ' A cross-platform GUI and CLI app for saving SHSH blobs'
38
37
String appIdentifier = ' airsquared.blobsaver.app'
39
38
String copyright = ' Copyright (c) 2023 airsquared'
40
- def os = DefaultNativePlatform . currentOperatingSystem
39
+ var os = DefaultNativePlatform . currentOperatingSystem
41
40
42
41
startScripts. enabled = distZip. enabled = distTar. enabled = false
43
42
44
- java. toolchain. languageVersion = JavaLanguageVersion . of(20 )
43
+ java. toolchain. languageVersion = JavaLanguageVersion . of(21 )
45
44
46
45
repositories {
47
46
mavenCentral()
@@ -57,43 +56,42 @@ dependencies {
57
56
implementation ' info.picocli:picocli:4.7.5'
58
57
59
58
testImplementation ' org.junit.jupiter:junit-jupiter:5.10.0'
59
+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
60
60
testImplementation ' org.testfx:openjfx-monocle:jdk-12.0.1+2'
61
61
}
62
62
63
63
javafx {
64
- version = ' 20 '
64
+ version = ' 21 '
65
65
modules = [ ' javafx.controls' , ' javafx.fxml' ]
66
66
}
67
67
68
- def addExports = [ ' --add-exports=javafx.graphics/com.sun.javafx.css=airsquared.blobsaver' , ' --add-exports=java.base/jdk.internal.misc=airsquared.blobsaver ' ]
68
+ var addExports = ' --add-exports=javafx.graphics/com.sun.javafx.css=airsquared.blobsaver'
69
69
70
70
compileJava {
71
- options. compilerArgs. addAll addExports
71
+ options. compilerArgs. add addExports
72
72
}
73
73
74
74
application {
75
75
mainModule = ' airsquared.blobsaver'
76
76
mainClass = ' airsquared.blobsaver.app.Main'
77
- applicationDefaultJvmArgs. addAll addExports
77
+ applicationDefaultJvmArgs. add addExports
78
78
}
79
79
80
80
private String getJarDirectory () {
81
- String dir = ' '
81
+ var dir = ' '
82
82
if (DefaultNativePlatform . currentOperatingSystem. isMacOsX()) dir = ' macos/Contents'
83
83
else if (DefaultNativePlatform . currentOperatingSystem. isWindows()) dir = ' windows/files'
84
84
else if (DefaultNativePlatform . currentOperatingSystem. isLinux()) dir = ' linux'
85
85
return " ${ projectDir} /dist/${ dir} "
86
86
}
87
87
88
88
run {
89
- systemProperty ' jar.directory' , getJarDirectory()
89
+ systemProperty ' jar.directory' , jarDirectory
90
90
}
91
91
92
92
test {
93
93
useJUnitPlatform()
94
- systemProperty ' jar.directory' , getJarDirectory()
95
- jvmArgs addExports
96
- jvmArgs ' --add-exports=javafx.graphics/com.sun.glass.ui=org.testfx.monocle'
94
+ systemProperty ' jar.directory' , jarDirectory
97
95
}
98
96
99
97
jlink {
@@ -102,8 +100,7 @@ jlink {
102
100
' --dedup-legal-notices=error-if-not-same-content'
103
101
}
104
102
launcher {
105
- jvmArgs = [ ' -Djar.directory={{BIN_DIR}}' ]
106
- jvmArgs. addAll addExports
103
+ jvmArgs = [ ' -Djar.directory={{BIN_DIR}}' , addExports ]
107
104
if (findProperty(' noConsole' ) != ' false' ) {
108
105
noConsole = true
109
106
}
@@ -116,48 +113,36 @@ jlink {
116
113
117
114
if (os. isMacOsX()) {
118
115
installerType = ' dmg'
119
- String arch = DefaultNativePlatform . currentArchitecture. amd64 ? ' intel' : ' arm'
116
+ var arch = DefaultNativePlatform . currentArchitecture. amd64 ? ' intel' : ' arm'
120
117
installerName = " ${ name} -${ arch} "
121
- imageOptions. addAll ' --mac-package-identifier' , appIdentifier
118
+ // noinspection GroovyAssignabilityCheck
119
+ imageOptions. addAll ' --mac-package-identifier' , appIdentifier,
120
+ ' --app-content' , " ${ projectDir} /dist/macos/Contents/Frameworks," +
121
+ " ${ projectDir} /dist/macos/Contents/MacOS"
122
122
icon = " ${ projectDir} /dist/macos/Contents/Resources/blob.icns"
123
123
} else if (os. isWindows()) {
124
124
installerOptions. addAll ' --win-dir-chooser' , ' --win-menu' , ' --win-shortcut'
125
125
icon = " ${ projectDir} /dist/windows/blob.ico"
126
+ imageOptions. addAll ' --app-content' , fileTree(" ${ projectDir} /dist/windows/files" ). join(' ,' )
126
127
} else {
127
128
installerOptions. addAll ' --linux-shortcut' , ' --linux-menu-group' , ' Utility;Archiving;Java' ,
128
129
' --linux-rpm-license-type' , ' GPLv3'
129
- icon = " ${ projectDir} /src/main/resources/airsquared/blobsaver/app/blob_emoji.png"
130
+ icon = " ${ projectDir} /src/main/resources/airsquared/blobsaver/app/blob.png"
131
+ imageOptions. addAll ' --app-content' , fileTree(" ${ projectDir} /dist/linux" ). join(' ,' ) + ' ,' +
132
+ " ${ projectDir} /LICENSE,${ projectDir} /libraries_used.txt"
130
133
}
131
134
if (findProperty(' installerType' ) != null ) {
132
135
installerType = findProperty(' installerType' )
133
136
}
134
137
}
135
138
if (os. isMacOsX()) jpackageImage. doLast {
136
- copy {
137
- from " ${ projectDir} /dist/macos/Contents/MacOS" into layout. buildDirectory. dir(' jpackage/blobsaver.app/Contents/MacOS' )
138
- }
139
- copy {
140
- from " ${ projectDir} /dist/macos/Contents/Frameworks" into layout. buildDirectory. dir(' jpackage/blobsaver.app/Contents/Frameworks' )
141
- }
142
139
copy {
143
140
from " ${ projectDir} /LICENSE" , " ${ projectDir} /libraries_used.txt"
144
141
into layout. buildDirectory. dir(' jpackage/blobsaver.app/Contents/Resources' )
145
142
}
146
143
exec { // needed to prevent "application is damaged" error when opening quarantined app
147
144
commandLine ' codesign' , ' --force' , ' --deep' , ' --sign' , ' -' , " ${ layout.buildDirectory.get()} /jpackage/blobsaver.app"
148
145
}
149
- } else if (os. isWindows()) jpackageImage. doLast {
150
- copy {
151
- from " ${ projectDir} /dist/windows/files" , layout. buildDirectory. dir(' jpackage/blobsaver/runtime/bin/zip.dll' )
152
- rename ' LICENSE_windows' , ' LICENSE'
153
- rename ' libraries_used_windows.txt' , ' libraries_used.txt'
154
- into layout. buildDirectory. dir(' jpackage/blobsaver' )
155
- }
156
- } else jpackageImage. doLast {
157
- copy {
158
- from " ${ projectDir} /dist/linux" , " ${ projectDir} /LICENSE" , " ${ projectDir} /libraries_used.txt"
159
- into layout. buildDirectory. dir(' jpackage/blobsaver/lib' )
160
- }
161
146
}
162
147
}
163
148
0 commit comments