diff --git a/.travis.yml b/.travis.yml index 1f8416d..cff659e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ android: - tools before_script: echo y | ${ANDROID_HOME}tools/bin/sdkmanager --channel=3 "tools" "platform-tools" "platforms;android-27" -script: ./gradlew build jacocoTestReport :easypermissions:test +script: ./gradlew build jacocoTestReportRelease :easypermissions:test after_failure: - cat app/build/reports/tests/testDebugUnitTest/index.html diff --git a/build.gradle b/build.gradle index eebb937..93ae46b 100644 --- a/build.gradle +++ b/build.gradle @@ -2,12 +2,13 @@ buildscript { repositories { jcenter() google() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3' + classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.13.0' } } diff --git a/easypermissions/build.gradle b/easypermissions/build.gradle index 9787205..948d5c5 100644 --- a/easypermissions/build.gradle +++ b/easypermissions/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'com.android.library' -apply plugin: 'jacoco-android' +apply plugin: "com.vanniktech.android.junit.jacoco" android { compileSdkVersion compileSdk @@ -28,6 +28,10 @@ android { } } +junitJacoco { + includeNoLocationClasses = true +} + dependencies { api "com.android.support:appcompat-v7:$support_library_version" api "com.android.support:support-compat:$support_library_version" @@ -35,14 +39,9 @@ dependencies { testImplementation 'junit:junit:4.12' testImplementation 'com.google.truth:truth:0.42' - testImplementation 'org.robolectric:robolectric:3.8' - testImplementation 'org.robolectric:shadows-supportv4:3.8' - testImplementation 'org.mockito:mockito-core:2.18.0' -} - -// Needed in order to process Robolectric tests when running JaCoCo -tasks.withType(Test) { - jacoco.includeNoLocationClasses = true + testImplementation 'org.robolectric:robolectric:4.1' + testImplementation 'org.robolectric:shadows-supportv4:4.1' + testImplementation 'org.mockito:mockito-core:2.23.4' } apply from: 'bintray.gradle' diff --git a/gradle.properties b/gradle.properties index e5d30e0..9f67ddb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,7 @@ org.gradle.jvmargs=-Xmx1536m # org.gradle.parallel=true # Configure on demand -org.gradle.configureondemand=true \ No newline at end of file +org.gradle.configureondemand=true + +# Required by Robolectric 4.x +android.enableUnitTestBinaryResources=true