forked from NASAWorldWind/WorldWindJava
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.gradle
272 lines (243 loc) · 8.05 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
apply plugin: 'java-library'
apply plugin: 'maven-publish'
group = 'earth.worldwind'
version = '2.3.1' + (project.hasProperty('snapshot') ? '-SNAPSHOT' : '')
ant {
property(file: 'release-build.properties')
property(file: "gdal.${org.gradle.internal.os.OperatingSystem.current().isWindows() ? 'win' : 'unix'}.properties")
}
ext {
joglVersion = '2.5.0'
gdalVersion = '3.10.0'
jacksonVersion = '1.9.13'
junitVersion = '4.5'
}
repositories {
mavenLocal()
mavenCentral()
maven { url = "https://jogamp.org/deployment/maven/" }
}
dependencies {
implementation "org.jogamp.jogl:jogl-all-main:$project.joglVersion"
implementation "org.jogamp.gluegen:gluegen-rt-main:$project.joglVersion"
if (project.hasProperty('systemGDAL')) {
implementation files("${ant.properties['gdal.jar.dir']}/gdal.jar")
} else {
implementation "org.gdal:gdal:$project.gdalVersion"
}
implementation "org.codehaus.jackson:jackson-core-asl:$project.jacksonVersion"
testImplementation "junit:junit:$project.junitVersion"
}
task sourcesJar(type: Jar, dependsOn: classes) {
group = 'build'
description = 'Assembles a jar archive containing the sources.'
classifier = 'sources'
from (sourceSets.main.allSource) {
include '**/*.java'
exclude 'config/**'
exclude 'images/**'
exclude 'gov/nasa/worldwindx/**'
}
}
task extensionsJar(type: Jar) {
group = 'build'
description = 'Assembles a jar archive containing the extension classes.'
baseName = 'worldwindx'
from (sourceSets.main.output) {
exclude 'com/**'
exclude 'config/**'
exclude 'images/**'
exclude 'gov/nasa/worldwind/**'
}
doLast {
copy {
from "$buildDir/libs/$extensionsJar.archiveFileName"
into project.projectDir
rename "$extensionsJar.archiveFileName", "$extensionsJar.baseName.$extensionsJar.extension"
}
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
group = 'build'
description = 'Assembles a jar archive containing the javadocs.'
classifier = 'javadoc'
from javadoc.destinationDir
}
def pomConfig = {
licenses {
license {
name 'NASA Open Source Agreement v1.3'
url 'https://ti.arc.nasa.gov/opensource/nosa/'
distribution 'repo'
}
}
developers {
developer {
id 'emxsys'
name 'Bruce Schubert'
email 'bruce@emxsys.com'
}
}
scm {
url 'https://github.com/WorldWindEarth/WorldWindJava'
}
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version project.version
pom.withXml {
def root = asNode()
root.appendNode('description',
'A community supported fork of the NASA WorldWind Java SDK (WWJ)' +
'is for building cross-platform 3D geospatial desktop applications in Java.'
)
root.appendNode('name', project.name)
root.appendNode('url', 'https://github.com/WorldWindEarth/WorldWindJava')
root.children().last() + pomConfig
}
}
}
}
sourceSets {
main {
java {
srcDirs = ['src']
include '**/*.java'
}
resources {
srcDirs = ['src']
exclude '**/*.java'
}
}
test {
java {
srcDirs = ['test']
}
}
}
compileJava {
options.debug = !project.hasProperty('release')
}
test {
dependsOn jar
classpath += project.files("$buildDir/libs/$jar.archiveFileName")
}
jar {
dependsOn classes
from sourceSets.main.output
exclude 'gov/nasa/worldwindx/**'
doLast {
copy {
from "$buildDir/libs/$jar.archiveFileName"
into project.projectDir
rename "$jar.archiveFileName", "$jar.baseName.$jar.extension"
}
}
}
javadoc {
options {
overview = "$project.projectDir/src/overview.html"
windowTitle = 'WorldWindJava API'
title = 'NASA WorldWind Java-Community Edition'
header = 'NASA WorldWind-CE'
splitIndex = true
noDeprecated = true
version = false
author = false
use = true
}
exclude 'com/**'
exclude 'gov/nasa/worldwind/formats/**'
}
artifacts {
archives sourcesJar
archives extensionsJar
archives javadocJar
}
task processMilStd2525SVGs(dependsOn: jar) {
group = 'build'
description = 'Processes the MIL-STD-2525 SVG source files.'
// Set outputs of this task to be PNG directory.
def milStd2525PngDir = file(ant.properties['milstd2525.png.dir'])
outputs.dir(milStd2525PngDir)
doLast {
def milStd2525SrcDir = file(ant.properties['milstd2525.src.dir'])
// If PNG directory doesn't exist, create it.
if (!milStd2525PngDir.exists()) {
milStd2525PngDir.mkdirs()
}
def width = ant.properties['milstd2525.png.width']
def height = ant.properties['milstd2525.png.height']
// Rasterize the MIL-STD-2525 SVG sources. Exclude empty directories in order
// to suppress erroneous error messages from the Apache Batik Rasterizer.
milStd2525SrcDir.traverse([type: groovy.io.FileType.DIRECTORIES, excludeNameFilter: ~/fills|frames|icons/]) { srcDir ->
def dstDir = milStd2525PngDir.path + (srcDir.path - milStd2525SrcDir.path)
exec {
commandLine 'java',\
'-jar',\
"$project.projectDir/lib-external/batik/batik-rasterizer.jar",\
'-m',\
'image/png',\
'-maxw',\
width,\
'-h',\
height,\
'-d',\
dstDir,\
srcDir
}
}
// The Forward Edge of Battle (FEBA, 2.X.2.4.2.1) image has a custom height of 16 pixels.
milStd2525SrcDir.traverse([type: groovy.io.FileType.FILES, nameFilter: ~/g-g.dlf--------\.svg/]) { srcFile ->
def dstFile = ((milStd2525PngDir.path + (srcFile.path - milStd2525SrcDir.path)) - '.svg') + '.png'
exec {
commandLine 'java',\
'-jar',\
"$project.projectDir/lib-external/batik/batik-rasterizer.jar",\
'-m',\
'image/png',\
'-maxw',\
width,\
'-h',\
'16',\
'-d',\
dstFile,\
srcFile
}
}
// Trim the MIL-STD-2525 modifier images to remove transparent borders.
def modifiersDir = file("$milStd2525PngDir.path/modifiers")
modifiersDir.traverse([type: groovy.io.FileType.FILES]) { srcFile ->
exec {
commandLine 'java',\
'-cp',\
"$buildDir/libs/$jar.archiveFileName",\
'gov.nasa.worldwind.util.ImageTrimmer',\
srcFile
}
}
}
}
task milStd2525Zip(type: Zip, dependsOn: processMilStd2525SVGs) {
group = 'build'
description = 'Assembles the MIL-STD-2525 symbology package.'
def milStd2525OutDir = file(ant.properties['milstd2525.out.dir'])
def milStd2525PngDir = file(ant.properties['milstd2525.png.dir'])
from milStd2525PngDir
include '**/*'
archiveName 'milstd2525-symbols.zip'
destinationDir milStd2525OutDir
}
task runLayerManager(type: JavaExec, dependsOn: classes) {
group = 'run'
description = 'Runs the LayerManager example app.'
classpath sourceSets.main.runtimeClasspath
main = 'gov.nasa.worldwindx.examples.layermanager.LayerManagerApp'
systemProperty 'java.util.logging.config.file', "$project.projectDir/logging.properties"
}