mirror of
https://github.com/java-decompiler/jd-gui.git
synced 2024-12-02 17:46:41 +00:00
153 lines
3.9 KiB
Groovy
153 lines
3.9 KiB
Groovy
apply plugin: 'java'
|
|
apply plugin: 'distribution'
|
|
|
|
// Common configuration //
|
|
allprojects {
|
|
version='1.2.0'
|
|
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'idea'
|
|
|
|
tasks.withType(JavaCompile) {
|
|
sourceCompatibility = '1.7'
|
|
targetCompatibility = '1.7'
|
|
}
|
|
tasks.withType(GroovyCompile) {
|
|
sourceCompatibility = '1.7'
|
|
targetCompatibility = '1.7'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url 'https://raw.github.com/java-decompiler/mvn-repo/master'
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
provided
|
|
compile.extendsFrom provided
|
|
}
|
|
}
|
|
|
|
// 'cleanIdea' task extension //
|
|
cleanIdea {
|
|
file(project.name + '.iws').delete()
|
|
ant.delete(dir: 'out')
|
|
}
|
|
|
|
// All in one JAR //
|
|
subprojects.each { subproject ->
|
|
evaluationDependsOn(subproject.path)
|
|
}
|
|
|
|
jar {
|
|
dependsOn subprojects.tasks['jar']
|
|
|
|
def deps = []
|
|
subprojects.each { subproject ->
|
|
from subproject.sourceSets.main.output.classesDir
|
|
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) }
|
|
|
|
manifest {
|
|
attributes 'Main-Class': 'jd.gui.App',
|
|
'SplashScreen-Image': 'images/jd_icon_128.png',
|
|
'JD-GUI-Version': project.version,
|
|
'JD-Core-Version': '0.7.1'
|
|
}
|
|
from deps
|
|
exclude 'META-INF/services/jd.gui.spi.*'
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
doFirst {
|
|
// Create temporary directory
|
|
def tmpSpiDir = file('build/tmp/spi')
|
|
tmpSpiDir.deleteDir()
|
|
tmpSpiDir.mkdirs()
|
|
// Copy and merge SPI config files
|
|
subprojects.each { subproject ->
|
|
def servicesDir = file(subproject.sourceSets.main.output.resourcesDir.path + File.separator + 'META-INF' + File.separator + 'services')
|
|
if (servicesDir.exists()) {
|
|
servicesDir.eachFile { source ->
|
|
def target = file(tmpSpiDir.path + File.separator + source.name)
|
|
target << source.text
|
|
}
|
|
}
|
|
}
|
|
// Add to JAR file
|
|
into('META-INF/services') {
|
|
from tmpSpiDir
|
|
}
|
|
}
|
|
}
|
|
|
|
// Windows wrapper configuration to generate "jd-gui.exe" //
|
|
task launch4jConfig(type: Copy) {
|
|
from 'src/launch4j/resources/config/launch4j.xml'
|
|
into 'build/launch4j'
|
|
expand(
|
|
JAR_FILE: project.jar.archivePath,
|
|
VERSION: project.version,
|
|
ICON: file('src/launch4j/resources/images/jd-gui.ico')
|
|
)
|
|
}
|
|
|
|
task launch4j(type: Exec, dependsOn: [':jar', ':launch4jConfig']) {
|
|
def launch4jCfg = file('build/launch4j/launch4j.xml')
|
|
def launch4jExe = System.properties['LAUNCH4J_HOME'] + '/launch4j.exe'
|
|
|
|
onlyIf {
|
|
System.properties['os.name'].startsWith('Windows')
|
|
}
|
|
|
|
if (new File(launch4jExe).exists()) {
|
|
commandLine 'cmd', '/c', launch4jExe, launch4jCfg
|
|
} else {
|
|
commandLine 'cmd', '/c', 'echo', 'OFF'
|
|
doLast {
|
|
errorOutput.println "ERROR: 'LAUNCH4J_HOME' not defined or invalid. Launch4j (http://launch4j.sourceforge.net) is required to generare 'jd-gui.exe'."
|
|
}
|
|
}
|
|
}
|
|
|
|
// Distributions for OSX and Windows //
|
|
task copyAndReplaceVariablesInInfoPlist(type: Copy) {
|
|
from 'src/osx/resources/Info.plist'
|
|
into 'build/tmp/distributions/osx'
|
|
expand(
|
|
VERSION: project.version
|
|
)
|
|
}
|
|
|
|
distributions {
|
|
osx.contents {
|
|
into('JD-GUI.app/Contents') {
|
|
from 'build/tmp/distributions/osx'
|
|
}
|
|
into('JD-GUI.app/Contents/Resources/Java') {
|
|
from jar.archivePath
|
|
}
|
|
from 'LICENSE', 'NOTICE', 'README.md'
|
|
doFirst {
|
|
ant.chmod(file:'src/osx/dist/JD-GUI.app/Contents/MacOS/universalJavaApplicationStub.sh', perm:'+x')
|
|
}
|
|
}
|
|
windows.contents {
|
|
from 'build/launch4j/jd-gui.exe'
|
|
from 'LICENSE', 'NOTICE', 'README.md'
|
|
}
|
|
}
|
|
|
|
installOsxDist.dependsOn jar, copyAndReplaceVariablesInInfoPlist
|
|
osxDistTar.dependsOn jar, copyAndReplaceVariablesInInfoPlist
|
|
osxDistZip.dependsOn jar, copyAndReplaceVariablesInInfoPlist
|
|
|
|
installWindowsDist.dependsOn launch4j
|
|
windowsDistTar.dependsOn launch4j
|
|
windowsDistZip.dependsOn launch4j
|