Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix jacoco
Browse files Browse the repository at this point in the history
  • Loading branch information
Zellius committed Apr 9, 2017
1 parent 0ba10ef commit 19ab600
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 88 deletions.
53 changes: 41 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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()
Expand Down
27 changes: 4 additions & 23 deletions kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
16 changes: 2 additions & 14 deletions kotlin_sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
38 changes: 0 additions & 38 deletions rxlocationmanager/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

0 comments on commit 19ab600

Please sign in to comment.