Skip to content

Commit f766cd4

Browse files
Fix executable setting, also added java.instrument
1 parent a889a3e commit f766cd4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

build.gradle

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
2+
13
plugins {
24
alias(libs.plugins.runtime)
35
alias(libs.plugins.shadow)
@@ -69,15 +71,12 @@ tasks.withType(JavaCompile).configureEach {
6971
}
7072

7173
test {
72-
dependsOn 'runtime'
74+
dependsOn('runtime')
7375
useJUnitPlatform()
7476
finalizedBy(jacocoTestReport)
7577

76-
doFirst {
77-
def javaExecutable = System.getProperty("os.name").toLowerCase().contains("windows") ? "java.exe" : "java"
78-
79-
executable = layout.buildDirectory.file("jre/bin/$javaExecutable").get().asFile.absolutePath
80-
}
78+
def file = DefaultNativePlatform.currentOperatingSystem.isWindows() ? 'java.exe' : 'java'
79+
executable = layout.buildDirectory.file('jre/bin/' + file).get()
8180
}
8281

8382
application {
@@ -86,7 +85,7 @@ application {
8685

8786
runtime {
8887
options = ['--strip-debug', '--no-header-files', '--no-man-pages']
89-
modules = ['java.desktop', 'java.naming', 'java.sql', 'jdk.crypto.ec', 'jdk.unsupported']
88+
modules = ['java.desktop', 'java.instrument', 'java.naming', 'java.sql', 'jdk.crypto.ec', 'jdk.unsupported']
9089
}
9190

9291
shadowJar {

0 commit comments

Comments
 (0)