51 lines
1.4 KiB
Groovy
51 lines
1.4 KiB
Groovy
/*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* The OpenSearch Contributors require contributions made to
|
|
* this file be licensed under the Apache-2.0 license or a
|
|
* compatible open source license.
|
|
*/
|
|
|
|
apply plugin: 'jacoco'
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
gradlePluginPortal()
|
|
// TODO: Find the way to use the repositories from RepositoriesSetupPlugin
|
|
maven {
|
|
url = "https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/"
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
plugins.withId('jacoco') {
|
|
jacoco.toolVersion = '0.8.8'
|
|
}
|
|
}
|
|
|
|
tasks.withType(JacocoReport).configureEach {
|
|
group = JavaBasePlugin.VERIFICATION_GROUP
|
|
|
|
reports {
|
|
// Code coverage report in HTML and CSV formats are on demand, in case they take extra disk space.
|
|
xml.required = System.getProperty('tests.coverage.report.xml', 'true').toBoolean()
|
|
html.required = System.getProperty('tests.coverage.report.html', 'false').toBoolean()
|
|
csv.required = System.getProperty('tests.coverage.report.csv', 'false').toBoolean()
|
|
}
|
|
}
|
|
|
|
if (System.getProperty("tests.coverage")) {
|
|
reporting {
|
|
reports {
|
|
testCodeCoverageReport(JacocoCoverageReport) {
|
|
testType = TestSuiteType.UNIT_TEST
|
|
}
|
|
}
|
|
}
|
|
|
|
// Attach code coverage report task to Gradle check task
|
|
project.getTasks().named(JavaBasePlugin.CHECK_TASK_NAME).configure {
|
|
dependsOn tasks.named('testCodeCoverageReport', JacocoReport)
|
|
}
|
|
}
|