From 19ab6006a9547178d08814bc3f8f7a87af4b1d97 Mon Sep 17 00:00:00 2001 From: Zellius Date: Sun, 9 Apr 2017 23:18:09 +0300 Subject: [PATCH] fix jacoco --- build.gradle | 53 ++++++++++++++++++++++++++-------- kotlin/build.gradle | 27 +++-------------- kotlin_sample/build.gradle | 16 ++-------- rxlocationmanager/build.gradle | 38 ------------------------ sample/build.gradle | 2 +- 5 files changed, 48 insertions(+), 88 deletions(-) diff --git a/build.gradle b/build.gradle index ed38579..2c49438 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,4 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. -apply plugin: 'com.github.kt3k.coveralls' -apply plugin: 'jacoco' buildscript { repositories { @@ -25,10 +23,48 @@ allprojects { } } subprojects { - if (!project.name.contains('sample')) { + if (!name.contains('sample')) { apply plugin: 'jacoco' + apply plugin: 'com.novoda.bintray-release' apply plugin: 'com.android.library' + android { + compileSdkVersion 25 + buildToolsVersion "25.0.2" + + defaultConfig { + minSdkVersion 9 + targetSdkVersion 25 + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + debug { + testCoverageEnabled true + } + } + testOptions { + unitTests.all { + jacoco { + includeNoLocationClasses = true + } + } + } + } + + dependencies { + compile fileTree(include: ['*.jar'], dir: 'libs') + compile 'io.reactivex:rxjava:1.2.9' + compile 'io.reactivex:rxandroid:1.2.1' + compile 'com.android.support:support-annotations:25.3.1' + + testCompile 'junit:junit:4.12' + testCompile 'org.robolectric:robolectric:3.3.2' + testCompile 'org.mockito:mockito-core:2.7.21' + } + task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") { group = "Reporting" description = "Generate Jacoco coverage reports" @@ -53,15 +89,6 @@ subprojects { } } } -project(':kotlin') { - android { - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - test.java.srcDirs += 'src/test/kotlin' - androidTest.java.srcDirs += 'src/androidTest/kotlin' - } - } -} task clean(type: Delete) { delete rootProject.buildDir @@ -71,6 +98,7 @@ def validSubprojects = subprojects.findAll { !it.name.contains('sample') } +apply plugin: 'jacoco' task jacocoRootReport(type: JacocoReport, group: 'Coverage reports', description: 'Generates an aggregate report from all subprojects') { dependsOn = validSubprojects.jacocoTestReport @@ -85,6 +113,7 @@ task jacocoRootReport(type: JacocoReport, group: 'Coverage reports', description } } +apply plugin: 'com.github.kt3k.coveralls' coveralls { jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml" sourceDirs = validSubprojects.android.sourceSets.main.java.srcDirs.flatten() diff --git a/kotlin/build.gradle b/kotlin/build.gradle index d3c3b4f..aa6adc1 100644 --- a/kotlin/build.gradle +++ b/kotlin/build.gradle @@ -1,34 +1,15 @@ -apply plugin: 'com.novoda.bintray-release' -apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" - - defaultConfig { - minSdkVersion 9 - targetSdkVersion 25 - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - debug { - testCoverageEnabled true - } + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + test.java.srcDirs += 'src/test/kotlin' + androidTest.java.srcDirs += 'src/androidTest/kotlin' } } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - testCompile 'junit:junit:4.12' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile 'io.reactivex:rxjava:1.2.9' - compile 'io.reactivex:rxandroid:1.2.1' - testCompile 'org.robolectric:robolectric:3.3.2' - testCompile 'org.mockito:mockito-core:2.7.21' } publish { diff --git a/kotlin_sample/build.gradle b/kotlin_sample/build.gradle index b70c764..c9fd729 100644 --- a/kotlin_sample/build.gradle +++ b/kotlin_sample/build.gradle @@ -28,17 +28,5 @@ dependencies { testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:25.3.1' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile 'com.github.zellius:rxlocationmanager.kotlin:0.1.0' -} -buildscript { - ext.kotlin_version = '1.0.0' - repositories { - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} -repositories { - mavenCentral() -} + compile project(':kotlin') +} \ No newline at end of file diff --git a/rxlocationmanager/build.gradle b/rxlocationmanager/build.gradle index 4b214fe..1a79874 100644 --- a/rxlocationmanager/build.gradle +++ b/rxlocationmanager/build.gradle @@ -1,41 +1,3 @@ -apply plugin: 'com.android.library' -apply plugin: 'com.novoda.bintray-release' - -android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" - - defaultConfig { - minSdkVersion 9 - targetSdkVersion 25 - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - debug { - testCoverageEnabled true - } - } -} - -buildscript { - repositories { - mavenCentral() - } -} - -dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - testCompile 'junit:junit:4.12' - compile 'io.reactivex:rxjava:1.2.9' - compile 'io.reactivex:rxandroid:1.2.1' - compile 'com.android.support:support-annotations:25.3.1' - testCompile 'org.robolectric:robolectric:3.3.2' - testCompile 'org.mockito:mockito-core:2.7.21' -} - publish { groupId = 'com.github.zellius' artifactId = 'rxlocationmanager' diff --git a/sample/build.gradle b/sample/build.gradle index 7b65896..62971a9 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -23,5 +23,5 @@ dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:25.3.1' - compile 'com.github.zellius:rxlocationmanager:0.1.1' + compile project(':rxlocationmanager') }