@@ -18,6 +18,11 @@ version = '2.2.0' + (project.hasProperty('snapshot') ? '-SNAPSHOT' : '')
1818sourceCompatibility = ' 1.8'
1919targetCompatibility = ' 1.8'
2020
21+ ant {
22+ property(file : ' build.properties' )
23+ property(file : " gdal.${ org.gradle.internal.os.OperatingSystem.current().isWindows() ? 'win' : 'unix'} .properties" )
24+ }
25+
2126ext {
2227 joglVersion = ' 2.3.2'
2328 gdalVersion = ' 2.4.0'
@@ -32,14 +37,18 @@ repositories {
3237}
3338
3439dependencies {
35- implementation " org.jogamp.jogl:jogl-all-main:${ project.joglVersion} "
36- implementation " org.jogamp.gluegen:gluegen-rt-main:${ project.joglVersion} "
37-
38- compile " org.gdal:gdal:${ project.gdalVersion} "
40+ compile " org.jogamp.jogl:jogl-all-main:$project . joglVersion "
41+ compile " org.jogamp.gluegen:gluegen-rt-main:$project . joglVersion "
42+
43+ if (project. hasProperty(' systemGDAL' )) {
44+ compile files(" ${ ant.properties['gdal.jar.dir']} /gdal.jar" )
45+ } else {
46+ implementation " org.gdal:gdal:$project . gdalVersion "
47+ }
3948
40- implementation " org.codehaus.jackson:jackson-core-asl:${ project.jacksonVersion} "
49+ compile " org.codehaus.jackson:jackson-core-asl:$project . jacksonVersion "
4150
42- testImplementation " junit:junit:${ project.junitVersion} "
51+ testImplementation " junit:junit:$project . junitVersion "
4352}
4453
4554task sourcesJar (type : Jar , dependsOn : classes) {
@@ -64,12 +73,12 @@ task extensionsJar(type: Jar) {
6473 exclude ' images/**'
6574 exclude ' gov/nasa/worldwind/**'
6675 }
67- }
68- extensionsJar . doLast {
69- copy {
70- from " $b uildDir /libs/ ${ extensionsJar.archiveName } "
71- into " ${ project.projectDir } "
72- rename " ${ extensionsJar.archiveName } " , " ${ extensionsJar.baseName } . ${ extensionsJar.extension } "
76+ doLast {
77+ copy {
78+ from " $b uildDir /libs/ $e xtensionsJar . archiveName "
79+ into project . projectDir
80+ rename " $e xtensionsJar . archiveName " , " $e xtensionsJar . baseName . $e xtensionsJar . extension "
81+ }
7382 }
7483}
7584
@@ -85,7 +94,7 @@ def pomConfig = {
8594 license {
8695 name ' NASA Open Source Agreement v1.3'
8796 url ' https://ti.arc.nasa.gov/opensource/nosa/'
88- distribution " repo"
97+ distribution ' repo'
8998 }
9099 }
91100 developers {
@@ -96,7 +105,7 @@ def pomConfig = {
96105 }
97106 }
98107 scm {
99- url " https://github.com/WorldWindEarth/WorldWindJava"
108+ url ' https://github.com/WorldWindEarth/WorldWindJava'
100109 }
101110}
102111
@@ -145,7 +154,7 @@ bintray {
145154 githubRepo = ' WorldWindEarth/WorldWindJava'
146155 version {
147156 name = project. version
148- desc = ' WorldWind v' + project. version
157+ desc = " WorldWind v$ project . version "
149158 vcsTag = System . getenv(' TRAVIS_TAG' )
150159 released = new Date ()
151160 }
@@ -194,25 +203,25 @@ compileJava {
194203
195204test {
196205 dependsOn jar
197- classpath + = project. files(" $buildDir /libs/${ jar.archiveName} " , configurations. runtime)
206+ classpath + = project. files(" $buildDir /libs/$jar . archiveName " , configurations. runtime)
198207}
199208
200209jar {
201210 dependsOn classes
202211 from sourceSets. main. output
203212 exclude ' gov/nasa/worldwindx/**'
204- }
205- jar . doLast {
206- copy {
207- from " $b uildDir /libs/ ${ jar.archiveName } "
208- into " ${ project.projectDir } "
209- rename " ${ jar.archiveName } " , " ${ jar.baseName } . ${ jar.extension } "
213+ doLast {
214+ copy {
215+ from " $b uildDir /libs/ $j ar . archiveName "
216+ into project . projectDir
217+ rename " $j ar . archiveName " , " $j ar . baseName . $j ar . extension "
218+ }
210219 }
211220}
212221
213222javadoc {
214223 options {
215- overview = " ${ project.projectDir} /src/overview.html"
224+ overview = " $project . projectDir /src/overview.html"
216225 windowTitle = ' WorldWindJava API'
217226 title = ' NASA WorldWind Java-Community Edition'
218227 header = ' NASA WorldWind-CE'
@@ -231,3 +240,94 @@ artifacts {
231240 archives extensionsJar
232241 archives javadocJar
233242}
243+
244+ task processMilStd2525SVGs (dependsOn : jar) {
245+ group = ' build'
246+ description = ' Processes the MIL-STD-2525 SVG source files.'
247+
248+ // Set outputs of this task to be PNG directory.
249+ def milStd2525PngDir = file(ant. properties[' milstd2525.png.dir' ])
250+ outputs. dir(milStd2525PngDir)
251+
252+ doLast {
253+ def milStd2525SrcDir = file(ant. properties[' milstd2525.src.dir' ])
254+
255+ // If PNG directory doesn't exist, create it.
256+ if (! milStd2525PngDir. exists()) {
257+ milStd2525PngDir. mkdirs()
258+ }
259+
260+ def width = ant. properties[' milstd2525.png.width' ]
261+ def height = ant. properties[' milstd2525.png.height' ]
262+
263+ // Rasterize the MIL-STD-2525 SVG sources. Exclude empty directories in order
264+ // to suppress erroneous error messages from the Apache Batik Rasterizer.
265+ milStd2525SrcDir. traverse([type : groovy.io.FileType . DIRECTORIES , excludeNameFilter : ~/ fills|frames|icons/ ]) { srcDir ->
266+ def dstDir = milStd2525PngDir. path + (srcDir. path - milStd2525SrcDir. path)
267+ exec {
268+ commandLine ' java' ,\
269+ ' -jar' ,\
270+ " $project . projectDir /lib-external/batik/batik-rasterizer.jar" ,\
271+ ' -m' ,\
272+ ' image/png' ,\
273+ ' -maxw' ,\
274+ width,\
275+ ' -h' ,\
276+ height,\
277+ ' -d' ,\
278+ dstDir,\
279+ srcDir
280+ }
281+ }
282+
283+ // The Forward Edge of Battle (FEBA, 2.X.2.4.2.1) image has a custom height of 16 pixels.
284+ milStd2525SrcDir. traverse([type : groovy.io.FileType . FILES , nameFilter : ~/ g-g.dlf--------\. svg/ ]) { srcFile ->
285+ def dstFile = ((milStd2525PngDir. path + (srcFile. path - milStd2525SrcDir. path)) - ' .svg' ) + ' .png'
286+ exec {
287+ commandLine ' java' ,\
288+ ' -jar' ,\
289+ " $project . projectDir /lib-external/batik/batik-rasterizer.jar" ,\
290+ ' -m' ,\
291+ ' image/png' ,\
292+ ' -maxw' ,\
293+ width,\
294+ ' -h' ,\
295+ ' 16' ,\
296+ ' -d' ,\
297+ dstFile,\
298+ srcFile
299+ }
300+ }
301+
302+ // Trim the MIL-STD-2525 modifier images to remove transparent borders.
303+ def modifiersDir = file(" $milStd2525PngDir . path /modifiers" )
304+ modifiersDir. traverse([type : groovy.io.FileType . FILES ]) { srcFile ->
305+ exec {
306+ commandLine ' java' ,\
307+ ' -cp' ,\
308+ " $buildDir /libs/$jar . archiveName " ,\
309+ ' gov.nasa.worldwind.util.ImageTrimmer' ,\
310+ srcFile
311+ }
312+ }
313+ }
314+ }
315+
316+ task milStd2525Zip (type : Zip , dependsOn : processMilStd2525SVGs) {
317+ group = ' build'
318+ description = ' Assembles the MIL-STD-2525 symbology package.'
319+ def milStd2525OutDir = file(ant. properties[' milstd2525.out.dir' ])
320+ def milStd2525PngDir = file(ant. properties[' milstd2525.png.dir' ])
321+ from milStd2525PngDir
322+ include ' **/*'
323+ archiveName ' milstd2525-symbols.zip'
324+ destinationDir milStd2525OutDir
325+ }
326+
327+ task runLayerManager (type : JavaExec , dependsOn : classes) {
328+ group = ' run'
329+ description = ' Runs the LayerManager example app.'
330+ classpath sourceSets. main. runtimeClasspath
331+ main = ' gov.nasa.worldwindx.examples.layermanager.LayerManagerApp'
332+ systemProperty ' java.util.logging.config.file' , " $project . projectDir /logging.properties"
333+ }
0 commit comments