-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #632
- Loading branch information
Showing
14 changed files
with
183 additions
and
7 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
kover-gradle-plugin/examples/jvm/copy-variant/build.gradle.kts
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 @@ | ||
plugins { | ||
kotlin("jvm") version "1.7.10" | ||
id("org.jetbrains.kotlinx.kover") version "0.8.1" | ||
} | ||
|
||
dependencies { | ||
implementation(project(":first")) | ||
implementation(project(":second")) | ||
testImplementation(kotlin("test")) | ||
} | ||
|
||
kover { | ||
merge { | ||
subprojects() | ||
|
||
createVariant("aggregated") { | ||
add("jvm") | ||
} | ||
} | ||
|
||
currentProject { | ||
copyVariant("first", "aggregated") | ||
copyVariant("second", "aggregated") | ||
} | ||
|
||
reports { | ||
variant("first") { | ||
filters.includes.projects.add(":first") | ||
} | ||
variant("second") { | ||
filters.includes.projects.add(":second") | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
kover-gradle-plugin/examples/jvm/copy-variant/first/build.gradle.kts
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,7 @@ | ||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
dependencies { | ||
testImplementation(kotlin("test")) | ||
} |
8 changes: 8 additions & 0 deletions
8
kover-gradle-plugin/examples/jvm/copy-variant/first/src/main/kotlin/Utils.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,8 @@ | ||
package kotlinx.kover.examples.merged.subproject.utils | ||
|
||
class SubprojectUtils { | ||
fun minus(a: Int, b: Int): Int { | ||
if (b < 0) return 0 | ||
return a - b | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...amples/jvm/copy-variant/first/src/main/kotlin/kotlinx/kover/examples/merged/AppClasses.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,17 @@ | ||
package kotlinx.kover.examples.merged | ||
|
||
class SubprojectFirstClass { | ||
fun formatInt(i: Int): String { | ||
if (i == 0) return "ZERO" | ||
return if (i > 0) { | ||
"POSITIVE=$i" | ||
} else { | ||
"NEGATIVE=${-i}" | ||
} | ||
} | ||
|
||
fun printClass() { | ||
val name = this::class.qualifiedName | ||
println(name) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...riant/first/src/main/kotlin/kotlinx/kover/examples/merged/subproject/SubpackageClasses.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,18 @@ | ||
package kotlinx.kover.examples.merged.subproject | ||
|
||
import kotlin.math.* | ||
|
||
class SubprojectSecondClass { | ||
fun formatDouble(d: Double): String { | ||
if (d.roundToInt().toDouble() == d) { | ||
return "INTEGER=${d.roundToInt()}" | ||
} else { | ||
return "FRACTIONAL=$d" | ||
} | ||
} | ||
|
||
fun printClass() { | ||
val name = this::class.qualifiedName | ||
println(name) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
kover-gradle-plugin/examples/jvm/copy-variant/first/src/test/kotlin/TestClasses.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,11 @@ | ||
package kotlinx.kover.examples.merged | ||
|
||
import kotlin.test.Test | ||
|
||
class TestClasses { | ||
@Test | ||
fun testThisProject() { | ||
SubprojectFirstClass().printClass() | ||
} | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
kover-gradle-plugin/examples/jvm/copy-variant/second/build.gradle.kts
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,3 @@ | ||
plugins { | ||
kotlin("jvm") | ||
} |
7 changes: 7 additions & 0 deletions
7
...-gradle-plugin/examples/jvm/copy-variant/second/src/main/kotlin/ClassFromSecondProject.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,7 @@ | ||
package kotlinx.kover.examples.merged | ||
|
||
class ClassFromSecondProject { | ||
fun foo() { | ||
println("Hello") | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
kover-gradle-plugin/examples/jvm/copy-variant/settings.gradle.kts
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,16 @@ | ||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
} | ||
rootProject.name = "copy-variant" | ||
|
||
include(":first") | ||
include(":second") | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
kover-gradle-plugin/examples/jvm/copy-variant/src/main/kotlin/AppClasses.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,17 @@ | ||
package kotlinx.kover.examples.merged | ||
|
||
class ExampleClass { | ||
fun formatInt(i: Int): String { | ||
if (i == 0) return "ZERO" | ||
return if (i > 0) { | ||
"POSITIVE=$i" | ||
} else { | ||
"NEGATIVE=${-i}" | ||
} | ||
} | ||
|
||
fun printClass() { | ||
val name = this::class.qualifiedName | ||
println(name) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...in/examples/jvm/copy-variant/src/main/kotlin/kotlinx/kover/examples/merged/utils/Utils.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,8 @@ | ||
package kotlinx.kover.examples.merged.utils | ||
|
||
class MergedUtils { | ||
fun sum(a: Int, b: Int): Int { | ||
if (a < 0 && b < 0) return 0 | ||
return a + b | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
kover-gradle-plugin/examples/jvm/copy-variant/src/test/kotlin/TestClasses.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,22 @@ | ||
package kotlinx.kover.examples.merged | ||
|
||
import kotlinx.kover.examples.merged.subproject.* | ||
import kotlin.test.Test | ||
|
||
class TestClasses { | ||
@Test | ||
fun testThisProject() { | ||
ExampleClass().formatInt(50) | ||
} | ||
|
||
@Test | ||
fun testExcludedProject() { | ||
ClassFromSecondProject().foo() | ||
} | ||
|
||
@Test | ||
fun testSubproject() { | ||
SubprojectFirstClass().formatInt(42) | ||
SubprojectSecondClass().formatDouble(4.2) | ||
} | ||
} |
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