You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To apply the plugin to all modules in the project, you need to apply the plugin only to the root module, as shown [above](#apply-plugin-to-single-module-project).
99
-
100
-
**There are no dependencies between tasks from different modules, they are executed independently.**
101
-
102
-
**Cross-module tests are not supported in reports and validation yet. For each test, only the classpath belonging to the current module is taken.**
97
+
### Apply plugin to a multi-module build
98
+
To apply the plugin to all Gradle modules, you just need to apply the plugin only to the root module, as shown [above](#apply-plugin-to-a-single-module-build).
99
+
Applying the plugin to submodules if you have already applied it to the root module will cause configuration error.
103
100
104
101
## Configuration
105
102
@@ -194,21 +191,24 @@ android {
194
191
</details>
195
192
196
193
197
-
### Configuring reports
198
-
If you need to change the name of the XML report file or HTML directory, you may configure the corresponding tasks
194
+
### Configuring aggregated reports
195
+
Aggregated report provides report using combined classpath and coverage stats from the module in which plugin is applied and all its submodules.
196
+
197
+
If you need to change the name of the XML report file or HTML directory, you may configure the corresponding tasks in
198
+
the module in which the plugin is applied (usually this is the root module).
199
199
200
200
<detailsopen>
201
201
<summary>Kotlin</summary>
202
202
203
203
```kotlin
204
204
tasks.koverHtmlReport {
205
205
isEnabled =true// false to disable report generation
// valueType is kotlinx.kover.api.VerificationValueType.COVERED_LINES_PERCENTAGE by default
@@ -329,9 +369,9 @@ tasks.koverVerify {
329
369
```groovy
330
370
tasks.koverVerify {
331
371
rule {
332
-
name = "The project doesn't has upper limit on lines covered"
372
+
name = "Minimum number of lines covered"
333
373
bound {
334
-
maxValue = 100000
374
+
minValue = 100000
335
375
valueType = 'COVERED_LINES_COUNT'
336
376
}
337
377
}
@@ -344,7 +384,7 @@ tasks.koverVerify {
344
384
}
345
385
}
346
386
rule {
347
-
name = "Minimal line coverage rate in percents"
387
+
name = "Minimal line coverage rate in percent"
348
388
bound {
349
389
minValue = 50
350
390
// valueType is 'COVERED_LINES_PERCENTAGE' by default
@@ -354,19 +394,58 @@ tasks.koverVerify {
354
394
```
355
395
</details>
356
396
397
+
To add rules for code coverage checks for one specific module, you need to add a configuration to this module:
398
+
399
+
<detailsopen>
400
+
<summary>Kotlin</summary>
401
+
402
+
```kotlin
403
+
tasks.koverModuleVerify {
404
+
rule {
405
+
name ="Minimal line coverage rate in percent"
406
+
bound {
407
+
minValue =75
408
+
}
409
+
}
410
+
}
411
+
```
412
+
</details>
413
+
414
+
<details>
415
+
<summary>Groovy</summary>
416
+
417
+
```groovy
418
+
tasks.koverModuleVerify {
419
+
rule {
420
+
name = "Minimal line coverage rate in percent"
421
+
bound {
422
+
minValue = 75
423
+
}
424
+
}
425
+
}
426
+
```
427
+
</details>
428
+
429
+
357
430
## Tasks
358
-
The plugin, when applied, automatically creates tasks for the module (all modules, if the project is multi-module, and it applied in root build script):
359
-
-`koverXmlReport` - Generates code coverage XML report for all module's test tasks.
360
-
-`koverHtmlReport` - Generates code coverage HTML report for all module's test tasks.
361
-
-`koverReport` - Executes both `koverXmlReport` and `koverHtmlReport` tasks.
362
-
-`koverCollectReports` - Collects reports from all submodules in one directory. Default directory is `$buildDir/reports/kover/all`, names for XML reports and dirs for HTML are projects names. Executing this task does not run `koverXmlReport` or `koverHtmlReport`, it only copies previously created reports if they exist to the output directory.
363
-
-`koverVerify` - Verifies code coverage metrics based on specified rules. Always executes before `check` task.
431
+
The plugin, when applied, automatically creates tasks for the module in which it is applied (usually this is the root module):
432
+
-`koverHtmlReport` - Generates code coverage HTML report for all enabled test tasks in all modules.
433
+
-`koverXmlReport` - Generates code coverage XML report for all enabled test tasks in all modules.
434
+
-`koverReport` - Executes both `koverXmlReport` and `koverHtmlReport` tasks. Executes before `check` task if property `generateReportOnCheck` for `KoverExtension` is `true` ([see](#configuring-entire-plugin)).
435
+
-`koverVerify` - Verifies code coverage metrics of all modules based on specified rules. Always executes before `check` task.
436
+
-`koverCollectModuleReports` - Collects all modules reports into one directory. Default directory is `$buildDir/reports/kover/modules`, names for XML reports and dirs for HTML are modules names. Executing this task does not run `koverXmlReport` or `koverHtmlReport`, it only copies previously created reports if they exist to the output directory.
437
+
438
+
Tasks that are created for all modules:
439
+
-`koverHtmlModuleReport` - Generates code coverage HTML report for all enabled test tasks in one module.
440
+
-`koverXmlModuleReport` - Generates code coverage XML report for all enabled test tasks in one module.
441
+
-`koverModuleReport` - Executes both `koverXmlModuleReport` and `koverHtmlModuleReport` tasks.
442
+
-`koverModuleVerify` - Verifies code coverage metrics of one module based on specified rules. Always executes before `check` task.
364
443
365
444
366
445
## Implicit plugin dependencies
367
446
During the applying of the plugin, the artifacts of the JaCoCo or IntelliJ toolkit are dynamically loaded. They are downloaded from the `mavenCentral` repository.
368
447
369
-
For the plugin to work correctly, you need to make sure that the `mavenCentral` or its mirror is added to the list by the repository of the module in which the plugin is applied (usually this is the root module of the project) and add it if necessary.
448
+
For the plugin to work correctly, you need to make sure that the `mavenCentral` or its mirror is added to the list by the repository of the module in which the plugin is applied (usually this is the root module) and add it if necessary.
0 commit comments