aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'build-logic/src/main/kotlin')
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt8
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt2
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt6
3 files changed, 14 insertions, 2 deletions
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt
index 04a2dc7a..c337d9d5 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt
@@ -7,9 +7,11 @@ import com.android.build.api.dsl.LibraryExtension
import com.android.build.gradle.TestedExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
+import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.findByType
+import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType
object AndroidCommon {
@@ -56,5 +58,11 @@ object AndroidCommon {
}
project.extensions.findByType<ApplicationExtension>()?.run { lint.configureLint(project) }
project.extensions.findByType<LibraryExtension>()?.run { lint.configureLint(project) }
+ val catalog = project.extensions.getByType<VersionCatalogsExtension>()
+ val libs = catalog.named("libs")
+ project.dependencies.addProvider(
+ "lintChecks",
+ libs.findLibrary("thirdparty-compose-lints").get()
+ )
}
}
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt
index 253c7aed..c5cf84a0 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinJVMLibrary.kt
@@ -23,6 +23,6 @@ class KotlinJVMLibrary : Plugin<Project> {
apply(LintPlugin::class)
apply(KotlinCommonPlugin::class)
}
- project.extensions.configure<Lint> { configureLint(project) }
+ project.extensions.configure<Lint> { configureLint(project, isJVM = true) }
}
}
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt
index 41bb781f..de63c580 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/LintConfig.kt
@@ -4,7 +4,7 @@ import com.android.build.api.dsl.Lint
import org.gradle.api.Project
object LintConfig {
- fun Lint.configureLint(project: Project) {
+ fun Lint.configureLint(project: Project, isJVM: Boolean = false) {
quiet = project.providers.environmentVariable("CI").isPresent
abortOnError = true
checkReleaseBuilds = true
@@ -28,6 +28,10 @@ object LintConfig {
disable += "TypographyQuotes"
// False-positives abound due to use of ViewBinding
disable += "UnusedIds"
+ if (!isJVM) {
+ enable += "ComposeM2Api"
+ error += "ComposeM2Api"
+ }
baseline = project.file("lint-baseline.xml")
}
}