mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 21:07:04 +05:30
refactor(build): extract out Lint config
This commit is contained in:
parent
468d363c65
commit
66ce35927a
2 changed files with 34 additions and 22 deletions
|
@ -10,10 +10,10 @@ package dev.msfjarvis.claw.gradle
|
|||
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
import com.android.build.api.dsl.LibraryExtension
|
||||
import com.android.build.api.dsl.Lint
|
||||
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
|
||||
import com.android.build.api.variant.LibraryAndroidComponentsExtension
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import dev.msfjarvis.claw.gradle.LintConfig.configureLint
|
||||
import org.gradle.android.AndroidCacheFixPlugin
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Plugin
|
||||
|
@ -61,33 +61,14 @@ class AndroidCommonPlugin : Plugin<Project> {
|
|||
unitTests.isReturnDefaultValues = true
|
||||
}
|
||||
}
|
||||
project.extensions.findByType<ApplicationExtension>()?.run { lint.configureLint(project) }
|
||||
project.extensions.findByType<LibraryExtension>()?.run { lint.configureLint(project) }
|
||||
project.extensions.findByType<ApplicationExtension>()?.lint?.configureLint(project)
|
||||
project.extensions.findByType<LibraryExtension>()?.lint?.configureLint(project)
|
||||
val catalog = project.extensions.getByType<VersionCatalogsExtension>()
|
||||
val libs = catalog.named("libs")
|
||||
project.dependencies.addProvider("lintChecks", libs.findLibrary("slack-compose-lints").get())
|
||||
}
|
||||
}
|
||||
|
||||
private fun Lint.configureLint(project: Project) {
|
||||
quiet = project.providers.environmentVariable("CI").isPresent
|
||||
abortOnError = true
|
||||
checkReleaseBuilds = true
|
||||
warningsAsErrors = true
|
||||
ignoreWarnings = false
|
||||
checkAllWarnings = true
|
||||
noLines = false
|
||||
showAll = true
|
||||
explainIssues = true
|
||||
textReport = false
|
||||
xmlReport = false
|
||||
htmlReport = true
|
||||
sarifReport = true
|
||||
enable += "ComposeM2Api"
|
||||
error += "ComposeM2Api"
|
||||
baseline = project.file("lint-baseline.xml")
|
||||
}
|
||||
|
||||
private fun Project.configureSlimTests() {
|
||||
// Disable unit test tasks on the release build type for Android Library projects
|
||||
extensions.findByType<LibraryAndroidComponentsExtension>()?.run {
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright © 2023 Harsh Shandilya.
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
package dev.msfjarvis.claw.gradle
|
||||
|
||||
import com.android.build.api.dsl.Lint
|
||||
import org.gradle.api.Project
|
||||
|
||||
object LintConfig {
|
||||
fun Lint.configureLint(project: Project) {
|
||||
quiet = project.providers.environmentVariable("CI").isPresent
|
||||
abortOnError = true
|
||||
checkReleaseBuilds = true
|
||||
warningsAsErrors = true
|
||||
ignoreWarnings = false
|
||||
checkAllWarnings = true
|
||||
noLines = false
|
||||
showAll = true
|
||||
explainIssues = true
|
||||
textReport = false
|
||||
xmlReport = false
|
||||
htmlReport = true
|
||||
sarifReport = true
|
||||
enable += "ComposeM2Api"
|
||||
error += "ComposeM2Api"
|
||||
baseline = project.file("lint-baseline.xml")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue