Home | History | Annotate | Download | only in junit
      1 apply plugin: 'java'
      2 
      3 configurations {
      4     // similar to 'default', export compile-time dependencies
      5     host.extendsFrom(hostCompile)
      6     target.extendsFrom(targetCompile)
      7 }
      8 
      9 sourceSets {
     10     host {
     11         java {
     12             srcDirs = ['src/main/java']
     13         }
     14     }
     15 
     16     target {
     17         java {
     18             srcDirs = ['src/main/java']
     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     }
     70 }
     71