summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorJeffrey Pfau <jeffrey@endrift.com>2015-06-12 19:59:25 -0700
committerJeffrey Pfau <jeffrey@endrift.com>2015-06-12 19:59:25 -0700
commitfff657a7dac67dfe7e1ba98132bf9fa11a310634 (patch)
tree646f306ca0c9249604a3c376cf42320537233d18 /Source/Android
parent4042945ee57dcaede8488e6546b8a987ca597998 (diff)
Android: Allow NDK location to be overridden
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/app/build.gradle40
1 files changed, 24 insertions, 16 deletions
diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle
index 8f7134c290..c7d41a9082 100644
--- a/Source/Android/app/build.gradle
+++ b/Source/Android/app/build.gradle
@@ -161,25 +161,33 @@ String getGitPath() {
}
String getNdkPath() {
- try {
- def stdout = new ByteArrayOutputStream()
+ def propsFile = rootProject.file("build.properties")
+ def ndkPath = null
+ if (propsFile.canRead()) {
+ def buildProperties = new Properties()
+ buildProperties.load(new FileInputStream(propsFile))
+ ndkPath = buildProperties.ndkPath
+ }
+ if (ndkPath == null) {
+ try {
+ def stdout = new ByteArrayOutputStream()
+
+ exec {
+ // ndk-build.cmd is a file unique to the root directory of android-ndk-r10e.
+ commandLine 'locate', 'ndk-build.cmd'
+ standardOutput = stdout
+ }
- exec {
- // ndk-build.cmd is a file unique to the root directory of android-ndk-r10e.
- commandLine 'locate', 'ndk-build.cmd'
- standardOutput = stdout
+ def ndkCmdPath = stdout.toString()
+ ndkPath = ndkCmdPath.substring(0, ndkCmdPath.lastIndexOf('/'))
+ } catch (ignored) {
+ project.logger.error("Gradle error: Couldn't find NDK.")
}
-
- def ndkCmdPath = stdout.toString()
- def ndkPath = ndkCmdPath.substring(0, ndkCmdPath.lastIndexOf('/'))
-
- project.logger.quiet("Gradle: Found Android NDK:" + ndkPath)
-
- return ndkPath
- } catch (ignored) {
- project.logger.error("Gradle error: Couldn't find NDK.")
- return null;
}
+ if (ndkPath != null) {
+ project.logger.quiet("Gradle: Found Android NDK: " + ndkPath)
+ }
+ return ndkPath
}
String getAbi() {