1 /** 2 * This self.gradle build file is only run when built in ub-setupwizard-* branches. 3 */ 4 apply plugin: 'dist' 5 apply from: 'standalone-rules.gradle' 6 // Add targets for tests 7 android.sourceSets { 8 androidTest { 9 manifest.srcFile 'test/instrumentation/AndroidManifest.xml' 10 java.srcDirs = ['test/instrumentation/src'] 11 res.srcDirs = ['test/instrumentation/res'] 12 13 dependencies { 14 androidTestCompile 'com.android.support.test:rules:0.5' 15 androidTestCompile 'com.android.support.test:runner:0.5' 16 androidTestCompile 'com.google.dexmaker:dexmaker:1.2' 17 androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' 18 androidTestCompile 'junit:junit:4.+' 19 androidTestCompile 'org.mockito:mockito-core:1.9.5' 20 } 21 } 22 23 androidTestPlatform { 24 java.srcDirs = ['platform/test/src'] 25 } 26 27 androidTestGingerbreadCompat { 28 java.srcDirs = ['full-support/test/instrumentation/src', 'eclair-mr1/test/instrumentation/src'] 29 res.srcDirs = ['full-support/test/instrumentation/res'] 30 } 31 32 test { 33 java.srcDirs = ['test/robotest/src'] 34 35 dependencies { 36 testCompile 'org.robolectric:robolectric:3.+' 37 testCompile 'org.robolectric:shadows-core:3.+' 38 testCompile 'junit:junit:4.+' 39 testCompile 'org.mockito:mockito-core:1.9.5' 40 // Workaround for https://github.com/robolectric/robolectric/issues/2566 41 testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1' 42 } 43 } 44 45 testGingerbreadCompat { 46 java.srcDirs = ['eclair-mr1/test/robotest/src', 'full-support/test/robotest/src'] 47 } 48 } 49 android.defaultConfig.testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 50 android.lintOptions { 51 abortOnError true 52 htmlReport true 53 textOutput 'stderr' 54 textReport true 55 warningsAsErrors true 56 xmlReport false 57 } 58 // Run lint for all variants 59 android.libraryVariants.all { variant -> 60 variant.assemble.dependsOn(tasks.findByName('lint')) 61 } 62 // Output all test APKs to the distribution folder 63 def distTask = tasks.findByName('dist') 64 if (distTask) { 65 android.testVariants.all { variant -> 66 // Make the dist task depend on the test variant, so the test APK will be built 67 distTask.dependsOn variant.assemble 68 // TODO: remap the different test variants to different file names 69 } 70 } 71