Skip to content

Commit 0855c64

Browse files
Release 0.7.3
PR #439 Co-authored-by: Leonid Startsev <[email protected]>
1 parent a74f3ba commit 0855c64

File tree

18 files changed

+140
-113
lines changed

18 files changed

+140
-113
lines changed

Diff for: CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
0.7.3 / 2023-07-26
2+
===================
3+
## Kover Gradle Plugin
4+
### Features
5+
* Added ability to specify verification rules in the root of reports config
6+
* [`#423`](https://github.com/Kotlin/kotlinx-kover/issues/423) Implemented task of generating binary report
7+
8+
### Bugfixes
9+
* [`#405`](https://github.com/Kotlin/kotlinx-kover/issues/405) Fixed lookup for tests if unit tests are disabled in Android config
10+
* [`#415`](https://github.com/Kotlin/kotlinx-kover/issues/415) Fixed usage of Kover Gradle Plugin in buildSrc directory
11+
* [`#431`](https://github.com/Kotlin/kotlinx-kover/issues/431) Fixed excluding of companion object by annotation from report
12+
13+
## Kover Offline
14+
### Features
15+
* Added API for getting coverage inside a running application, instrumented offline
16+
117
0.7.2 / 2023-06-26
218
===================
319
### Features

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Add the following to your top-level build file:
3636

3737
```kotlin
3838
plugins {
39-
id("org.jetbrains.kotlinx.kover") version "0.7.2"
39+
id("org.jetbrains.kotlinx.kover") version "0.7.3"
4040
}
4141
```
4242
</details>
@@ -46,7 +46,7 @@ plugins {
4646

4747
```groovy
4848
plugins {
49-
id 'org.jetbrains.kotlinx.kover' version '0.7.2'
49+
id 'org.jetbrains.kotlinx.kover' version '0.7.3'
5050
}
5151
```
5252
</details>
@@ -69,7 +69,7 @@ buildscript {
6969
}
7070

7171
dependencies {
72-
classpath("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.2")
72+
classpath("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.3")
7373
}
7474
}
7575

@@ -88,7 +88,7 @@ buildscript {
8888
mavenCentral()
8989
}
9090
dependencies {
91-
classpath 'org.jetbrains.kotlinx:kover-gradle-plugin:0.7.2'
91+
classpath 'org.jetbrains.kotlinx:kover-gradle-plugin:0.7.3'
9292
}
9393
}
9494

Diff for: build.gradle.kts

+99
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,107 @@
1414
* limitations under the License.
1515
*/
1616

17+
import java.time.LocalDate
18+
import java.time.format.DateTimeFormatter
19+
1720
plugins {
1821
kotlin("jvm") apply false
1922
alias(libs.plugins.kotlinx.dokka) apply false
2023
alias(libs.plugins.kotlinx.binaryCompatibilityValidator) apply false
2124
}
25+
26+
27+
28+
// ====================
29+
// Release preparation
30+
// ====================
31+
tasks.register("prepareRelease") {
32+
33+
doLast {
34+
if (!project.hasProperty("releaseVersion")) {
35+
throw GradleException("Property 'releaseVersion' is required to run this task")
36+
}
37+
val releaseVersion = project.property("releaseVersion") as String
38+
val prevReleaseVersion = project.property("kover.release.version") as String
39+
40+
val projectDir = layout.projectDirectory
41+
42+
projectDir.file("gradle.properties").asFile.patchProperties(releaseVersion)
43+
projectDir.file("CHANGELOG.md").asFile.patchChangeLog(releaseVersion)
44+
45+
projectDir.file("README.md").asFile.replaceInFile(prevReleaseVersion, releaseVersion)
46+
47+
// replace versions in examples
48+
projectDir.dir("kover-gradle-plugin").dir("examples").patchExamples(releaseVersion, prevReleaseVersion)
49+
projectDir.dir("kover-offline-runtime").dir("examples").patchExamples(releaseVersion, prevReleaseVersion)
50+
51+
// replace versions in docs
52+
projectDir.dir("docs").patchDocs(releaseVersion, prevReleaseVersion)
53+
}
54+
}
55+
56+
fun Directory.patchExamples(releaseVersion: String, prevReleaseVersion: String) {
57+
asFileTree.matching {
58+
include("**/*gradle")
59+
include("**/*gradle.kts")
60+
}.files.forEach {
61+
it.replaceInFile(prevReleaseVersion, releaseVersion)
62+
}
63+
}
64+
65+
fun Directory.patchDocs(releaseVersion: String, prevReleaseVersion: String) {
66+
asFileTree.files.forEach {
67+
it.replaceInFile(prevReleaseVersion, releaseVersion)
68+
}
69+
}
70+
71+
fun File.patchChangeLog(releaseVersion: String) {
72+
val oldContent = readText()
73+
writer().use {
74+
it.appendLine("$releaseVersion / ${LocalDate.now().format(DateTimeFormatter.ISO_DATE)}")
75+
it.appendLine("===================")
76+
it.appendLine("TODO add changelog!")
77+
it.appendLine()
78+
it.append(oldContent)
79+
}
80+
}
81+
82+
fun File.patchProperties(releaseVersion: String) {
83+
val oldLines = readLines()
84+
writer().use { writer ->
85+
oldLines.forEach { line ->
86+
when {
87+
line.startsWith("version=") -> writer.append("version=").appendLine(increaseSnapshotVersion(releaseVersion))
88+
line.startsWith("kover.release.version=") -> writer.append("kover.release.version=").appendLine(releaseVersion)
89+
else -> writer.appendLine(line)
90+
}
91+
}
92+
}
93+
}
94+
95+
// modify version '1.2.3' to '1.2.4' and '1.2.3-Beta' to '1.2.3-SNAPSHOT'
96+
fun increaseSnapshotVersion(releaseVersion: String): String {
97+
// remove postfix like '-Alpha'
98+
val correctedVersion = releaseVersion.substringBefore('-')
99+
if (correctedVersion != releaseVersion) {
100+
return "$correctedVersion-SNAPSHOT"
101+
}
102+
103+
// split version 0.0.0 to int parts
104+
val parts = correctedVersion.split('.')
105+
val newVersion = parts.mapIndexed { index, value ->
106+
if (index == parts.size - 1) {
107+
(value.toInt() + 1).toString()
108+
} else {
109+
value
110+
}
111+
}.joinToString(".")
112+
113+
return "$newVersion-SNAPSHOT"
114+
}
115+
116+
fun File.replaceInFile(old: String, new: String) {
117+
val newContent = readText().replace(old, new)
118+
writeText(newContent)
119+
}
120+

Diff for: docs/gradle-plugin/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Add the following to your top-level build file:
4444

4545
```kotlin
4646
plugins {
47-
id("org.jetbrains.kotlinx.kover") version "0.7.2"
47+
id("org.jetbrains.kotlinx.kover") version "0.7.3"
4848
}
4949
```
5050

@@ -62,7 +62,7 @@ buildscript {
6262
}
6363

6464
dependencies {
65-
classpath("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.2")
65+
classpath("org.jetbrains.kotlinx:kover-gradle-plugin:0.7.3")
6666
}
6767
}
6868

@@ -78,7 +78,7 @@ buildscript {
7878
mavenCentral()
7979
}
8080
dependencies {
81-
classpath 'org.jetbrains.kotlinx:kover-gradle-plugin:0.7.2'
81+
classpath 'org.jetbrains.kotlinx:kover-gradle-plugin:0.7.3'
8282
}
8383
}
8484

Diff for: docs/gradle-plugin/migrations/migration-to-0.7.0.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Kover migration guide from 0.6.x to 0.7.2
1+
# Kover migration guide from 0.6.x to 0.7.3
22

33
## Migration steps
4-
To migrate to version `0.7.2`, you must follow all steps below if they are applicable to your project.
4+
To migrate to version `0.7.3`, you must follow all steps below if they are applicable to your project.
55

66
### Merge reports config was removed
77
Now all Kotlin report tasks (`koverHtmlReport`, `koverXmlReport`, `koverVerify`) are in single copy, they can be both single-project or merged cross-projects reports.
@@ -612,7 +612,7 @@ kover {
612612

613613
---
614614

615-
### Could not find org.jetbrains.kotlinx:kover:0.7.2
615+
### Could not find org.jetbrains.kotlinx:kover:0.7.3
616616
_Solution_
617617

618618
rename dependencies in _buildSrc_ from `org.jetbrains.kotlinx:kover:` to `org.jetbrains.kotlinx:kover-gradle-plugin:`

Diff for: docs/offline-instrumentation/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ configurations.register("koverCli") {
6262
}
6363
6464
dependencies {
65-
runtimeOnly("org.jetbrains.kotlinx:kover-offline-runtime:0.7.2")
66-
add("koverCli", "org.jetbrains.kotlinx:kover-cli:0.7.2")
65+
runtimeOnly("org.jetbrains.kotlinx:kover-offline-runtime:0.7.3")
66+
add("koverCli", "org.jetbrains.kotlinx:kover-cli:0.7.3")
6767
6868
testImplementation(kotlin("test"))
6969
}

Diff for: gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
version=0.7.3-SNAPSHOT
1+
version=0.8.0-SNAPSHOT
22
group=org.jetbrains.kotlinx
33

44
# version of the latest release
5-
kover.release.version=0.7.2
5+
kover.release.version=0.7.3
66
kotlin.code.style=official

Diff for: kover-gradle-plugin/build.gradle.kts

-88
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
3-
import java.time.LocalDate
4-
import java.time.format.DateTimeFormatter
53
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
64
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
75

@@ -189,89 +187,3 @@ gradlePlugin {
189187
}
190188
}
191189
}
192-
193-
194-
// ====================
195-
// Release preparation
196-
// ====================
197-
tasks.register("prepareRelease") {
198-
199-
doLast {
200-
if (!project.hasProperty("releaseVersion")) {
201-
throw GradleException("Property 'releaseVersion' is required to run this task")
202-
}
203-
val releaseVersion = project.property("releaseVersion") as String
204-
val prevReleaseVersion = project.property("kover.release.version") as String
205-
206-
val dir = layout.projectDirectory
207-
val rootDir = rootProject.layout.projectDirectory
208-
209-
rootDir.file("gradle.properties").asFile.patchProperties(releaseVersion)
210-
rootDir.file("CHANGELOG.md").asFile.patchChangeLog(releaseVersion)
211-
212-
rootDir.file("README.md").asFile.replaceInFile(prevReleaseVersion, releaseVersion)
213-
214-
// replace versions in examples
215-
dir.dir("examples").asFileTree.matching {
216-
include("**/*gradle")
217-
include("**/*gradle.kts")
218-
}.files.forEach {
219-
it.replaceInFile(prevReleaseVersion, releaseVersion)
220-
}
221-
222-
// replace versions in docs
223-
rootDir.dir("docs").asFileTree.files.forEach {
224-
it.replaceInFile(prevReleaseVersion, releaseVersion)
225-
}
226-
}
227-
}
228-
229-
fun File.patchChangeLog(releaseVersion: String) {
230-
val oldContent = readText()
231-
writer().use {
232-
it.appendLine("$releaseVersion / ${LocalDate.now().format(DateTimeFormatter.ISO_DATE)}")
233-
it.appendLine("===================")
234-
it.appendLine("TODO add changelog!")
235-
it.appendLine()
236-
it.append(oldContent)
237-
}
238-
}
239-
240-
fun File.patchProperties(releaseVersion: String) {
241-
val oldLines = readLines()
242-
writer().use { writer ->
243-
oldLines.forEach { line ->
244-
when {
245-
line.startsWith("version=") -> writer.append("version=").appendLine(increaseSnapshotVersion(releaseVersion))
246-
line.startsWith("kover.release.version=") -> writer.append("kover.release.version=").appendLine(releaseVersion)
247-
else -> writer.appendLine(line)
248-
}
249-
}
250-
}
251-
}
252-
253-
// modify version '1.2.3' to '1.2.4' and '1.2.3-Beta' to '1.2.3-SNAPSHOT'
254-
fun increaseSnapshotVersion(releaseVersion: String): String {
255-
// remove postfix like '-Alpha'
256-
val correctedVersion = releaseVersion.substringBefore('-')
257-
if (correctedVersion != releaseVersion) {
258-
return "$correctedVersion-SNAPSHOT"
259-
}
260-
261-
// split version 0.0.0 to int parts
262-
val parts = correctedVersion.split('.')
263-
val newVersion = parts.mapIndexed { index, value ->
264-
if (index == parts.size - 1) {
265-
(value.toInt() + 1).toString()
266-
} else {
267-
value
268-
}
269-
}.joinToString(".")
270-
271-
return "$newVersion-SNAPSHOT"
272-
}
273-
274-
fun File.replaceInFile(old: String, new: String) {
275-
val newContent = readText().replace(old, new)
276-
writeText(newContent)
277-
}

