Skip to content

Commit

Permalink
Merge pull request #752 from supabase-community/power-assert
Browse files Browse the repository at this point in the history
Add power assert to all library modules
  • Loading branch information
jan-tennert authored Oct 15, 2024
2 parents d6f18df + a750d39 commit ecd497f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
alias(libs.plugins.kotlinx.plugin.serialization) apply false
id(libs.plugins.maven.publish.get().pluginId) apply false
alias(libs.plugins.kotlinx.atomicfu) apply false
id(libs.plugins.power.assert.get().pluginId) apply false
}

allprojects {
Expand Down Expand Up @@ -51,6 +52,7 @@ val reportMerge by tasks.registering(io.gitlab.arturbosch.detekt.report.ReportMe

libraryModules(false) {
applyDokkaWithConfiguration()
applyPowerAssertConfiguration()
applyDetektWithConfiguration(reportMerge)
}

Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ dependencies {
implementation(libs.dokka.gradle)
implementation(libs.publishing.gradle)
implementation(libs.compose.gradle)
implementation(libs.power.assert.gradle)
}
17 changes: 17 additions & 0 deletions buildSrc/src/main/kotlin/PowerAssert.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.powerassert.gradle.PowerAssertGradleExtension

@OptIn(ExperimentalKotlinGradlePluginApi::class)
fun Project.applyPowerAssertConfiguration() {
apply(plugin = "org.jetbrains.kotlin.plugin.power-assert")

extensions.configure<PowerAssertGradleExtension>(PowerAssertGradleExtension::class.java) {
functions.addAll(
listOf("kotlin.assert", "kotlin.test.assertTrue", "kotlin.test.assertEquals",
"kotlin.test.assertNull", "kotlin.test.assertIs", "kotlin.test.assertContentContains",
"kotlin.test.assertContains")
)
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "

native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlinx-atomicfu = { id = "org.jetbrains.kotlinx.atomicfu", version.ref = "atomicfu" }
power-assert = { id = "org.jetbrains.kotlin.plugin.power-assert", version.ref = "kotlin" }

[libraries]
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
Expand All @@ -60,6 +61,7 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref =
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }

kotlin-multiplatform-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
power-assert-gradle = { module = "org.jetbrains.kotlin.plugin.power-assert:org.jetbrains.kotlin.plugin.power-assert.gradle.plugin", version.ref = "kotlin" }
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }
detekt-gradle = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
Expand Down

0 comments on commit ecd497f

Please sign in to comment.