Bug 1415298 - Fix finding assets/ in |mach android test| locally. r=maliu
☠☠ backed out by a2bf3b8c08ea ☠ ☠
authorNick Alexander <nalexander@mozilla.com>
Tue, 07 Nov 2017 12:43:40 -0800
changeset 444070 e046373e0dca3c6a3834812b2f04b2da35f508cf
parent 444069 160586d66bcb37a6bd5822b747030ee0a8449248
child 444071 db4daa1627fff3d54176ee8835ad3bb3d84aaf5d
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"])
+}