Diff for: kover-gradle-plugin/examples/android/flavors/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ plugins {
22
id("com.android.application") version "7.4.0" apply false
33
id("com.android.library") version "7.4.0" apply false
44
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
5-
id("org.jetbrains.kotlinx.kover") version "0.7.2" apply false
5+
id("org.jetbrains.kotlinx.kover") version "0.7.3" apply false
66
}

Diff for: kover-gradle-plugin/examples/android/minimal_groovy/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ plugins {
22
id 'com.android.application' version '7.4.0' apply false
33
id 'com.android.library' version '7.4.0' apply false
44
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
5-
id 'org.jetbrains.kotlinx.kover' version '0.7.2' apply false
5+
id 'org.jetbrains.kotlinx.kover' version '0.7.3' apply false
66
}

Diff for: kover-gradle-plugin/examples/android/minimal_kts/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ plugins {
22
id("com.android.application") version "7.4.0" apply false
33
id("com.android.library") version "7.4.0" apply false
44
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
5-
id("org.jetbrains.kotlinx.kover") version "0.7.2" apply false
5+
id("org.jetbrains.kotlinx.kover") version "0.7.3" apply false
66
}

Diff for: kover-gradle-plugin/examples/android/multiplatform/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id("com.android.application") version "7.4.0" apply false
33
id("com.android.library") version "7.4.0" apply false
44
kotlin("multiplatform") version ("1.8.20") apply false
5-
id("org.jetbrains.kotlinx.kover") version "0.7.2"
5+
id("org.jetbrains.kotlinx.kover") version "0.7.3"
66
}
77

