mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
feat(build): apply Android Lint plugin to JVM modules
This commit is contained in:
parent
06528e7504
commit
237a06f1cf
2 changed files with 12 additions and 4 deletions
|
@ -1,14 +1,18 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2022 Harsh Shandilya.
|
* Copyright © 2022-2023 Harsh Shandilya.
|
||||||
* Use of this source code is governed by an MIT-style
|
* Use of this source code is governed by an MIT-style
|
||||||
* license that can be found in the LICENSE file or at
|
* license that can be found in the LICENSE file or at
|
||||||
* https://opensource.org/licenses/MIT.
|
* https://opensource.org/licenses/MIT.
|
||||||
*/
|
*/
|
||||||
package dev.msfjarvis.claw.gradle
|
package dev.msfjarvis.claw.gradle
|
||||||
|
|
||||||
|
import com.android.build.api.dsl.Lint
|
||||||
|
import com.android.build.gradle.LintPlugin
|
||||||
|
import dev.msfjarvis.claw.gradle.LintConfig.configureLint
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.apply
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.findByType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
|
||||||
|
|
||||||
@Suppress("Unused")
|
@Suppress("Unused")
|
||||||
|
@ -16,5 +20,7 @@ class KotlinJvmPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.pluginManager.apply(KotlinPluginWrapper::class)
|
project.pluginManager.apply(KotlinPluginWrapper::class)
|
||||||
project.pluginManager.apply(KotlinCommonPlugin::class)
|
project.pluginManager.apply(KotlinCommonPlugin::class)
|
||||||
|
project.pluginManager.apply(LintPlugin::class)
|
||||||
|
project.extensions.findByType<Lint>()?.configureLint(project, isJVM = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.android.build.api.dsl.Lint
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
|
||||||
object LintConfig {
|
object LintConfig {
|
||||||
fun Lint.configureLint(project: Project) {
|
fun Lint.configureLint(project: Project, isJVM: Boolean = false) {
|
||||||
quiet = project.providers.environmentVariable("CI").isPresent
|
quiet = project.providers.environmentVariable("CI").isPresent
|
||||||
abortOnError = true
|
abortOnError = true
|
||||||
checkReleaseBuilds = true
|
checkReleaseBuilds = true
|
||||||
|
@ -24,8 +24,10 @@ object LintConfig {
|
||||||
xmlReport = false
|
xmlReport = false
|
||||||
htmlReport = true
|
htmlReport = true
|
||||||
sarifReport = true
|
sarifReport = true
|
||||||
enable += "ComposeM2Api"
|
if (!isJVM) {
|
||||||
error += "ComposeM2Api"
|
enable += "ComposeM2Api"
|
||||||
|
error += "ComposeM2Api"
|
||||||
|
}
|
||||||
baseline = project.file("lint-baseline.xml")
|
baseline = project.file("lint-baseline.xml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue