1/** 2 * This self.gradle build file is only run when built in ub-setupwizard-* branches. 3 */ 4apply from: 'standalone-rules.gradle' 5apply from: '../tools/gradle/dist-library-instrumentation-tests.gradle' 6apply from: '../tools/gradle/dist-unit-tests.gradle' 7 8// Add targets for tests 9android.sourceSets { 10 androidTest { 11 manifest.srcFile 'test/instrumentation/AndroidManifest.xml' 12 java.srcDirs = ['test/instrumentation/src'] 13 res.srcDirs = ['test/instrumentation/res'] 14 15 dependencies { 16 androidTestCompile 'com.android.support.test:rules:0.5' 17 androidTestCompile 'com.android.support.test:runner:0.5' 18 androidTestCompile 'com.google.dexmaker:dexmaker:1.2' 19 androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' 20 androidTestCompile 'junit:junit:4.+' 21 androidTestCompile 'org.mockito:mockito-core:1.9.5' 22 } 23 } 24 25 androidTestPlatform { 26 java.srcDirs = ['platform/test/src'] 27 } 28 29 androidTestGingerbreadCompat { 30 java.srcDirs = [ 31 'gingerbread/test/instrumentation/src', 32 'recyclerview/test/instrumentation/src' 33 ] 34 res.srcDirs = ['recyclerview/test/instrumentation/res'] 35 } 36 37 test { 38 java.srcDirs = ['test/robotest/src'] 39 40 dependencies { 41 testCompile 'org.robolectric:robolectric:3.+' 42 testCompile 'org.robolectric:shadows-core:3.+' 43 testCompile 'junit:junit:4.+' 44 testCompile 'org.mockito:mockito-core:1.9.5' 45 // Workaround for https://github.com/robolectric/robolectric/issues/2566 46 testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1' 47 } 48 } 49 50 testGingerbreadCompat { 51 java.srcDirs = ['gingerbread/test/robotest/src', 'recyclerview/test/robotest/src'] 52 } 53} 54android.defaultConfig.testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 55android.lintOptions { 56 abortOnError true 57 htmlReport true 58 textOutput 'stderr' 59 textReport true 60 warningsAsErrors true 61 xmlReport false 62} 63// Run lint for all variants 64android.libraryVariants.all { variant -> 65 variant.assemble.dependsOn(tasks.findByName('lint')) 66} 67 68// For compatibility with existing continuous test configurations, copy the file to 69// setup-wizard-libTest.apk 70// TODO: Remove this once continuous test configurations are updated to handle the new file name 71task createLegacyTestApk(type: Copy) { 72 from "${project.ext.distDir}/setup-wizard-lib-gingerbreadCompat-debug-androidTest.apk" 73 into "${project.ext.distDir}" 74 rename ('setup-wizard-lib-gingerbreadCompat-debug-androidTest.apk', 'setup-wizard-libTest.apk') 75} 76 77tasks.dist.finalizedBy createLegacyTestApk 78