|
| 1 | +apply plugin: 'com.android.library' |
| 2 | +apply plugin: 'jacoco' |
| 3 | + |
| 4 | +task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { |
| 5 | + |
| 6 | + reports { |
| 7 | + xml.enabled = true |
| 8 | + html.enabled = true |
| 9 | + } |
| 10 | + |
| 11 | + def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*'] |
| 12 | + def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter) |
| 13 | + def mainSrc = "${project.projectDir}/src/main/java" |
| 14 | + |
| 15 | + sourceDirectories = files([mainSrc]) |
| 16 | + classDirectories = files([debugTree]) |
| 17 | + executionData = fileTree(dir: "$buildDir", includes: [ |
| 18 | + "jacoco/testDebugUnitTest.exec", |
| 19 | + "outputs/code-coverage/connected/*coverage.ec" |
| 20 | + ]) |
| 21 | +} |
| 22 | + |
| 23 | +android { |
| 24 | + compileSdkVersion 25 |
| 25 | + buildToolsVersion "25.0.3" |
| 26 | + |
| 27 | + defaultConfig { |
| 28 | + minSdkVersion 14 |
| 29 | + versionCode 41 |
| 30 | + versionName "1.7.1" |
| 31 | + } |
| 32 | + |
| 33 | + buildTypes { |
| 34 | + debug { |
| 35 | + testCoverageEnabled true |
| 36 | + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 37 | + } |
| 38 | + release { |
| 39 | + minifyEnabled true |
| 40 | + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + lintOptions { |
| 45 | + abortOnError false |
| 46 | + } |
| 47 | +} |
| 48 | + |
| 49 | +tasks.matching { it instanceof Test }.all { |
| 50 | + testLogging.events = ["failed", "passed", "skipped"] |
| 51 | +} |
| 52 | + |
| 53 | +dependencies { |
| 54 | + final SUPPORT_VERSION = '25.3.1' |
| 55 | + final JUNIT_VERSION = '4.12' |
| 56 | + final TRUTH_VERSION = '0.31' |
| 57 | + final ROBOLECTRIC_VERSION = '3.1.2' |
| 58 | + |
| 59 | + provided "com.android.support:appcompat-v7:$SUPPORT_VERSION" |
| 60 | + provided "com.android.support:support-v4:$SUPPORT_VERSION" |
| 61 | + provided "com.android.support:design:$SUPPORT_VERSION" |
| 62 | + |
| 63 | + testCompile "junit:junit:$JUNIT_VERSION" |
| 64 | + testCompile "org.robolectric:robolectric:$ROBOLECTRIC_VERSION" |
| 65 | +} |
| 66 | +//apply from: "https://raw.githubusercontent.com/xiaopansky/android-library-publish-to-jcenter/master/bintrayUpload.gradle" |
| 67 | +//gradlew bintrayUpload |
0 commit comments