-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
115 lines (98 loc) · 3.14 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
plugins {
id 'application' // uses the java and distribution plugin
}
repositories {
mavenCentral()
maven { url "https://java.freehep.org/maven2" }
}
dependencies {
// NOTE: we're using our own patched version of autocomplete!
// implementation group: 'com.fifesoft', name: 'autocomplete', version: '2.6.0'
implementation files('lib/rsyntax/autocomplete-2.6.0.jar')
implementation 'com.fifesoft:rsyntaxtextarea:2.6.0'
// graph libraries
implementation 'net.sf.jung:jung-graph-impl:2.0.1'
implementation 'net.sf.jung:jung-visualization:2.0.1'
implementation 'net.sf.jung:jung-algorithms:2.0.1'
// pdf export
implementation 'org.freehep:freehep-export:2.1.1'
}
// by default just (build and) run XabslEditor
defaultTasks 'run' // 'clean', 'build',
// Set the project version and Java compatibility versions
version = '1.2'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// Configure the application plugin
application {
mainClass = 'de.naoth.xabsleditor.Main'
executableDir = '' // do not create a "bin" directory in install/zip
// workaround for Java 11++
applicationDefaultJvmArgs = [
'-Djava.util.Arrays.useLegacyMergeSort=true'
]
}
// Set source and resource directories, disable test directories
sourceSets {
main {
java.srcDirs = ['src']
resources.srcDirs = ['src/de/naoth/xabsleditor/res']
output.resourcesDir = file('build/resources/de/naoth/xabsleditor/res') // default: build/resources/main
runtimeClasspath += files('build/resources') // make sure, running from build directory finds the resources
}
test {
java.srcDirs = []
resources.srcDirs = []
}
}
def additionalResources = ['**/*.html', '**/*.png', '**/*.gif']
processResources {
// copy the additional resources to the build directory
from('src/de/naoth/xabsleditor/') {
include additionalResources
into '../'
includeEmptyDirs = false
}
}
// "install" the resulting application to the "dist" directory (mimic the old behavior)
installDist {
destinationDir = file("$projectDir/dist")
}
// Disable tar generation
distTar {
enabled = false
}
// Ensure "installDist" task is executed after build
build {
finalizedBy installDist
}
// make sure the dist directory is also cleaned (since we're moved it out of the build directory)
tasks.register('cleanDist', Delete) {
delete "$projectDir/dist"
}
clean {
finalizedBy tasks.cleanDist
}
// Modify the path of resource files before copying them and create a manifest for the JAR
jar {
eachFile {
file ->
if (file.name == file.path) {
file.path = "de/naoth/xabsleditor/res/" + file.name
}
}
from('src/de/naoth/xabsleditor/') {
include additionalResources
into 'de/naoth/xabsleditor'
}
manifest {
attributes(
'Class-Path': sourceSets.main.runtimeClasspath.files.collect { it.name }.join(' '),
'Main-Class': application.mainClass
)
}
// exclude duplicate files
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}