|
@@ -0,0 +1,34 @@
|
|
1
|
+def robolectricDependenciesFolder = rootProject.buildDir.path + "/robolectric-dependencies"
|
|
2
|
+
|
|
3
|
+configurations.create('robolectricRuntime')
|
|
4
|
+
|
|
5
|
+dependencies {
|
|
6
|
+ robolectricRuntime "org.ccil.cowan.tagsoup:tagsoup:1.2"
|
|
7
|
+ robolectricRuntime "org.robolectric:android-all:6.0.0_r1-robolectric-0"
|
|
8
|
+ robolectricRuntime "org.robolectric:shadows-core-v23:3.1.4"
|
|
9
|
+ robolectricRuntime "org.json:json:20080701"
|
|
10
|
+}
|
|
11
|
+
|
|
12
|
+rootProject.task(type: Copy, overwrite: true, "downloadRobolectricDependencies") {
|
|
13
|
+ println "downloadRobolectricDependencies " + robolectricDependenciesFolder
|
|
14
|
+ from configurations.robolectricRuntime
|
|
15
|
+ into robolectricDependenciesFolder
|
|
16
|
+}
|
|
17
|
+
|
|
18
|
+project.afterEvaluate {
|
|
19
|
+ tasks.all {
|
|
20
|
+ if (it.name.startsWith("test")) {
|
|
21
|
+ it.dependsOn(rootProject.tasks.findByName("downloadRobolectricDependencies"))
|
|
22
|
+ }
|
|
23
|
+ }
|
|
24
|
+}
|
|
25
|
+
|
|
26
|
+android {
|
|
27
|
+ testOptions {
|
|
28
|
+ unitTests.all {
|
|
29
|
+ systemProperty 'robolectric.offline', 'true'
|
|
30
|
+ systemProperty 'robolectric.dependency.dir', robolectricDependenciesFolder
|
|
31
|
+ }
|
|
32
|
+ }
|
|
33
|
+}
|
|
34
|
+
|