summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorJeffrey Pfau <jeffrey@endrift.com>2015-06-13 03:54:37 -0700
committerJeffrey Pfau <jeffrey@endrift.com>2015-06-13 03:54:37 -0700
commit7e36166374c6bf9673d00632b94df4294f002b93 (patch)
tree2db6a416ce1c6d871571bfcd32a68ac33cbdaf3d /Source/Android
parentfff657a7dac67dfe7e1ba98132bf9fa11a310634 (diff)
Android: Allow git and cmake locations to be overridden
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/app/build.gradle43
1 files changed, 26 insertions, 17 deletions
diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle
index c7d41a9082..6c1a46a914 100644
--- a/Source/Android/app/build.gradle
+++ b/Source/Android/app/build.gradle
@@ -101,13 +101,13 @@ task setupCMake(type: Exec) {
mkdir('build/' + abi)
workingDir 'build/' + abi
- executable 'cmake'
+ executable getExecutablePath("cmake")
args "-DANDROID=true",
"-DANDROID_NATIVE_API_LEVEL=android-18",
"-DCMAKE_TOOLCHAIN_FILE=../../../android.toolchain.cmake",
"../../../../..",
- "-DGIT_EXECUTABLE=" + getGitPath(),
+ "-DGIT_EXECUTABLE=" + getExecutablePath("git"),
"-DANDROID_NDK=" + getNdkPath(),
"-DANDROID_TOOLCHAIN_NAME=" + getToolchainName(),
"-DANDROID_ABI=" + abi
@@ -140,24 +140,33 @@ task compileNative(type: Exec, dependsOn: 'setupCMake') {
}
}
-String getGitPath() {
- try {
- def stdout = new ByteArrayOutputStream()
-
- exec {
- commandLine 'which', 'git'
- standardOutput = stdout
- }
+String getExecutablePath(String command) {
+ def propsFile = rootProject.file("build.properties")
+ def path = null
+ if (propsFile.canRead()) {
+ def buildProperties = new Properties()
+ buildProperties.load(new FileInputStream(propsFile))
+ println buildProperties
+ path = buildProperties[command + "Path"]
+ }
+ if (path == null) {
+ try {
+ def stdout = new ByteArrayOutputStream()
- def gitPath = stdout.toString().trim()
- project.logger.quiet("Gradle: Found git executuable:" + gitPath)
+ exec {
+ commandLine 'which', command
+ standardOutput = stdout
+ }
- return gitPath
- } catch (ignored) {
- // Shouldn't happen. How did the user get this file without git?
- project.logger.error("Gradle error: Couldn't find git executable.")
- return null;
+ path = stdout.toString().trim()
+ } catch (ignored) {
+ project.logger.error("Gradle error: Couldn't find " + command + " executable.")
+ }
+ }
+ if (path != null) {
+ project.logger.quiet("Gradle: Found " + command + " executuable:" + path)
}
+ return path
}
String getNdkPath() {