blob: af619ac7af498f7ca71390a58554616c147fd665 [file] [log] [blame]
Nick Korostelev922c4012014-08-26 18:58:05 -07001apply plugin: 'java'
Justin Moreyc5c1c312014-03-05 13:06:08 -06002
Nick Korostelev922c4012014-08-26 18:58:05 -07003configurations {
4 // similar to 'default', export compile-time dependencies
5 host.extendsFrom(hostCompile)
6 target.extendsFrom(targetCompile)
7}
Justin Morey98bbbe82014-06-11 11:33:37 -05008
Nick Korostelev922c4012014-08-26 18:58:05 -07009sourceSets {
10 host {
11 java {
Paul Duffin47cd72d2016-12-16 13:51:17 +000012 srcDirs = ['src/main/java']
Nick Korostelev922c4012014-08-26 18:58:05 -070013 }
14 }
15
16 target {
17 java {
Paul Duffin47cd72d2016-12-16 13:51:17 +000018 srcDirs = ['src/main/java']
Nick Korostelev922c4012014-08-26 18:58:05 -070019 include 'org/**',
20 'junit/extensions/**',
21 // remove these packages since they are in android.test.runner
22 // and proguard complains if they are present
23 // 'junit/runner/**',
24 // 'junit/textui/**',
25 'junit/framework/ComparisonCompactor.java',
26 'junit/framework/JUnit4TestAdapterCache.java',
27 'junit/framework/JUnit4TestAdapter.java',
28 'junit/framework/JUnit4TestCaseFacade.java'
29 }
30 }
31}
32
33task targetJar(type: Jar) {
34 from sourceSets.target.output
35 dependsOn targetClasses
36 baseName "junit4"
37 classifier "target"
38}
39
40task hostJar(type: Jar) {
41 from sourceSets.host.output
42 dependsOn hostClasses
43 baseName "junit4"
44 classifier "host"
45}
46
47artifacts {
48 host hostJar
49 target targetJar
50}
51
52if (project.hasProperty("usePrebuilts") && project.usePrebuilts == "true") {
53 repositories {
54 maven { url '../../prebuilts/tools/common/m2/repository' }
55 }
56
57 dependencies {
58 targetCompile getAndroidPrebuilt('4')
59 targetCompile 'org.hamcrest:hamcrest-core:1.1'
60
61 hostCompile 'org.hamcrest:hamcrest-core:1.1'
62 }
63} else {
64 dependencies {
65 targetCompile getAndroidPrebuilt('4')
66 targetCompile project(':hamcrest')
67
68 hostCompile project(':hamcrest')
69 }
Justin Moreyc5c1c312014-03-05 13:06:08 -060070}