1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- apply plugin: 'com.android.library'
- apply from: '../prepare-robolectric.gradle'
- apply plugin: 'jacoco'
-
- android {
- compileSdkVersion 25
- buildToolsVersion "25.0.2"
-
- defaultConfig {
- minSdkVersion 16
- targetSdkVersion 25
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- }
- debug {
- minifyEnabled false
- }
- }
- lintOptions {
- abortOnError false
- }
-
- testOptions {
- unitTests.all { t ->
- reports {
- html.enabled true
- }
- testLogging {
- events "passed", "skipped", "failed", "standardOut", "standardError"
- }
- afterSuite { desc, result ->
- if (!desc.parent) { // will match the outermost suite
- def output = " ${result.resultType} (${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped) "
- def repeatLength = output.length()
- println '\n\n' + ('-' * repeatLength) + '\n' + output + '\n' + ('-' * repeatLength) + '\n'
-
- println "see report at file://${t.reports.html.destination}/index.html"
- }
- }
- jacoco {
- includeNoLocationClasses = true
- }
- }
- }
- }
-
- task unitTest(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
- reports {
- xml.enabled = false
- html.enabled = true
- }
-
- def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
- def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
- def mainSrc = "${project.projectDir}/src/main/java"
-
- sourceDirectories = files([mainSrc])
- classDirectories = files([debugTree])
- executionData = files("${buildDir}/jacoco/testDebugUnitTest.exec")
-
- doLast {
- println "See code coverage at file://${jacoco.reportsDir}/unitTest/html/index.html"
- }
- }
-
- dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- compile 'com.android.support:design:25.1.1'
- compile 'com.android.support:appcompat-v7:25.1.1'
- compile "com.android.support:support-v4:25.1.1"
-
- // node_modules
- compile 'com.facebook.react:react-native:+'
-
- // third party
- compile 'com.aurelhubert:ahbottomnavigation:1.3.3'
- compile 'com.balysv.materialmenu:material-menu-toolbar:1.5.4'
-
- // tests
- testCompile 'junit:junit:4.12'
- testCompile 'org.robolectric:robolectric:3.3'
- testCompile 'org.assertj:assertj-core:2.5.0'
- testCompile 'org.mockito:mockito-core:2.7.5'
- }
|