Bug 1415298 - Fix finding assets/ in |mach android test| locally. r=maliu
authorNick Alexander <nalexander@mozilla.com>
Tue, 07 Nov 2017 12:43:40 -0800
changeset 444133 4ec1597896173759f87217aa88ff1ac82fd84a78
parent 444132 833349e8b2752c5cc319d0032a2fcc3ff0ef39ea
child 444134 dfd49bfe648886bfbf0ae0deb1891a0dc8da0ded
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaliu
bugs1415298
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415298 - Fix finding assets/ in |mach android test| locally. r=maliu Upgrading to the Android-Gradle plugin 3.0+ broke |mach android test| locally. This addresses the issue. MozReview-Commit-ID: 3vV47ET7d19
mobile/android/app/build.gradle
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -562,8 +562,19 @@ android.applicationVariants.all { varian
             filename.replace 'R.txt', "R-${new Date().format('yyyyMMddHHmmssSSS')}.txt"
         }
 
         dependsOn processResourcesTask
     }
 
     assembleTask.dependsOn dumpTask
 }
+
+// Bug 1415298: make Robolectric find assets.  Fix adapted from
+// https://github.com/robolectric/robolectric/issues/2647.
+android.applicationVariants.all { variant ->
+    def productFlavor = ""
+    variant.productFlavors.each {
+        productFlavor += "${it.name.capitalize()}"
+    }
+    def buildType = "${variant.buildType.name.capitalize()}"
+    tasks["compile${productFlavor}${buildType}UnitTestSources"].dependsOn(tasks["merge${productFlavor}${buildType}Assets"])
+}