Skip to content

Commit 01e61ad

Browse files
committed
Allow system GDAL to be used in Gradle builds.
Modified the build.gradle file by adding an entry in the ant-block to load either the Windows or Linux GDAL properties file based on whether we are running in Windows or not. The dependencies clause was also modified by adding a check to see if the "systemGDAL" property was specified as a property on the command-line during a build. If this was the case then the GDAL jar on the system will be used during the build, else the default published one will be used from the maven-central or jcenter repositories.
1 parent a81b599 commit 01e61ad

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ targetCompatibility = '1.8'
2020

2121
ant {
2222
property(file: 'build.properties')
23+
property(file: "gdal.${org.gradle.internal.os.OperatingSystem.current().isWindows() ? 'win' : 'unix'}.properties")
2324
}
2425

2526
ext {
@@ -38,8 +39,12 @@ repositories {
3839
dependencies {
3940
compile "org.jogamp.jogl:jogl-all-main:$project.joglVersion"
4041
compile "org.jogamp.gluegen:gluegen-rt-main:$project.joglVersion"
41-
42-
implementation "org.gdal:gdal:$project.gdalVersion"
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+
}
4348

4449
compile "org.codehaus.jackson:jackson-core-asl:$project.jacksonVersion"
4550

0 commit comments

Comments
 (0)