-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathcode-coverage.gradle
50 lines (43 loc) · 1.36 KB
/
code-coverage.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* 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://ci.opensearch.org/ci/dbc/snapshots/lucene/"
}
}
allprojects {
plugins.withId('jacoco') {
jacoco.toolVersion = '0.8.12'
}
}
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)
}
}