From 9daf386d6691855b2d64886bbc610f2e4674838e Mon Sep 17 00:00:00 2001 From: Skylot Date: Sat, 14 Nov 2020 15:54:02 +0000 Subject: [PATCH] build: bundle JRE with jadx-gui --- build.gradle | 10 +++++++++ gradle.properties | 1 + jadx-gui/build.gradle | 52 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 6949f4165..786b55819 100644 --- a/build.gradle +++ b/build.gradle @@ -147,6 +147,16 @@ task dist { } } +task distWin(type: Copy, dependsOn: 'jadx-gui:distWinWithJre') { + group 'jadx' + description = 'Copy bundle to build dir' + destinationDir buildDir + from(tasks.getByPath('jadx-gui:distWinWithJre').outputs) { + include '*.zip' + } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + task cleanBuildDir(type: Delete) { group 'jadx' delete buildDir diff --git a/gradle.properties b/gradle.properties index 6b1823d86..f2c5e7496 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ org.gradle.daemon=false +org.gradle.warning.mode=all diff --git a/jadx-gui/build.gradle b/jadx-gui/build.gradle index 3b4aadcd1..f5c8a1f64 100644 --- a/jadx-gui/build.gradle +++ b/jadx-gui/build.gradle @@ -2,6 +2,7 @@ plugins { id 'application' id 'edu.sc.seis.launch4j' version '2.5.1' id 'com.github.johnrengelman.shadow' version '7.1.0' + id 'org.beryx.runtime' version '1.12.7' } dependencies { @@ -80,13 +81,60 @@ launch4j { copyright = 'Skylot' windowTitle = 'jadx' companyName = 'jadx' - jreMinVersion = '1.8.0' + jreMinVersion = '11' jvmOptions = ['-Dawt.useSystemAAFontSettings=lcd', '-Dswing.aatext=true', '-XX:+UseG1GC'] jreRuntimeBits = "64" bundledJre64Bit = true initialHeapPercent = 5 maxHeapSize = 4096 maxHeapPercent = 70 - downloadUrl = 'https://adoptopenjdk.net/releases.html?variant=openjdk11&jvmVariant=hotspot#x64_win' + downloadUrl = 'https://www.oracle.com/java/technologies/downloads/#jdk17-windows' bundledJrePath = '%JAVA_HOME%' } + +runtime { + addOptions('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages') + addModules( + 'java.desktop', + 'java.naming', + 'java.sql', // TODO: GSON register adapter for java.sql.Time + 'java.xml', + ) + jpackage { + imageOptions = ['--icon', "${projectDir}/src/main/resources/logos/jadx-logo.ico"] + skipInstaller = true + targetPlatformName = "win" + } + launcher { + noConsole = true + } +} + +tasks.register('distLaunch4jConfig') { + def configFile = layout.buildDirectory.file("jadx-gui-${version}.l4j.ini") + outputs.file(configFile).withPropertyName('outputFiles') + + doLast { + configFile.get().getAsFile().write(""" +# Launch4j runtime config +-DJAVA_HOME="%EXEDIR%/jre" +""".trim()) + } +} + +task distWinWithJre(type: Zip, dependsOn: ['runtime', 'createExe', 'distLaunch4jConfig']) { + group 'jadx' + destinationDirectory = buildDir + archiveFileName = "jadx-gui-${jadxVersion}-with-jre-win.zip" + from(runtime.jreDir) { + include '**/*' + into 'jre' + } + from(createExe.outputs) { + include '*.exe' + } + from(distLaunch4jConfig.outputs) { + include '*.ini' + } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +}