diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index c26e65a2..b9642d58 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 JetBrains s.r.o. and respective authors and developers. + * Copyright 2017-2025 JetBrains s.r.o. and respective authors and developers. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file. */ @@ -13,6 +13,7 @@ repositories { dependencies { implementation(libs.kotlin.gradle.plugin) + implementation(libs.power.assert.plugin) implementation(libs.dokka.gradle.plugin) implementation(libs.animalsniffer.gradle.plugin) } diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts index 05b97835..6a0923d6 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2017-2024 JetBrains s.r.o. and respective authors and developers. + * Copyright 2017-2025 JetBrains s.r.o. and respective authors and developers. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file. */ @@ -13,6 +13,7 @@ import kotlin.jvm.optionals.getOrNull plugins { kotlin("multiplatform") + kotlin("plugin.power-assert") id("kotlinx-io-clean") } @@ -125,6 +126,24 @@ kotlin { } } +@OptIn(ExperimentalKotlinGradlePluginApi::class) +powerAssert { + // assertFails* are not included as p-a does not help with them yet + val kotlinTestFunctions = listOf( + "assertTrue", "assertFalse", + "assertNull", "assertNotNull", + "assertSame", "assertNotSame", + "assertEquals", "assertNotEquals", + "assertIs", "assertIsNot", + "assertIsOfType", "assertIsNotOfType", + "assertContains", + "assertContentEquals", + "expect" + ).map { "kotlin.test.$it"} + + functions.addAll(kotlinTestFunctions) +} + fun KotlinSourceSet.configureSourceSet() { val srcDir = if (name.endsWith("Main")) "src" else "test" val platform = name.dropLast(4) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fadc31e6..72367a19 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,6 +16,7 @@ okio = "3.10.2" kotlinx-benchmark-runtime = { group = "org.jetbrains.kotlinx", name = "kotlinx-benchmark-runtime", version.ref = "benchmark" } kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } dokka-gradle-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" } +power-assert-plugin = { group = "org.jetbrains.kotlin.plugin.power-assert", name = "org.jetbrains.kotlin.plugin.power-assert.gradle.plugin", version.ref = "kotlin" } kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } animalsniffer-gradle-plugin = { group = "ru.vyarus", name = "gradle-animalsniffer-plugin", version.ref = "animalsniffer" } okio = { group = "com.squareup.okio", name = "okio", version.ref = "okio" } @@ -23,5 +24,6 @@ okio = { group = "com.squareup.okio", name = "okio", version.ref = "okio" } [plugins] dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +power-assert = { id = "org.jetbrains.kotlin.plugin.power-assert", version.ref = "kotlin" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } kotlinx-benchmark-plugin = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "benchmark"}