build.gradle 3.5 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
	implementation(project(':jadx-core'))
S
Skylot 已提交
10

11
	implementation(project(":jadx-cli"))
S
Skylot 已提交
12
	implementation 'com.beust:jcommander:1.82'
S
Skylot 已提交
13
	implementation 'ch.qos.logback:logback-classic:1.2.11'
14

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

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

S
Skylot 已提交
24
	implementation 'com.google.code.gson:gson:2.9.0'
S
Skylot 已提交
25
	implementation 'org.apache.commons:commons-lang3:3.12.0'
S
Skylot 已提交
26
	implementation 'org.apache.commons:commons-text:1.9'
27

S
Skylot 已提交
28
	implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
29
	implementation "com.github.akarnokd:rxjava2-swing:0.3.7"
S
Skylot 已提交
30
	implementation 'com.android.tools.build:apksig:4.2.1'
31
	implementation 'io.github.hqktech:jdwp:1.0'
32 33

	testImplementation project(":jadx-core").sourceSets.test.output
S
Skylot 已提交
34 35 36
}

application {
S
Skylot 已提交
37
	applicationName = 'jadx-gui'
38
	mainClass.set('jadx.gui.JadxGUI')
39 40 41
	// 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',
								 '-Dawt.useSystemAAFontSettings=lcd', '-Dswing.aatext=true']
S
Skylot 已提交
42 43 44
}

applicationDistribution.with {
S
Skylot 已提交
45 46 47 48 49 50
	into('') {
		from '../'
		include 'README.md'
		include 'NOTICE'
		include 'LICENSE'
	}
S
Skylot 已提交
51 52
}

53
jar {
S
Skylot 已提交
54 55
	manifest {
		attributes(
56
				"Main-Class": application.mainClass.get(),
57
				"Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ')
S
Skylot 已提交
58 59
		)
	}
S
Skylot 已提交
60 61
}

62 63 64
shadow {
	mainClassName = application.mainClass.get()
}
65 66 67 68
shadowJar {
	mergeServiceFiles()
}

S
Skylot 已提交
69
startScripts {
S
Skylot 已提交
70 71 72 73 74 75
	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
	}
76 77
}

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

runtime {
	addOptions('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages')
	addModules(
			'java.desktop',
			'java.naming',
103
			//'java.sql', // TODO: GSON register adapter for java.sql.Time
S
Skylot 已提交
104 105 106 107 108 109 110 111 112 113 114 115
			'java.xml',
	)
	jpackage {
		imageOptions = ['--icon', "${projectDir}/src/main/resources/logos/jadx-logo.ico"]
		skipInstaller = true
		targetPlatformName = "win"
	}
	launcher {
		noConsole = true
	}
}

S
Skylot 已提交
116
task distWinWithJre(type: Zip, dependsOn: ['runtime', 'createExe']) {
S
Skylot 已提交
117 118 119 120 121 122 123 124 125 126 127 128
	group 'jadx'
	destinationDirectory = buildDir
	archiveFileName = "jadx-gui-${jadxVersion}-with-jre-win.zip"
	from(runtime.jreDir) {
		include '**/*'
		into 'jre'
	}
	from(createExe.outputs) {
		include '*.exe'
	}
	duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}