Skip to content

Commit

Permalink
fix: support for a list of sourceinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
razvn committed Jul 1, 2022
1 parent 3345eab commit 594239e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This list is not intended to be all-encompassing - it will document major and breaking changes with their rationale when appropriate:

### v1.0.1
- Fix: multiple sourceinfo entries support in the jacoco report
-
### v1.0.0
- Initial major release
- configuration change [Breaking]: `intputFile` and `outputFile` now take a File as param instead of string path
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
kotlin.code.style=official
version=1.0.0
version=1.0.1
8 changes: 4 additions & 4 deletions src/main/kotlin/models.kt
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@ class Jacoco {
@field:Attribute(name = "name", required = true)
lateinit var name: String

@field:Element(name = "sessioninfo", required = true)
lateinit var sessionInfo: SessionInfo
@field:ElementList(name = "sessioninfo", required = false, inline = true)
var sessionInfos: List<SessionInfo> = mutableListOf()

@field:ElementList(name = "package", required = false, inline = true)
var packages: List<PackageElement> = mutableListOf()

@field:ElementList(name = "counter", required = false, inline = true)
override var counters: List<Counter> = mutableListOf()

fun timestamp(): Long = sessionInfo.start?.toLongOrNull()?.let { it / 1000 } ?: 0
fun timestamp(): Long = sessionInfos.firstOrNull()?.start?.toLongOrNull()?.let { it / 1000 } ?: 0

fun packagesNames() = packages.mapNotNull(PackageElement::name).toSet()

Expand Down Expand Up @@ -315,7 +315,7 @@ class Jacoco {

fun Jacoco.Report.print() {
println(name)
println(sessionInfo.id)
println(sessionInfos.map(Jacoco.SessionInfo::id).joinToString(", "))
packages.forEach {
println(" package: ${it.name}")
it.classes.forEach {
Expand Down

0 comments on commit 594239e

Please sign in to comment.