-
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support aggregating Kover reports without a need for a dedicated module
- Loading branch information
Showing
7 changed files
with
241 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package bar | ||
|
||
fun action(one: Boolean, two: Boolean): String { | ||
return if (one) { | ||
if (two) { | ||
"one, two" | ||
} else { | ||
"one" | ||
} | ||
} else { | ||
if (two) { | ||
"two" | ||
} else { | ||
"nothing" | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
example/kotlinlib/linting/4-kover/bar/test/src/BarTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package bar | ||
|
||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.shouldBe | ||
|
||
class BarTests : FunSpec({ | ||
test("kotlin - success") { | ||
action(true, true) shouldBe "one, two" | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
kotlinlib/src/mill/kotlinlib/contrib/kover/KoverReportBaseModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Some parts of this code are taken from lefou/mill-jacoco. Copyright 2021-Present Tobias Roeser. | ||
*/ | ||
|
||
package mill | ||
package kotlinlib.contrib.kover | ||
|
||
import mill.api.Result.Success | ||
import mill.api.{Loose, PathRef} | ||
import mill.kotlinlib.{Dep, DepSyntax, Versions} | ||
import mill.scalalib.CoursierModule | ||
|
||
trait KoverReportBaseModule extends CoursierModule { | ||
|
||
private[kover] val reportName = "kover-report" | ||
|
||
/** | ||
* Reads the Kover version from system environment variable `KOVER_VERSION` or defaults to a hardcoded version. | ||
*/ | ||
def koverVersion: T[String] = Task.Input { | ||
Success[String](T.env.getOrElse("KOVER_VERSION", Versions.koverVersion)) | ||
} | ||
|
||
def koverCliDep: Target[Agg[Dep]] = T { | ||
Agg(ivy"org.jetbrains.kotlinx:kover-cli:${koverVersion()}") | ||
} | ||
|
||
/** | ||
* Classpath for running Kover. | ||
*/ | ||
def koverCliClasspath: T[Loose.Agg[PathRef]] = T { | ||
defaultResolver().resolveDeps(koverCliDep()) | ||
} | ||
} |
Oops, something went wrong.