2015-06-22 18:41:11 +00:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
}
|
|
|
|
dependencies {
|
2019-04-07 16:15:54 +00:00
|
|
|
classpath 'com.netflix.nebula:gradle-ospackage-plugin:5.3.0' // RPM & DEB support
|
2019-03-10 07:04:40 +00:00
|
|
|
classpath 'edu.sc.seis.gradle:launch4j:2.4.4'
|
2019-06-02 05:23:14 +00:00
|
|
|
classpath 'net.sf.proguard:proguard-gradle:6.1.0'
|
2015-06-22 14:16:07 +00:00
|
|
|
}
|
2015-06-22 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-25 05:34:06 +00:00
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'distribution'
|
2019-03-10 07:04:40 +00:00
|
|
|
apply plugin: 'edu.sc.seis.launch4j'
|
|
|
|
apply plugin: 'nebula.ospackage'
|
|
|
|
|
2015-03-25 05:34:06 +00:00
|
|
|
// Common configuration //
|
2019-07-13 21:39:48 +00:00
|
|
|
rootProject.version='1.6.3'
|
|
|
|
rootProject.ext.set('jdCoreVersion', '1.0.7')
|
2019-03-18 20:18:52 +00:00
|
|
|
targetCompatibility = '1.8'
|
2015-07-07 08:27:15 +00:00
|
|
|
|
2019-03-10 07:04:40 +00:00
|
|
|
allprojects {
|
2015-07-07 08:27:15 +00:00
|
|
|
apply plugin: 'eclipse'
|
|
|
|
apply plugin: 'idea'
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile) {
|
2019-03-18 20:18:52 +00:00
|
|
|
sourceCompatibility = targetCompatibility = '1.8'
|
2019-04-13 09:13:01 +00:00
|
|
|
options.compilerArgs << '-Xlint:deprecation'
|
2019-03-09 18:44:17 +00:00
|
|
|
options.compilerArgs << '-Xlint:unchecked'
|
2019-04-07 16:15:54 +00:00
|
|
|
options.encoding = 'UTF-8'
|
2015-07-07 08:27:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
2019-07-13 21:39:48 +00:00
|
|
|
jcenter()
|
2015-07-07 08:27:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
provided
|
|
|
|
compile.extendsFrom provided
|
|
|
|
}
|
2015-03-25 05:34:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 'cleanIdea' task extension //
|
2019-04-13 09:38:50 +00:00
|
|
|
cleanIdea.doFirst {
|
2019-06-02 05:23:14 +00:00
|
|
|
delete project.name + '.iws'
|
|
|
|
delete 'out'
|
|
|
|
followSymlinks = true
|
2015-03-25 05:34:06 +00:00
|
|
|
}
|
|
|
|
|
2019-05-14 21:50:34 +00:00
|
|
|
// All in one JAR file //
|
2015-06-19 16:19:58 +00:00
|
|
|
subprojects.each { subproject ->
|
2015-07-07 08:27:15 +00:00
|
|
|
evaluationDependsOn(subproject.path)
|
2015-03-25 05:34:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
2015-07-07 08:27:15 +00:00
|
|
|
dependsOn subprojects.tasks['jar']
|
|
|
|
|
2019-04-10 05:09:12 +00:00
|
|
|
// Add SPI directory
|
|
|
|
def tmpSpiDir = file('build/tmp/spi')
|
|
|
|
from tmpSpiDir
|
2019-03-02 15:25:55 +00:00
|
|
|
// Add dependencies
|
2015-07-07 08:27:15 +00:00
|
|
|
def deps = []
|
|
|
|
subprojects.each { subproject ->
|
2019-03-02 15:25:55 +00:00
|
|
|
from subproject.sourceSets.main.output.classesDirs
|
2015-07-07 08:27:15 +00:00
|
|
|
from subproject.sourceSets.main.output.resourcesDir
|
|
|
|
deps += subproject.configurations.runtime - subproject.configurations.provided
|
|
|
|
}
|
|
|
|
subprojects.each { subproject ->
|
|
|
|
deps -= subproject.jar.archivePath
|
|
|
|
}
|
|
|
|
deps = deps.unique().collect { it.isDirectory() ? it : zipTree(it) }
|
2019-03-02 15:25:55 +00:00
|
|
|
from deps
|
2015-07-07 08:27:15 +00:00
|
|
|
|
|
|
|
manifest {
|
|
|
|
attributes 'Main-Class': 'org.jd.gui.App',
|
2019-03-02 15:25:55 +00:00
|
|
|
'SplashScreen-Image': 'org/jd/gui/images/jd_icon_128.png',
|
|
|
|
'JD-GUI-Version': project.version,
|
2019-04-14 20:34:28 +00:00
|
|
|
'JD-Core-Version': project.jdCoreVersion
|
2015-07-07 08:27:15 +00:00
|
|
|
}
|
2019-04-07 16:15:54 +00:00
|
|
|
exclude 'META-INF/licenses/**', 'META-INF/maven/**', 'META-INF/INDEX.LIST'
|
2019-05-14 21:50:34 +00:00
|
|
|
exclude '**/ErrorStrip_*.properties', '**/RSyntaxTextArea_*.properties', '**/RTextArea_*.properties'
|
|
|
|
exclude '**/FocusableTip_*.properties', '**/RSyntaxTextArea_License.txt'
|
2015-07-07 08:27:15 +00:00
|
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
|
|
doFirst {
|
2019-04-10 05:07:43 +00:00
|
|
|
// Create SPI directory
|
2019-04-07 16:29:17 +00:00
|
|
|
tmpSpiDir.deleteDir()
|
|
|
|
def tmpSpiServicesDir = file(tmpSpiDir.path + '/META-INF/services')
|
|
|
|
tmpSpiServicesDir.mkdirs()
|
2015-07-07 08:27:15 +00:00
|
|
|
// Copy and merge SPI config files
|
|
|
|
subprojects.each { subproject ->
|
2019-03-02 15:25:55 +00:00
|
|
|
def servicesDir = file(subproject.sourceSets.main.output.resourcesDir.path + '/META-INF/services')
|
2015-07-07 08:27:15 +00:00
|
|
|
if (servicesDir.exists()) {
|
2019-04-10 05:07:43 +00:00
|
|
|
servicesDir.eachFile { serviceFile ->
|
|
|
|
def target = file(tmpSpiServicesDir.path + '/' + serviceFile.name)
|
|
|
|
target << serviceFile.text
|
2015-07-07 08:27:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-03-25 05:34:06 +00:00
|
|
|
}
|
|
|
|
|
2019-05-14 21:50:34 +00:00
|
|
|
// Minify JAR file //
|
|
|
|
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: 'jar') {
|
|
|
|
configuration 'src/proguard/resources/proguard.config.txt'
|
|
|
|
injars jar.archivePath
|
|
|
|
outjars 'build/libs/' + project.name + '-' + project.version + '-min.jar'
|
|
|
|
libraryjars System.getProperty('java.home') + '/lib/rt.jar'
|
|
|
|
}
|
|
|
|
|
2019-03-10 07:04:40 +00:00
|
|
|
// Java executable wrapper for Windows //
|
|
|
|
launch4j {
|
2019-05-14 21:50:34 +00:00
|
|
|
createExe.dependsOn 'proguard'
|
|
|
|
|
2019-03-10 07:04:40 +00:00
|
|
|
version = textVersion = project.version
|
|
|
|
fileDescription = productName = 'JD-GUI'
|
|
|
|
errTitle 'JD-GUI Windows Wrapper'
|
|
|
|
copyright 'JD-GUI (C) 2008-2019 Emmanuel Dupuy'
|
|
|
|
icon projectDir.path + '/src/launch4j/resources/images/jd-gui.ico'
|
2019-05-14 21:50:34 +00:00
|
|
|
jar projectDir.path + '/' + proguard.outJarFiles[0]
|
2019-05-18 09:09:45 +00:00
|
|
|
bundledJrePath = '%JAVA_HOME%'
|
2015-04-25 15:21:15 +00:00
|
|
|
}
|
|
|
|
|
2019-03-10 07:04:40 +00:00
|
|
|
// Packages for Linux //
|
|
|
|
ospackage {
|
2019-05-14 21:50:34 +00:00
|
|
|
buildDeb.dependsOn 'proguard'
|
|
|
|
buildRpm.dependsOn 'proguard'
|
|
|
|
|
2019-03-10 07:04:40 +00:00
|
|
|
license = file('LICENSE')
|
|
|
|
maintainer 'Emmanuel Dupuy <emmanue1@users.noreply.github.com>'
|
|
|
|
os LINUX
|
|
|
|
packageDescription 'JD-GUI, a standalone graphical utility that displays Java sources from CLASS files'
|
|
|
|
packageGroup 'java'
|
|
|
|
packageName project.name
|
|
|
|
release '0'
|
|
|
|
summary 'A Java Decompiler'
|
|
|
|
url 'https://github.com/java-decompiler/jd-gui'
|
2015-06-19 16:19:58 +00:00
|
|
|
|
2019-03-10 07:04:40 +00:00
|
|
|
into '/opt/' + project.name
|
2019-05-14 21:50:34 +00:00
|
|
|
from (proguard.outJarFiles[0]) {
|
2019-03-10 07:04:40 +00:00
|
|
|
fileMode 0755
|
2015-06-19 16:19:58 +00:00
|
|
|
}
|
2019-03-10 07:04:40 +00:00
|
|
|
from ('src/linux/resources/') {
|
|
|
|
fileMode 0755
|
2015-06-19 16:19:58 +00:00
|
|
|
}
|
2019-03-10 07:04:40 +00:00
|
|
|
from 'LICENSE', 'NOTICE', 'README.md'
|
|
|
|
|
2019-05-14 21:50:34 +00:00
|
|
|
postInstall 'cd /opt/' + project.name + '; ln -s ./' + file(proguard.outJarFiles[0]).name + ' ./jd-gui.jar; xdg-icon-resource install --size 128 --novendor ./jd_icon_128.png jd-gui; xdg-desktop-menu install ./*.desktop'
|
|
|
|
preUninstall 'cd /opt/' + project.name + '; rm -f ./jd-gui.jar; rm -fr ./ext; xdg-desktop-menu uninstall ./*.desktop'
|
2015-04-25 15:21:15 +00:00
|
|
|
}
|
|
|
|
|
2015-05-02 08:26:31 +00:00
|
|
|
// Distributions for OSX and Windows //
|
2015-03-25 05:34:06 +00:00
|
|
|
distributions {
|
2015-07-07 08:27:15 +00:00
|
|
|
osx.contents {
|
|
|
|
into('JD-GUI.app/Contents') {
|
2019-03-09 18:44:17 +00:00
|
|
|
from('src/osx/resources') {
|
|
|
|
include 'Info.plist'
|
2019-05-14 21:50:34 +00:00
|
|
|
expand VERSION: project.version,
|
|
|
|
JAR: file(proguard.outJarFiles[0]).name
|
2019-03-09 18:44:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
into('JD-GUI.app/Contents/MacOS') {
|
|
|
|
from('src/osx/resources') {
|
|
|
|
include 'universalJavaApplicationStub.sh'
|
|
|
|
fileMode 0755
|
|
|
|
}
|
2015-07-07 08:27:15 +00:00
|
|
|
}
|
|
|
|
into('JD-GUI.app/Contents/Resources/Java') {
|
2019-05-14 21:50:34 +00:00
|
|
|
from proguard.outJarFiles[0]
|
2015-07-07 08:27:15 +00:00
|
|
|
}
|
|
|
|
from 'LICENSE', 'NOTICE', 'README.md'
|
|
|
|
}
|
|
|
|
windows.contents {
|
|
|
|
from 'build/launch4j/jd-gui.exe'
|
|
|
|
from 'LICENSE', 'NOTICE', 'README.md'
|
|
|
|
}
|
2015-06-19 16:19:58 +00:00
|
|
|
|
2019-05-14 21:50:34 +00:00
|
|
|
installWindowsDist.dependsOn createExe
|
|
|
|
windowsDistTar.dependsOn createExe
|
|
|
|
windowsDistZip.dependsOn createExe
|
2015-06-22 14:16:07 +00:00
|
|
|
|
2019-05-14 21:50:34 +00:00
|
|
|
installOsxDist.dependsOn 'proguard'
|
|
|
|
osxDistTar.dependsOn 'proguard'
|
|
|
|
osxDistZip.dependsOn 'proguard'
|
|
|
|
}
|
2019-03-10 07:04:40 +00:00
|
|
|
|
|
|
|
build.finalizedBy buildDeb
|
|
|
|
build.finalizedBy buildRpm
|