88
dependencies {

Diff for: kover-gradle-plugin/examples/android/multiproject/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ plugins {
22
id("com.android.application") version "7.4.0" apply false
33
id("com.android.library") version "7.4.0" apply false
44
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
5-
id("org.jetbrains.kotlinx.kover") version "0.7.2" apply false
5+
id("org.jetbrains.kotlinx.kover") version "0.7.3" apply false
66
}

Diff for: kover-gradle-plugin/examples/android/variantUsage/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ plugins {
22
id("com.android.application") version "7.4.0" apply false
33
id("com.android.library") version "7.4.0" apply false
44
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
5-
id("org.jetbrains.kotlinx.kover") version "0.7.2" apply false
5+
id("org.jetbrains.kotlinx.kover") version "0.7.3" apply false
66
}

Diff for: kover-gradle-plugin/examples/jvm/defaults/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
kotlin("jvm") version "1.7.10"
3-
id("org.jetbrains.kotlinx.kover") version "0.7.2"
3+
id("org.jetbrains.kotlinx.kover") version "0.7.3"
44
}
55

66
repositories {

Diff for: kover-gradle-plugin/examples/jvm/merged/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
kotlin("jvm") version "1.7.10"
3-
id("org.jetbrains.kotlinx.kover") version "0.7.2"
3+
id("org.jetbrains.kotlinx.kover") version "0.7.3"
44
}
55

66
repositories {

Diff for: kover-gradle-plugin/examples/jvm/minimal/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
kotlin("jvm") version "1.7.10"
3-
id("org.jetbrains.kotlinx.kover") version "0.7.2"
3+
id("org.jetbrains.kotlinx.kover") version "0.7.3"
44
}
55

66
repositories {

0 commit comments

Comments
 (0)