1*cf4566a7STreehugger Robotapply plugin: 'java' 2*cf4566a7STreehugger Robot 3*cf4566a7STreehugger Robotconfigurations { 4*cf4566a7STreehugger Robot // similar to 'default', export compile-time dependencies 5*cf4566a7STreehugger Robot host.extendsFrom(hostCompile) 6*cf4566a7STreehugger Robot target.extendsFrom(targetCompile) 7*cf4566a7STreehugger Robot} 8*cf4566a7STreehugger Robot 9*cf4566a7STreehugger RobotsourceSets { 10*cf4566a7STreehugger Robot host { 11*cf4566a7STreehugger Robot java { 12*cf4566a7STreehugger Robot srcDirs = ['src/main/java'] 13*cf4566a7STreehugger Robot } 14*cf4566a7STreehugger Robot } 15*cf4566a7STreehugger Robot 16*cf4566a7STreehugger Robot target { 17*cf4566a7STreehugger Robot java { 18*cf4566a7STreehugger Robot srcDirs = ['src/main/java'] 19*cf4566a7STreehugger Robot include 'org/**', 20*cf4566a7STreehugger Robot 'junit/extensions/**', 21*cf4566a7STreehugger Robot // remove these packages since they are in android.test.runner 22*cf4566a7STreehugger Robot // and proguard complains if they are present 23*cf4566a7STreehugger Robot // 'junit/runner/**', 24*cf4566a7STreehugger Robot // 'junit/textui/**', 25*cf4566a7STreehugger Robot 'junit/framework/ComparisonCompactor.java', 26*cf4566a7STreehugger Robot 'junit/framework/JUnit4TestAdapterCache.java', 27*cf4566a7STreehugger Robot 'junit/framework/JUnit4TestAdapter.java', 28*cf4566a7STreehugger Robot 'junit/framework/JUnit4TestCaseFacade.java' 29*cf4566a7STreehugger Robot } 30*cf4566a7STreehugger Robot } 31*cf4566a7STreehugger Robot} 32*cf4566a7STreehugger Robot 33*cf4566a7STreehugger Robottask targetJar(type: Jar) { 34*cf4566a7STreehugger Robot from sourceSets.target.output 35*cf4566a7STreehugger Robot dependsOn targetClasses 36*cf4566a7STreehugger Robot baseName "junit4" 37*cf4566a7STreehugger Robot classifier "target" 38*cf4566a7STreehugger Robot} 39*cf4566a7STreehugger Robot 40*cf4566a7STreehugger Robottask hostJar(type: Jar) { 41*cf4566a7STreehugger Robot from sourceSets.host.output 42*cf4566a7STreehugger Robot dependsOn hostClasses 43*cf4566a7STreehugger Robot baseName "junit4" 44*cf4566a7STreehugger Robot classifier "host" 45*cf4566a7STreehugger Robot} 46*cf4566a7STreehugger Robot 47*cf4566a7STreehugger Robotartifacts { 48*cf4566a7STreehugger Robot host hostJar 49*cf4566a7STreehugger Robot target targetJar 50*cf4566a7STreehugger Robot} 51*cf4566a7STreehugger Robot 52*cf4566a7STreehugger Robotif (project.hasProperty("usePrebuilts") && project.usePrebuilts == "true") { 53*cf4566a7STreehugger Robot repositories { 54*cf4566a7STreehugger Robot maven { url '../../prebuilts/tools/common/m2/repository' } 55*cf4566a7STreehugger Robot } 56*cf4566a7STreehugger Robot 57*cf4566a7STreehugger Robot dependencies { 58*cf4566a7STreehugger Robot targetCompile getAndroidPrebuilt('4') 59*cf4566a7STreehugger Robot targetCompile 'org.hamcrest:hamcrest-core:1.1' 60*cf4566a7STreehugger Robot 61*cf4566a7STreehugger Robot hostCompile 'org.hamcrest:hamcrest-core:1.1' 62*cf4566a7STreehugger Robot } 63*cf4566a7STreehugger Robot} else { 64*cf4566a7STreehugger Robot dependencies { 65*cf4566a7STreehugger Robot targetCompile getAndroidPrebuilt('4') 66*cf4566a7STreehugger Robot targetCompile project(':hamcrest') 67*cf4566a7STreehugger Robot 68*cf4566a7STreehugger Robot hostCompile project(':hamcrest') 69*cf4566a7STreehugger Robot } 70*cf4566a7STreehugger Robot} 71