self.gradle 2.7 KB

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