Skip to content

Commit

Permalink
Enable lint in all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ansman committed Sep 30, 2023
1 parent 9f6003c commit ebd7ff5
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions gradle-plugin/src/main/kotlin/library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.adarshr.gradle.testlogger.TestLoggerExtension
import com.adarshr.gradle.testlogger.theme.ThemeType
import com.android.build.api.dsl.CommonExtension
import com.android.build.api.dsl.Lint
import com.android.build.api.variant.AndroidComponentsExtension
import com.android.build.api.variant.HasAndroidTestBuilder
import com.android.build.api.variant.HasTestFixturesBuilder
Expand Down Expand Up @@ -43,6 +44,17 @@ tasks.withType<Test>().configureEach {
maxParallelForks = Runtime.getRuntime().availableProcessors() / 2
}

fun Lint.configure() {
abortOnError = true
warningsAsErrors = true
checkReleaseBuilds = false
disable.addAll(setOf(
"GradleDependency",
"AndroidGradlePluginVersion",
"MissingApplicationIcon",
))
}

pluginManager.withPlugin("com.android.base") {
extensions.getByType(CommonExtension::class).apply {
compileSdk = libs.versions.android.compileSdk.get().toInt()
Expand All @@ -64,9 +76,7 @@ pluginManager.withPlugin("com.android.base") {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

if (pluginManager.hasPlugin("com.android.application")) {
lint.configure()
}

extensions.getByType(AndroidComponentsExtension::class).apply {
Expand All @@ -93,6 +103,7 @@ pluginManager.withPlugin("com.android.base") {
}

pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
pluginManager.apply("com.android.lint")
tasks.withType<Test>().configureEach {
useJUnitPlatform()
systemProperties(
Expand All @@ -106,6 +117,7 @@ pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
dependencies {
"testImplementation"(libs.bundles.jvmTesting)
}
the<Lint>().configure()
}

plugins.withType<JavaBasePlugin>().configureEach {
Expand Down

0 comments on commit ebd7ff5

Please sign in to comment.