forked from java-decompiler/jd-gui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
94 lines (83 loc) · 2.2 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
apply plugin: 'java'
apply plugin: 'distribution'
// Common configuration //
allprojects {
version='1.0.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()
}
configurations {
provided
compile.extendsFrom provided
}
}
// 'cleanIdea' task extension //
task fullCleanIdea {
file(project.name + '.iws').delete()
ant.delete(dir: 'out')
}
fullCleanIdea.mustRunAfter cleanIdea
// All in one JAR //
subprojects.each { subproject ->
evaluationDependsOn(subproject.path)
}
jar {
dependsOn subprojects.tasks['classes']
manifest {
attributes 'Main-Class': 'jd.gui.App', 'SplashScreen-Image': 'images/jd_icon_128.png'
}
def deps = []
subprojects.each { subproject ->
from subproject.sourceSets.main.output.classesDir
from subproject.sourceSets.main.output.resourcesDir
deps += subproject.configurations.runtime - subproject.configurations.provided
}
from { deps.unique().collect { it.isDirectory() ? it : zipTree(it) } }
}
// 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'
commandLine 'cmd', '/c', launch4jExe, launch4jCfg
doFirst {
if (new File(launch4jExe).exists() == false) {
errorOutput.println "ERROR: 'LAUNCH4J_HOME' not defined or invalid. Launch4j (http://launch4j.sourceforge.net) is required to generare 'jd-gui.exe'."
}
}
}
// Distribution for OSX //
distributions {
osx {
contents {
into('JD-GUI.app/Contents/Resources/Java') {
from jar.archivePath
}
from 'LICENSE', 'NOTICE', 'README.md'
}
}
windows {
contents {
from 'build/launch4j/jd-gui.exe'
from 'LICENSE', 'NOTICE', 'README.md'
}
}
}