Skip to content

Commit 096d286

Browse files
committed
Update README.md with all of the latest changes
1 parent 7e17f53 commit 096d286

File tree

1 file changed

+35
-64
lines changed

1 file changed

+35
-64
lines changed

README.md

Lines changed: 35 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,90 +6,61 @@ A plugin to enable the use of Scoverage in a gradle Scala project.
66

77
Getting started
88
---------------
9-
http://plugins.gradle.org/plugin/org.scoverage
10-
11-
This creates an additional task `testScoverage` which will run tests against instrumented code.
12-
13-
A further task `reportScoverage` produces XML and HTML reports for analysing test code coverage.
14-
15-
You can configure the version of Scoverage that will be used. This plugin should be compatible with all 1+ versions.
169

17-
```groovy
18-
scoverage {
19-
scoverageVersion = "1.3.1"
20-
scoverageScalaVersion = "2.12" // will be overridden by the 'scala-library' version (if configured)
21-
}
22-
```
23-
24-
Then launch command :
25-
`gradle reportScoverage` or `gradle checkScoverage`
10+
http://plugins.gradle.org/plugin/org.scoverage
2611

2712
Available tasks
2813
---------------
2914

30-
* testScoverage - Executes all tests and creates Scoverage XML report with information about code coverage
31-
* reportScoverage - Generates reports (see below).
32-
* aggregateScoverage - Aggregates reports from multiple sub-projects (see below).
33-
* checkScoverage - See below.
34-
* compileScoverageScala - Instruments code without running tests.
15+
1. `reportScoverage`: Produces XML and HTML reports for analysing test code coverage.
3516

36-
ReportScoverage
37-
---------------
17+
2. `aggregateScoverage`: An experimental support for aggregating coverage statistics in composite builds.
3818

39-
You can configure output generated by `gradle reportScoverage` using flags:
19+
When applied on a project with sub-projects, the plugin will create the aggregation task `aggregateScoverage`, which
20+
will first generate reports for each project individually (including the parent project), and will then generate an
21+
aggregated result based on these reports.
4022

41-
| Flag name | Default value | Description |
42-
| ------------------------|---------------|-------------------------------------------------|
43-
| coverageOutputCobertura | true | Enables/disables cobertura.xml file generation. |
44-
| coverageOutputXML | true | Enables/disables scoverage XML output. |
45-
| coverageOutputHTML | true | Enables/disables scoverage HTML output. |
46-
| coverageDebug | false | Enables/disables scoverage debug output. |
23+
The aggregated report will override the parent-project specific report (`parent-project/build/reports/scoverage`).
4724

48-
Aggregating Reports
49-
-------------------
25+
One can still use `reportScoverage` in order to generate a report without aggregation.
5026

27+
3. `checkScoverage`: Validates coverage according status according the generated reports (aggregated or not).
5128

52-
There is now experimental support for aggregating coverage statistics in composite builds.
29+
`gradle checkScoverage` will automatically invoke `reportScoverage` but it won't generate aggregated reports.
30+
In order to check coverage of aggregated reports one should use `gradle checkScoverage aggregateScoverage`.
31+
32+
Configuration
33+
---------------
5334

54-
When applied on a project with sub-projects, the plugin will create the aggregation task `aggregateScoverage`, which
55-
will first generate reports for each project individually (including the parent project), and will then generate an
56-
aggregated result based on these reports.
35+
The plugin exposes multiple options that can be configured by setting them in an `scoverage` block within the project's
36+
build script. These options are as follows:
5737

58-
The aggregated report will override the parent-project specific report (`parent-project/build/reports/scoverage`).
38+
You can configure the version of Scoverage that will be used. This plugin should
5939

60-
One can still use `reportScoverage` in order to generate a report without aggregation.
40+
* `scoverageVersion = <String>` (default `"1.3.1"`): The version of the scoverage scalac plugin. This (gradle) plugin
41+
should be compatible with all 1+ versions.
6142

62-
Aggregation uses same flags as reporting for enabling/disabling different output types.
43+
* `scoverageScalaVersion = <String>` (default `"2.12"`): The scala version of the scoverage scalac plugin. This will
44+
be overridden by the version of the `scala-library` compile dependency (if the dependency is configured).
45+
46+
* `coverageOutputCobertura = <boolean>` (default `true`): Enables/disables cobertura.xml file generation (for both aggregated and non-aggregated reports).
6347

64-
CheckScoverage
65-
--------------
48+
* `coverageOutputXML = <boolean>` (default `true`): Enables/disables scoverage XML output (for both aggregated and non-aggregated reports).
6649

67-
The `checkScoverage` task validates coverage status according the generated reports.
50+
* `coverageOutputHTML = <boolean>` (default `true`): Enables/disables scoverage HTML output (for both aggregated and non-aggregated reports).
6851

69-
`gradle checkScoverage` will automatically generate reports via `reportScoverage` but it won't generate aggregated reports.
70-
In order to check coverage of aggregated reports one should use `gradle checkScoverage aggregateScoverage`.
52+
* `coverageDebug = <boolean>` (default `false`): Enables/disables scoverage debug output (for both aggregated and non-aggregated reports).
7153

72-
By default, when you launch `gradle checkScoverage` build fail if only 75% of statements in project is covered by tests.
54+
* `minimumRate = <double>` (default `0.75`): The minimum amount of coverage in decimal proportion (`1.0` == 100%)
55+
required for the validation to pass (otherwise `checkScoverage` will fail the build).
7356

74-
To configure it as you want, add this configuration :
75-
```
76-
checkScoverage {
77-
minimumRate = 0.5
78-
}
79-
```
57+
* `coverageType = <"Statement" | "Branch" | "Line">` (default `"Statement"`): The type of coverage validated by the
58+
`checkScoverage` task. For more information on the different types, please refer to the documentation of the scalac
59+
plugin (https://github.com/scoverage/scalac-scoverage-plugin).
8060

81-
You can also modify type of value to check from `Statement`s to `Line`s or `Branch`es:
61+
* `runNormalCompilation = <boolean>` (default `true`): Determines whether both normal scalac compilation (`compileScala`)
62+
and compilation with scoverage (`compileScoverageScala`) should be executed, or if only the scoverage compilation should.
63+
It may be helpful to turn this off so that only the scoverage instrumented classes -- which are not intended for release
64+
-- will be created, thus reducing the build time.
8265

83-
```
84-
checkScoverage {
85-
coverageType = 'Line'
86-
minimumRate = 0.5
87-
}
88-
```
8966

90-
```
91-
checkScoverage {
92-
coverageType = 'Branch'
93-
minimumRate = 0.5
94-
}
95-
```

0 commit comments

Comments
 (0)