diff --git a/kt/aoc2024-exe/build.gradle.kts b/kt/aoc2024-exe/build.gradle.kts index a7f4837..8e9647c 100644 --- a/kt/aoc2024-exe/build.gradle.kts +++ b/kt/aoc2024-exe/build.gradle.kts @@ -24,7 +24,7 @@ kotlin { it.binaries.executable { entryPoint("com.github.ephemient.aoc2024.exe.main") } - } + }, ).onEach { it.compilations { create("bench") { @@ -66,6 +66,15 @@ kotlin { } } } + + val detektTaskNames = targets.flatMap { target -> + target.compilations.map { compilation -> + "detekt${target.targetName.capitalize()}${compilation.compilationName.capitalize()}" + } + } + tasks.check { + dependsOn(detektTaskNames) + } } dependencies { diff --git a/kt/aoc2024-lib/build.gradle.kts b/kt/aoc2024-lib/build.gradle.kts index 2ade09d..905bb7a 100644 --- a/kt/aoc2024-lib/build.gradle.kts +++ b/kt/aoc2024-lib/build.gradle.kts @@ -44,6 +44,15 @@ kotlin { } } } + + val detektTaskNames = targets.flatMap { target -> + target.compilations.map { compilation -> + "detekt${target.targetName.capitalize()}${compilation.compilationName.capitalize()}" + } + } + tasks.check { + dependsOn(detektTaskNames) + } } val jvmTestCompilation = kotlin.jvm().compilations.getByName("test") diff --git a/kt/build.gradle.kts b/kt/build.gradle.kts index b90aca3..8f8e53c 100644 --- a/kt/build.gradle.kts +++ b/kt/build.gradle.kts @@ -1,7 +1,15 @@ plugins { + base alias(libs.plugins.kotlin.multiplatform) apply false alias(libs.plugins.kotlin.plugin.allopen) apply false + alias(libs.plugins.detekt) alias(libs.plugins.kotlinx.benchmark) apply false } -group = "com.github.ephemient.aoc2024" +dependencies { + detektPlugins(libs.bundles.detekt.plugins) +} + +detekt { + source.from(allprojects.map { it.buildFile }) +} diff --git a/kt/config/detekt/detekt.yml b/kt/config/detekt/detekt.yml new file mode 100644 index 0000000..a1e6cd2 --- /dev/null +++ b/kt/config/detekt/detekt.yml @@ -0,0 +1,3 @@ +style: + MagicNumber: + active: false