build.gradle 4.2 KB
Newer Older
S
Skylot 已提交
1
plugins {
S
Skylot 已提交
2
	id 'application'
S
Skylot 已提交
3
	id 'edu.sc.seis.launch4j' version '2.5.3'
S
Skylot 已提交
4
	id 'com.github.johnrengelman.shadow' version '7.1.2'
S
Skylot 已提交
5
	id 'org.beryx.runtime' version '1.12.7'
S
Skylot 已提交
6 7
}

S
Skylot 已提交
8
dependencies {
9 10
	implementation(project(':jadx-core'))
	implementation(project(":jadx-cli"))
S
Skylot 已提交
11
	implementation 'com.beust:jcommander:1.82'
S
Skylot 已提交
12
	implementation 'ch.qos.logback:logback-classic:1.3.1'
13

S
Skylot 已提交
14
	implementation 'com.fifesoft:rsyntaxtextarea:3.3.0'
15 16
	implementation files('libs/jfontchooser-1.0.5.jar')
	implementation 'hu.kazocsaba:image-viewer:1.2.3'
17

S
Skylot 已提交
18 19 20
	implementation 'com.formdev:flatlaf:2.5'
	implementation 'com.formdev:flatlaf-intellij-themes:2.5'
	implementation 'com.formdev:flatlaf-extras:2.5'
S
Skylot 已提交
21
	implementation 'com.formdev:svgSalamander:1.1.3'
22

S
Skylot 已提交
23
	implementation 'com.google.code.gson:gson:2.9.1'
S
Skylot 已提交
24
	implementation 'org.apache.commons:commons-lang3:3.12.0'
S
Skylot 已提交
25
	implementation 'org.apache.commons:commons-text:1.10.0'
26

S
Skylot 已提交
27
	implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
28
	implementation "com.github.akarnokd:rxjava2-swing:0.3.7"
S
Skylot 已提交
29
	implementation 'com.android.tools.build:apksig:7.3.0'
30
	implementation 'io.github.skylot:jdwp:2.0.0'
31

32 33 34 35 36
	// TODO: Switch back to upstream once this PR gets merged:
	//   https://github.com/FabricMC/mapping-io/pull/19
	// implementation 'net.fabricmc:mapping-io:0.3.0'
	implementation files('libs/mapping-io-0.4.0-SNAPSHOT.jar')

37
	testImplementation project(":jadx-core").sourceSets.test.output
S
Skylot 已提交
38 39 40
}

application {
S
Skylot 已提交
41
	applicationName = 'jadx-gui'
42
	mainClass.set('jadx.gui.JadxGUI')
43 44
	// The option -XX:+UseG1GC is only relevant for Java 8. Starting with Java 9 G1GC is already the default GC
	applicationDefaultJvmArgs = ['-Xms128M', '-XX:MaxRAMPercentage=70.0', '-XX:+UseG1GC',
45 46
								 '-Dawt.useSystemAAFontSettings=lcd', '-Dswing.aatext=true',
								 '-Djava.util.Arrays.useLegacyMergeSort=true']
S
Skylot 已提交
47 48 49
}

applicationDistribution.with {
S
Skylot 已提交
50 51 52 53 54 55
	into('') {
		from '../'
		include 'README.md'
		include 'NOTICE'
		include 'LICENSE'
	}
S
Skylot 已提交
56 57
}

58
jar {
S
Skylot 已提交
59 60
	manifest {
		attributes(
61
				"Main-Class": application.mainClass.get(),
62
				"Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ')
S
Skylot 已提交
63 64
		)
	}
S
Skylot 已提交
65 66
}

67 68 69
shadow {
	mainClassName = application.mainClass.get()
}
70 71 72 73
shadowJar {
	mergeServiceFiles()
}

S
Skylot 已提交
74
startScripts {
S
Skylot 已提交
75 76 77 78 79 80
	doLast {
		def str = windowsScript.text
		str = str.replaceAll('java.exe', 'javaw.exe')
		str = str.replaceAll('"%JAVA_EXE%" %DEFAULT_JVM_OPTS%', 'start "jadx-gui" /B "%JAVA_EXE%" %DEFAULT_JVM_OPTS%')
		windowsScript.text = str
	}
81 82
}

S
Skylot 已提交
83
launch4j {
84
	mainClassName = application.mainClass.get()
S
Skylot 已提交
85
	copyConfigurable = project.tasks.shadowJar.outputs.files
86
	jarTask = project.tasks.shadowJar
S
Skylot 已提交
87 88 89 90 91
	icon = "${projectDir}/src/main/resources/logos/jadx-logo.ico"
	outfile = "jadx-gui-${version}.exe"
	copyright = 'Skylot'
	windowTitle = 'jadx'
	companyName = 'jadx'
S
Skylot 已提交
92
	jreMinVersion = '11'
93
	jvmOptions = ['-Dawt.useSystemAAFontSettings=lcd', '-Dswing.aatext=true', '-XX:+UseG1GC', '-Djava.util.Arrays.useLegacyMergeSort=true']
S
Skylot 已提交
94
	jreRuntimeBits = "64"
95
	bundledJre64Bit = true
S
Skylot 已提交
96 97 98
	initialHeapPercent = 5
	maxHeapSize = 4096
	maxHeapPercent = 70
S
Skylot 已提交
99
	downloadUrl = 'https://www.oracle.com/java/technologies/downloads/#jdk17-windows'
S
Skylot 已提交
100
	bundledJrePath = project.hasProperty("bundleJRE") ? '%EXEDIR%/jre' : '%JAVA_HOME%'
S
Skylot 已提交
101
}
S
Skylot 已提交
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119

runtime {
	addOptions('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages')
	addModules(
			'java.desktop',
			'java.naming',
			'java.xml',
	)
	jpackage {
		imageOptions = ['--icon', "${projectDir}/src/main/resources/logos/jadx-logo.ico"]
		skipInstaller = true
		targetPlatformName = "win"
	}
	launcher {
		noConsole = true
	}
}

S
Skylot 已提交
120
task copyDistWinWithJre(type: Copy, dependsOn: ['runtime', 'createExe']) {
S
Skylot 已提交
121
	group 'jadx'
S
Skylot 已提交
122
	destinationDir = new File(buildDir, "jadx-gui-${jadxVersion}-with-jre-win")
S
Skylot 已提交
123 124 125 126 127 128 129 130 131
	from(runtime.jreDir) {
		include '**/*'
		into 'jre'
	}
	from(createExe.outputs) {
		include '*.exe'
	}
	duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
S
Skylot 已提交
132 133 134 135 136 137 138 139 140 141

task distWinWithJre(type: Zip, dependsOn: ['copyDistWinWithJre']) {
	group 'jadx'
	destinationDirectory = buildDir
	archiveFileName = "jadx-gui-${jadxVersion}-with-jre-win.zip"
	from(copyDistWinWithJre.outputs) {
		include '**/*'
	}
	duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
142 143 144 145 146

task addNewNLSLines(type: JavaExec) {
	classpath = sourceSets.main.runtimeClasspath
	mainClass.set('jadx.gui.utils.tools.NLSAddNewLines')
}