jd-gui/build.gradle

188 lines
5.8 KiB
Groovy
Raw Normal View History

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'
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')
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) {
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 {
delete project.name + '.iws'
delete 'out'
followSymlinks = true
2015-03-25 05:34:06 +00:00
}
// All in one JAR file //
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'
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
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
}
// 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 {
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'
jar projectDir.path + '/' + proguard.outJarFiles[0]
bundledJrePath = '%JAVA_HOME%'
2015-04-25 15:21:15 +00:00
}
2019-03-10 07:04:40 +00:00
// Packages for Linux //
ospackage {
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'
2019-03-10 07:04:40 +00:00
into '/opt/' + project.name
from (proguard.outJarFiles[0]) {
2019-03-10 07:04:40 +00:00
fileMode 0755
}
2019-03-10 07:04:40 +00:00
from ('src/linux/resources/') {
fileMode 0755
}
2019-03-10 07:04:40 +00:00
from 'LICENSE', 'NOTICE', 'README.md'
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'
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') {
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'
}
installWindowsDist.dependsOn createExe
windowsDistTar.dependsOn createExe
windowsDistZip.dependsOn createExe
2015-06-22 14:16:07 +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