From f4331a2ccbe3ad25ace43fd0ce3acc5e0d458b6a Mon Sep 17 00:00:00 2001 From: Anton Keks Date: Thu, 20 Jan 2022 23:12:25 +0200 Subject: [PATCH] extract Java modules to a variable and reuse --- .idea/misc.xml | 2 +- build.gradle | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 0879242c..c90751f8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,4 +7,4 @@ - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 993d564f..6d413c2b 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,8 @@ version = exec("git describe --tags", ".", false) ?: "unknown" sourceCompatibility = 11 targetCompatibility = 11 +def javaModules = ["java.base", "java.desktop", "java.prefs", "java.logging"] + sourceSets { main { java { srcDirs "src", "ext/rocksaw/src", "ext/vserv-tcpip/src/java" } @@ -147,11 +149,9 @@ def minimizeTask(String platform, Closure doMore) { return tasks.create("${platform}.min", proguard.gradle.ProGuardTask) { injars "build/libs/ipscan-${platform}-${version}.jar" outjars "build/libs/ipscan-${platform}-${version}.min.jar" - libraryjars System.getProperty('java.home') + "/jmods/java.base.jmod" - libraryjars System.getProperty('java.home') + "/jmods/java.desktop.jmod" - libraryjars System.getProperty('java.home') + "/jmods/java.logging.jmod" - libraryjars System.getProperty('java.home') + "/jmods/java.net.http.jmod" - libraryjars System.getProperty('java.home') + "/jmods/java.prefs.jmod" + javaModules.each { + libraryjars System.getProperty('java.home') + "/jmods/${it}.jmod" + } dontobfuscate dontoptimize dontnote '**' @@ -293,7 +293,7 @@ task 'win-installer'(dependsOn: ['win32', 'win64']) { def jrePath = "AppFiles/jre" if (!new File(installerDir, jrePath).exists()) { exec("jlink --output $jrePath --vm=client --compress=2 --no-header-files --no-man-pages --strip-debug " + - "--add-modules java.base,java.desktop,java.prefs,java.logging") + "--add-modules " + javaModules.join(",")) } ant.copy(file: "build/libs/${project.name}-win64-${version}.exe", tofile:"${installerDir}/AppFiles/ipscan.exe") if (platform.startsWith('win')) { @@ -303,7 +303,7 @@ task 'win-installer'(dependsOn: ['win32', 'win64']) { println("Building of Windows Installer is not supported on other platforms") exec("wine $nsis/makensis.exe Installer/Installer.nsi", installerDir) } - ant.move(file: "${installerDir}/ipscan-*-setup.exe", todir: "build/libs") + ant.move(file: "${installerDir}/ipscan-$version-setup.exe", todir: "build/libs") exec("git checkout ${installerDir}/InstallerConfig.nsh") } }