Skip to content

Commit dc2b7c5

Browse files
authored
Apply power-assert plugin (#478)
1 parent 6fd8697 commit dc2b7c5

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

build-logic/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 JetBrains s.r.o. and respective authors and developers.
2+
* Copyright 2017-2025 JetBrains s.r.o. and respective authors and developers.
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

@@ -13,6 +13,7 @@ repositories {
1313

1414
dependencies {
1515
implementation(libs.kotlin.gradle.plugin)
16+
implementation(libs.power.assert.plugin)
1617
implementation(libs.dokka.gradle.plugin)
1718
implementation(libs.animalsniffer.gradle.plugin)
1819
}

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 JetBrains s.r.o. and respective authors and developers.
2+
* Copyright 2017-2025 JetBrains s.r.o. and respective authors and developers.
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

@@ -13,6 +13,7 @@ import kotlin.jvm.optionals.getOrNull
1313

1414
plugins {
1515
kotlin("multiplatform")
16+
kotlin("plugin.power-assert")
1617
id("kotlinx-io-clean")
1718
}
1819

@@ -125,6 +126,24 @@ kotlin {
125126
}
126127
}
127128

129+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
130+
powerAssert {
131+
// assertFails* are not included as p-a does not help with them yet
132+
val kotlinTestFunctions = listOf(
133+
"assertTrue", "assertFalse",
134+
"assertNull", "assertNotNull",
135+
"assertSame", "assertNotSame",
136+
"assertEquals", "assertNotEquals",
137+
"assertIs", "assertIsNot",
138+
"assertIsOfType", "assertIsNotOfType",
139+
"assertContains",
140+
"assertContentEquals",
141+
"expect"
142+
).map { "kotlin.test.$it"}
143+
144+
functions.addAll(kotlinTestFunctions)
145+
}
146+
128147
fun KotlinSourceSet.configureSourceSet() {
129148
val srcDir = if (name.endsWith("Main")) "src" else "test"
130149
val platform = name.dropLast(4)

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ okio = "3.10.2"
1616
kotlinx-benchmark-runtime = { group = "org.jetbrains.kotlinx", name = "kotlinx-benchmark-runtime", version.ref = "benchmark" }
1717
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
1818
dokka-gradle-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" }
19+
power-assert-plugin = { group = "org.jetbrains.kotlin.plugin.power-assert", name = "org.jetbrains.kotlin.plugin.power-assert.gradle.plugin", version.ref = "kotlin" }
1920
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
2021
animalsniffer-gradle-plugin = { group = "ru.vyarus", name = "gradle-animalsniffer-plugin", version.ref = "animalsniffer" }
2122
okio = { group = "com.squareup.okio", name = "okio", version.ref = "okio" }
2223

2324
[plugins]
2425

2526
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
27+
power-assert = { id = "org.jetbrains.kotlin.plugin.power-assert", version.ref = "kotlin" }
2628
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
2729
kotlinx-benchmark-plugin = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "benchmark"}

0 commit comments

Comments
 (0)