Bug 1231667 - Set Android SDK directory in topsrcdir Gradle configuration. r=me f=mcomella
authorNick Alexander <nalexander@mozilla.com>
Thu, 10 Dec 2015 10:51:42 -0500
changeset 276063 9bf656e590828c353452477c1553a98b0385eb53
parent 276062 bfa8b0451cfcc7d2825c9147e78c48657c9cd1c0
child 276064 6141657e33996c6cf316596420a599e3d5945325
push id16605
push usernalexander@mozilla.com
push dateThu, 10 Dec 2015 18:51:30 +0000
treeherderfx-team@6141657e3399 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1231667
milestone45.0a1
Bug 1231667 - Set Android SDK directory in topsrcdir Gradle configuration. r=me f=mcomella
.hgignore
settings.gradle
--- a/.hgignore
+++ b/.hgignore
@@ -54,16 +54,19 @@
 
 # Ignore the files and directory that JetBrains IDEs create.
 \.idea/
 \.iml$
 
 # Gradle cache.
 ^.gradle/
 
+# Local Gradle configuration properties.
+^local.properties$
+
 # Python stuff installed at build time.
 ^python/psutil/.*\.so
 ^python/psutil/.*\.pyd
 ^python/psutil/build/
 
 # Git repositories
 .git/
 
--- a/settings.gradle
+++ b/settings.gradle
@@ -13,19 +13,26 @@ if (proc.exitValue() != 0) {
     throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\n${standardOutput.toString()}")
 }
 
 import groovy.json.JsonSlurper
 def slurper = new JsonSlurper()
 def json = slurper.parseText(standardOutput.toString())
 
 if (json.substs.MOZ_BUILD_APP != 'mobile/android') {
-    throw new GradleException("Building with Gradle is only supported for Fennec, i.e., MOZ_BUILD_APP == 'mobile/android'.");
+    throw new GradleException("Building with Gradle is only supported for Fennec, i.e., MOZ_BUILD_APP == 'mobile/android'.")
 }
 
+// Set the Android SDK location.  This is the *least specific* mechanism, which
+// is unfortunate: we'd prefer to use the *most specific* mechanism.  That is,
+// local.properties (first 'sdk.dir', then 'android.dir') and then the
+// environment variable ANDROID_HOME will override this.  That's unfortunate,
+// but it's hard to automatically arrange better.
+System.setProperty('android.home', json.substs.ANDROID_SDK_ROOT)
+
 include ':app'
 include ':base'
 include ':omnijar'
 include ':thirdparty'
 
 project(':app').projectDir = new File("${json.topsrcdir}/mobile/android/app")
 project(':base').projectDir = new File("${json.topsrcdir}/mobile/android/app/base")
 project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar")