Home | History | Annotate | Download | only in library
      1 /**
      2  * This self.gradle build file is only run when built in ub-setupwizard-* branches.
      3  */
      4 apply from: 'standalone-rules.gradle'
      5 apply from: '../tools/gradle/dist-library-instrumentation-tests.gradle'
      6 apply from: '../tools/gradle/dist-unit-tests.gradle'
      7 
      8 apply plugin: 'net.ltgt.errorprone'
      9 
     10 buildscript {
     11     repositories {
     12         maven { url "$rootDir/prebuilts/tools/common/m2/repository" }
     13     }
     14 
     15     dependencies {
     16         classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13"
     17     }
     18 }
     19 
     20 // Add targets for tests
     21 android.sourceSets {
     22     androidTest {
     23         manifest.srcFile 'test/instrumentation/AndroidManifest.xml'
     24         java.srcDirs = ['test/instrumentation/src']
     25         res.srcDirs = ['test/instrumentation/res']
     26 
     27         dependencies {
     28             androidTestImplementation 'com.android.support.test:rules:1.0.1'
     29             androidTestImplementation 'com.android.support.test:runner:1.0.1'
     30             androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
     31             androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
     32             androidTestImplementation 'com.google.truth:truth:0.31'
     33             androidTestImplementation 'junit:junit:4.+'
     34             androidTestImplementation 'org.mockito:mockito-core:1.9.5'
     35         }
     36     }
     37 
     38     androidTestPlatformDeprecated {
     39         java.srcDirs = ['platform/test/src']
     40     }
     41 
     42     androidTestGingerbreadCompat {
     43         java.srcDirs = [
     44             'gingerbread/test/instrumentation/src',
     45             'recyclerview/test/instrumentation/src'
     46         ]
     47         res.srcDirs = ['recyclerview/test/instrumentation/res']
     48     }
     49 
     50     test {
     51         java.srcDirs = ['test/robotest/src']
     52 
     53         dependencies {
     54             testImplementation 'org.robolectric:robolectric:4.0-alpha-3'
     55             testImplementation 'org.robolectric:shadows-framework:4.0-alpha-3'
     56             testImplementation 'junit:junit:4.+'
     57             testImplementation 'com.google.truth:truth:0.31'
     58             testImplementation 'org.mockito:mockito-core:1.9.5'
     59             // Workaround for https://github.com/robolectric/robolectric/issues/2566
     60             testImplementation 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
     61         }
     62     }
     63 
     64     testGingerbreadCompat {
     65         java.srcDirs = ['gingerbread/test/robotest/src', 'recyclerview/test/robotest/src']
     66     }
     67 }
     68 
     69 android.testOptions.unitTests.includeAndroidResources = true
     70 
     71 android.defaultConfig.testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     72 android.lintOptions {
     73     abortOnError true
     74     htmlReport true
     75     textOutput 'stderr'
     76     textReport true
     77     warningsAsErrors true
     78     xmlReport false
     79 }
     80 // Run lint for all variants
     81 android.libraryVariants.all { variant ->
     82     variant.assemble.dependsOn(tasks.findByName('lint'))
     83 }
     84