Skip to content

Commit

Permalink
Release 0.6.0-Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshin committed Aug 2, 2022
1 parent 6d6ca6c commit f1f8f2f
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 45 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,24 @@
0.6.0-Beta / 2022-08-02
===================
In this version, the plugin API has been fully redesigned. The new API allows you to configure Kover in a more flexible manner, there is no need to configure Kover or test tasks separately.

Refer to [migration guide](https://github.com/Kotlin/kotlinx-kover/blob/v0.6.0-Beta/docs/migration-to-0.6.0.md) in order to migrate.

**This is a beta release, the stability of all features is not guaranteed. The beta version is released to collect feedback on the new API and its usability.**

### Features
* Implemented a new plugin API (#19)
* Minimal and default agent versions upgraded to 1.0.675
* Added support of instruction and branch counters for verification tasks (#128)

### Bugfixes
* Verification task is no longer executed if there are no rules (#168)

### Internal features
* Kotlin version upgraded to 1.7.10
* instrumentation config added to the test framework
* added test on instrumentation config

0.5.1 / 2022-05-11
===================

Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -42,7 +42,7 @@ In top-level build file:

```kotlin
plugins {
id("org.jetbrains.kotlinx.kover") version "0.6.0-RC"
id("org.jetbrains.kotlinx.kover") version "0.6.0-Beta"
}
```
</details>
Expand All @@ -52,7 +52,7 @@ plugins {

```groovy
plugins {
id 'org.jetbrains.kotlinx.kover' version '0.6.0-RC'
id 'org.jetbrains.kotlinx.kover' version '0.6.0-Beta'
}
```
</details>
Expand All @@ -70,7 +70,7 @@ buildscript {
}

dependencies {
classpath("org.jetbrains.kotlinx:kover:0.6.0-RC")
classpath("org.jetbrains.kotlinx:kover:0.6.0-Beta")
}
}

Expand All @@ -87,7 +87,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'org.jetbrains.kotlinx:kover:0.6.0-RC'
classpath 'org.jetbrains.kotlinx:kover:0.6.0-Beta'
}
}
Expand Down
16 changes: 10 additions & 6 deletions build.gradle.kts
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.plugin.*

plugins {
kotlin("jvm") version "1.7.10"
kotlin("jvm")

`java-gradle-plugin`
`maven-publish`
Expand All @@ -14,6 +14,8 @@ repositories {
google()
}

val kotlinVersion = property("kotlinVersion")

sourceSets {
create("functionalTest") {
compileClasspath += sourceSets.main.get().output + configurations.testRuntimeClasspath
Expand All @@ -31,16 +33,16 @@ dependencies {
// exclude transitive dependency on stdlib, the Gradle version should be used
compileOnly(kotlin("stdlib"))

compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:${property("kotlin.version")}")
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
compileOnly("com.android.tools.build:gradle:4.2.2")

testImplementation(kotlin("test"))

"functionalTestImplementation"(gradleTestKit())
// dependencies only for plugin's classpath to work with Kotlin Multi-Platform and Android plugins
"functionalTestCompileOnly"("org.jetbrains.kotlin:kotlin-gradle-plugin:${property("kotlin.version")}")
"functionalTestCompileOnly"("org.jetbrains.kotlin:kotlin-compiler-embeddable:${property("kotlin.version")}")
"functionalTestCompileOnly"("org.jetbrains.kotlin:kotlin-compiler-runner:${property("kotlin.version")}")
"functionalTestCompileOnly"("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
"functionalTestCompileOnly"("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion")
"functionalTestCompileOnly"("org.jetbrains.kotlin:kotlin-compiler-runner:$kotlinVersion")
}

java {
Expand All @@ -49,7 +51,6 @@ java {
}



tasks.register<Test>("functionalTest") {
group = "verification"
testClassesDirs = sourceSets["functionalTest"].output.classesDirs
Expand All @@ -67,6 +68,9 @@ tasks.register<Test>("functionalTest") {
file
.writeText(sourceSets["functionalTest"].compileClasspath.joinToString("\n"))
systemProperties["plugin-classpath"] = file.absolutePath

// used in build scripts of functional tests
systemProperties["kotlinVersion"] = kotlinVersion
}
}

Expand Down
64 changes: 33 additions & 31 deletions docs/migration-to-0.6.0.md
@@ -1,14 +1,16 @@
# Kover migration guide from 0.5.x to 0.6.0-Beta

The new API allows you to configure Kover in a more flexible manner, while being more concise than the previous API.
From now on, there is no need to configure Kover or test tasks separately.

# Main differences
## Main differences
- applying the plugin to the root project no longer causes it to be recursively applied to all subprojects - you must explicitly apply it to all projects that will be covered
- merged tasks are not created by default. You must explicitly enable it if necessary (for details [see](#merged-report-changes))
- the extension `kover {}` is used to configure tasks `koverXmlReport`, `koverHtmlReport`, `koverVerify`, test tasks, instead of configuring these tasks directly
- the extension `koverMerged {}` is used to configure tasks `koverMergedXmlReport`, `koverMergedHtmlReport`, `koverMergedVerify`, instead of configuring these tasks directly
- task `koverCollectReports` was removed

# Merged report changes
## Merged report changes

In the new API, merged tasks are not created by default. To create them, you need to use the plugin in the `koverMerged` extension, it is necessary to call the function `enable()`.
e.g.
Expand Down Expand Up @@ -40,7 +42,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlinx:kover:0.6.0-BETA")
classpath("org.jetbrains.kotlinx:kover:0.6.0-Beta")
}
}
Expand Down Expand Up @@ -145,11 +147,11 @@ extensions.configure<KoverMergedConfig> {
}
```

# Migration Issues
## Migration Issues

## Root kover extension
### Root kover extension

### type of `isDisabled` property changed from `Boolean` to `Property<Boolean>`.
#### type of `isDisabled` property changed from `Boolean` to `Property<Boolean>`.

_Error message:_

Expand All @@ -159,7 +161,7 @@ Val cannot be reassigned

_Solution for Kotlin script:_ change `isDisabled = true` to `isDisabled.set(true)`

### Properties `coverageEngine`, `intellijEngineVersion` and `jacocoEngineVersion` were removed.
#### Properties `coverageEngine`, `intellijEngineVersion` and `jacocoEngineVersion` were removed.

_Error messages:_

Expand Down Expand Up @@ -189,7 +191,7 @@ To use JaCoCo Coverage Engine with default version write `engine.set(kotlinx.ko
To use JaCoCo Coverage Engine with custom version write `engine.set(kotlinx.kover.api.JacocoEngine("version"))`
(Kotlin) or `engine = kotlinx.kover.api.JacocoEngine("version")` (Groovy).

### Property "generateReportOnCheck" was removed
#### Property "generateReportOnCheck" was removed

Use the properties individually for each report

Expand All @@ -209,7 +211,7 @@ kover {
}
```

### property `disabledProjects` was removed
#### property `disabledProjects` was removed

_Error message:_

Expand All @@ -233,18 +235,18 @@ koverMerged {

If `includes` are empty, all subprojects and current project are used in merged reports.

### Property `instrumentAndroidPackage` was removed
#### Property `instrumentAndroidPackage` was removed

There is no replacement. At the moment, all classes from the packages "android." and "com.android.*" excluded from
instrumentation.

### property `runAllTestsForProjectTask` was removed
#### property `runAllTestsForProjectTask` was removed

In the new API for single-project reports, it is impossible to call test tasks of another project. To account for coverage from tests of another module, use merged reports.

## Kover extension for test task
### Kover extension for test task

### type of `isDisabled` property changed from `Boolean` to `Property<Boolean>`.
#### type of `isDisabled` property changed from `Boolean` to `Property<Boolean>`.
_Error message_

```
Expand All @@ -253,27 +255,27 @@ Val cannot be reassigned

_Solution for Kotlin script:_ change `isDisabled = true` to `isDisabled.set(true)`

### `binaryReportFile` was renamed to `reportFile`
#### `binaryReportFile` was renamed to `reportFile`

Solution: change `binaryReportFile` to `reportFile`

### Type of `includes` property changed from `List<String>` to `ListProperty<String>`
#### Type of `includes` property changed from `List<String>` to `ListProperty<String>`

Solution:

```includes.addAll("com.example.*", "foo.bar.*")```

### type of `excludes` property changed from `List<String>` to `ListProperty<String>`
#### type of `excludes` property changed from `List<String>` to `ListProperty<String>`

Solution for Kotlin: change `excludes = listOf("com.example.*", "foo.bar.*")`
to `includes.addAll("com.example.*", "foo.bar.*")`

Solution for Groovy: change `excludes = ["com.example.*", "foo.bar.*"]`
to `includes.addAll("com.example.*", "foo.bar.*")`

## `koverXmlReport` and `koverMergedXmlReport` tasks configuration
### `koverXmlReport` and `koverMergedXmlReport` tasks configuration

### Property `xmlReportFile` was removed
#### Property `xmlReportFile` was removed
Solution: use property in Kover extension at the root of the project

```
Expand All @@ -285,7 +287,7 @@ kover {
```
&ast; for `xmlReportFile` task use `koverMerged { ... }` extension of the project.

### Property `includes` was removed
#### Property `includes` was removed

Solution for Kotlin: use filter in Kover extension at the root of the project

Expand All @@ -312,7 +314,7 @@ kover {
```
&ast; for `xmlReportFile` task use `koverMerged { ... }` extension of the project.

### Property `excludes` was removed
#### Property `excludes` was removed

Solution for Kotlin: use filter in Kover extension at the root of the project

Expand All @@ -339,9 +341,9 @@ kover {
```
&ast; for `xmlReportFile` task use `koverMerged { ... }` extension of the project.

## `KoverTaskExtension` configuration
### `KoverTaskExtension` configuration

### Type of `excludes` and `includes` property changed from `List<String>` to `ListProperty<String>`
#### Type of `excludes` and `includes` property changed from `List<String>` to `ListProperty<String>`
_Error message:_
```
Val cannot be reassigned
Expand All @@ -358,9 +360,9 @@ excludes.addAll("com.example.*", "foo.bar.*")
```


## `koverHtmlReport` and `koverMergedHtmlReport` tasks configuration
### `koverHtmlReport` and `koverMergedHtmlReport` tasks configuration

### Class `KoverHtmlReportTask` was removed
#### Class `KoverHtmlReportTask` was removed

_Error message:_
```
Expand All @@ -379,7 +381,7 @@ kover {
}
```

### Property `htmlReportDir` was removed
#### Property `htmlReportDir` was removed

_Error message:_
```
Expand All @@ -397,7 +399,7 @@ kover {
```
&ast; for `koverMergedHtmlReport` task use `koverMerged { ... }` extension of the project.

### Property `includes` was removed
#### Property `includes` was removed

_Error message:_
```
Expand Down Expand Up @@ -429,7 +431,7 @@ kover {
```
&ast; for `koverMergedHtmlReport` task use `koverMerged { ... }` extension of the project.

### Property `excludes` was removed
#### Property `excludes` was removed

Error message:
```
Expand Down Expand Up @@ -461,9 +463,9 @@ kover {
```
&ast; for `koverMergedHtmlReport` task use `koverMerged { ... }` extension of the project.

## `koverVerify` and `koverMergedVerify` tasks configuration
### `koverVerify` and `koverMergedVerify` tasks configuration

### Function `rule` was removed for single-project verification
#### Function `rule` was removed for single-project verification

Error message:
```
Expand All @@ -486,7 +488,7 @@ kover {

* For `koverMergedVerify` task use `koverMerged { ... }` extension of the project.

### Property `includes` was removed
#### Property `includes` was removed

_Error message:_
```
Expand Down Expand Up @@ -518,7 +520,7 @@ kover {
```
&ast; for `koverMergedVerify` task use `koverMerged { ... }` extension of the project.

### Property `excludes` was removed
#### Property `excludes` was removed

_Error message:_
```
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
@@ -1,5 +1,5 @@
version=0.6.0-SNAPSHOT
version=0.6.0-Beta-SNAPSHOT
group=org.jetbrains.kotlinx

kotlin.version=1.7.10
kotlinVersion=1.7.10
kotlin.code.style=official
7 changes: 7 additions & 0 deletions settings.gradle.kts
@@ -1,2 +1,9 @@
rootProject.name = "kover"

pluginManagement {
val kotlinVersion: String by settings

plugins {
kotlin("jvm") version kotlinVersion
}
}
Expand Up @@ -28,6 +28,9 @@ internal val ALL_LANGUAGES = listOf(GradleScriptLanguage.KOTLIN, GradleScriptLan
internal val ALL_ENGINES = listOf(CoverageEngineVendor.INTELLIJ, CoverageEngineVendor.JACOCO)
internal val ALL_TYPES = listOf(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM)

private val kotlinVersion = System.getProperty("kotlinVersion")
?: throw Exception("System property 'kotlin-version' not defined for functional tests")

internal open class BaseGradleScriptTest {
@Rule
@JvmField
Expand All @@ -52,7 +55,7 @@ internal open class BaseGradleScriptTest {
internal fun DiverseBuild.addKoverRootProject(builder: ProjectBuilder.() -> Unit) {
addProject("root", ":") {
plugins {
kotlin("1.7.10")
kotlin(kotlinVersion)
kover("DEV")
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/kotlinx/kover/api/KoverConstants.kt
Expand Up @@ -43,5 +43,5 @@ public object KoverVersions {
}

public object KoverMigrations {
public const val MIGRATION_0_5_TO_0_6 = "https://github.com/Kotlin/kotlinx-kover/blob/v0.6.0-BETA/docs/migration-to-0.6.0.md"
public const val MIGRATION_0_5_TO_0_6 = "https://github.com/Kotlin/kotlinx-kover/blob/v0.6.0-Beta/docs/migration-to-0.6.0.md"
}

0 comments on commit f1f8f2f

Please sign in to comment.