Skip to content

Commit 5b5d437

Browse files
authored
Fix aggregate JaCoCo task and add codecov integration to Azure (#907)
* Fix jacocoRootReport * Add codecov integration to Azure * Remove codecov from Travis and Appveyor
1 parent 8cc8f04 commit 5b5d437

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ install:
3636
script:
3737
# Only run code generation tests on OSX -- linux requires sudo to install OpenCV dependencies, and that environment
3838
# will not be able to run MainWindowTest.testDragOperationFromPaletteToPipeline
39-
- ./gradlew check jacocoTestReport jacocoRootReport --stacktrace -Pheadless=true -PlogTests;
39+
- ./gradlew check --stacktrace -Pheadless=true -PlogTests;
4040

4141
after_success:
42-
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then codecov ; fi
4342
- .travis-scripts/push-javadoc-to-gh-pages.sh
4443
- .travis-scripts/before-deploy.sh
4544

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build_script:
66

77
# to run your custom scripts instead of automatic tests
88
test_script:
9-
- gradlew.bat check jacocoTestReport jacocoRootReport --stacktrace -Pheadless=true -PlogTests -Dscan
9+
- gradlew.bat check --stacktrace -Pheadless=true -PlogTests -Dscan
1010

1111
platform:
1212
- x64

azure-pipelines.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@ jobs:
3131
publishJUnitResults: false
3232
tasks: 'check jacocoTestReport jacocoRootReport jfxNative -Pgeneration -PjniLocation=build/OpenCVJNI -Pheadless=true -PlogTests --stacktrace'
3333

34-
# Publish JaCoCo code coverage results from the build
35-
- task: PublishCodeCoverageResults@1
36-
inputs:
37-
codeCoverageTool: 'JaCoCo'
38-
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/reports/jacoco/test/jacocoTestReport.xml'
39-
reportDirectory: '$(System.DefaultWorkingDirectory)/**/reports/jacoco/test/jacocoTestReport.html'
40-
additionalCodeCoverageFiles: '$(System.DefaultWorkingDirectory)/**/build/jacoco/text.exec'
41-
failIfCoverageEmpty: false
34+
- script: |
35+
curl -s https://codecov.io/bash > .codecov
36+
chmod +x .codecov
37+
./.codecov -t $(CODECOV_TOKEN)
38+
displayName: 'Upload jacoco reports to codecov'
4239
4340
- task: CopyFiles@2
4441
inputs:

build.gradle.kts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,20 @@ tasks.register<JacocoReport>("jacocoRootReport") {
159159
group = "Coverage reports"
160160
description = "Generates an aggregate report from all subprojects"
161161

162-
reports {
163-
html.isEnabled = true
164-
xml.isEnabled = true
165-
}
162+
// Based on the codecov Gradle example: https://github.com/codecov/example-gradle
166163

167164
javaSubprojects {
168-
val sourceSets = (this as ExtensionAware).extensions.getByName("sourceSets") as SourceSetContainer
169-
dependsOn(tasks["test"])
170-
val srcFiles = files(sourceSets["main"].allSource.srcDirs)
171-
additionalSourceDirs(srcFiles)
172-
sourceDirectories.from(srcFiles)
173-
classDirectories.from(files(sourceSets["main"].output))
174-
executionData.from(tasks.named<JacocoReport>("jacocoTestReport").map { it.executionData })
175-
}
176-
doFirst {
177-
executionData.setFrom(files(executionData.files.filter { it.exists() }))
165+
this@register.sourceSets(sourceSets["main"])
166+
this@register.dependsOn(tasks.named<JacocoReport>("jacocoTestReport"))
167+
}
168+
169+
executionData(fileTree(rootDir.absolutePath).include("**/build/jacoco/*.exec"))
170+
171+
reports {
172+
xml.isEnabled = true
173+
xml.destination = buildDir.resolve("reports/jacoco/report.xml")
174+
html.isEnabled = false
175+
csv.isEnabled = false
178176
}
179177
}
180178

0 commit comments

Comments
 (0)