summaryrefslogtreecommitdiff
path: root/build-logic/kotlin-plugins
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-07-17 00:55:12 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-07-17 13:56:54 +0530
commitc2faeffd840aaf3eec138e79151576f010a24f29 (patch)
tree4b79c7e9b34b6e6abd72cfe2cd767c4d2fbf961b /build-logic/kotlin-plugins
parent6ceedc049c1ca3cd2d18a612e96140d0d58f257e (diff)
detekt: init
Diffstat (limited to 'build-logic/kotlin-plugins')
-rw-r--r--build-logic/kotlin-plugins/build.gradle.kts1
-rw-r--r--build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt15
2 files changed, 16 insertions, 0 deletions
diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts
index d7e798b7..d891ec0d 100644
--- a/build-logic/kotlin-plugins/build.gradle.kts
+++ b/build-logic/kotlin-plugins/build.gradle.kts
@@ -60,6 +60,7 @@ gradlePlugin {
dependencies {
implementation(libs.build.agp)
implementation(libs.build.binarycompat)
+ implementation(libs.build.detekt)
implementation(libs.build.kotlin)
implementation(libs.build.r8)
implementation(libs.build.spotless)
diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt
index 50d67e52..7327e8af 100644
--- a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt
+++ b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt
@@ -5,12 +5,15 @@
package app.passwordstore.gradle
+import io.gitlab.arturbosch.detekt.DetektPlugin
+import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.logging.TestLogEvent
+import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -18,6 +21,18 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
class KotlinCommonPlugin : Plugin<Project> {
override fun apply(project: Project) {
+ project.pluginManager.apply(DetektPlugin::class.java)
+ project.extensions.configure<DetektExtension> {
+ parallel = true
+ ignoredBuildTypes = listOf("release")
+ ignoredFlavors = listOf("free")
+ basePath = project.layout.projectDirectory.toString()
+ baseline =
+ project.rootProject.layout.projectDirectory
+ .dir("detekt-baselines")
+ .file("${project.name}.xml")
+ .asFile
+ }
project.tasks.run {
withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_11.toString()