Nick Korostelev | 922c401 | 2014-08-26 18:58:05 -0700 | [diff] [blame] | 1 | apply plugin: 'java' |
Justin Morey | c5c1c31 | 2014-03-05 13:06:08 -0600 | [diff] [blame] | 2 | |
Nick Korostelev | 922c401 | 2014-08-26 18:58:05 -0700 | [diff] [blame] | 3 | configurations { |
| 4 | // similar to 'default', export compile-time dependencies |
| 5 | host.extendsFrom(hostCompile) |
| 6 | target.extendsFrom(targetCompile) |
| 7 | } |
Justin Morey | 98bbbe8 | 2014-06-11 11:33:37 -0500 | [diff] [blame] | 8 | |
Nick Korostelev | 922c401 | 2014-08-26 18:58:05 -0700 | [diff] [blame] | 9 | sourceSets { |
| 10 | host { |
| 11 | java { |
Paul Duffin | 47cd72d | 2016-12-16 13:51:17 +0000 | [diff] [blame] | 12 | srcDirs = ['src/main/java'] |
Nick Korostelev | 922c401 | 2014-08-26 18:58:05 -0700 | [diff] [blame] | 13 | } |
| 14 | } |
| 15 | |
| 16 | target { |
| 17 | java { |
Paul Duffin | 47cd72d | 2016-12-16 13:51:17 +0000 | [diff] [blame] | 18 | srcDirs = ['src/main/java'] |
Nick Korostelev | 922c401 | 2014-08-26 18:58:05 -0700 | [diff] [blame] | 19 | 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 | |
| 33 | task targetJar(type: Jar) { |
| 34 | from sourceSets.target.output |
| 35 | dependsOn targetClasses |
| 36 | baseName "junit4" |
| 37 | classifier "target" |
| 38 | } |
| 39 | |
| 40 | task hostJar(type: Jar) { |
| 41 | from sourceSets.host.output |
| 42 | dependsOn hostClasses |
| 43 | baseName "junit4" |
| 44 | classifier "host" |
| 45 | } |
| 46 | |
| 47 | artifacts { |
| 48 | host hostJar |
| 49 | target targetJar |
| 50 | } |
| 51 | |
| 52 | if (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 Morey | c5c1c31 | 2014-03-05 13:06:08 -0600 | [diff] [blame] | 70 | } |