Android: Allow NDK location to be overridden

This commit is contained in:
Jeffrey Pfau 2015-06-12 19:59:25 -07:00
parent 4042945ee5
commit fff657a7da
1 changed files with 26 additions and 18 deletions

View File

@ -161,6 +161,14 @@ String getGitPath() {
}
String getNdkPath() {
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()
@ -171,15 +179,15 @@ String getNdkPath() {
}
def ndkCmdPath = stdout.toString()
def ndkPath = ndkCmdPath.substring(0, ndkCmdPath.lastIndexOf('/'))
project.logger.quiet("Gradle: Found Android NDK:" + ndkPath)
return ndkPath
ndkPath = ndkCmdPath.substring(0, ndkCmdPath.lastIndexOf('/'))
} 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() {