mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Fixes for some Lint options have been deprecated in newer Gradle versions.
We have introduced a new method, configureCommonExtension, in the AllProjectConfigurer.kt file since Lint is only available in CommonExtension. This allows us to configure Lint in one place for every module. Previously, we couldn't directly use Lint in the android-library project, but with this approach, we can now configure Lint for the android-library project as well.
This commit is contained in:
parent
3049494e3d
commit
c18c9d7bba
@ -73,7 +73,7 @@ android {
|
|||||||
}
|
}
|
||||||
create("nightly") {
|
create("nightly") {
|
||||||
initWith(getByName("debug"))
|
initWith(getByName("debug"))
|
||||||
setMatchingFallbacks("debug")
|
matchingFallbacks += "debug"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bundle {
|
bundle {
|
||||||
|
@ -20,6 +20,7 @@ package plugin
|
|||||||
|
|
||||||
import Config
|
import Config
|
||||||
import Libs
|
import Libs
|
||||||
|
import com.android.build.api.dsl.CommonExtension
|
||||||
import com.android.build.gradle.BaseExtension
|
import com.android.build.gradle.BaseExtension
|
||||||
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
|
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
@ -42,7 +43,7 @@ class AllProjectConfigurer {
|
|||||||
target.plugins.apply("androidx.navigation.safeargs")
|
target.plugins.apply("androidx.navigation.safeargs")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun configureBaseExtension(target: Project, path: String) {
|
fun configureBaseExtension(target: Project) {
|
||||||
target.configureExtension<BaseExtension> {
|
target.configureExtension<BaseExtension> {
|
||||||
setCompileSdkVersion(Config.compileSdk)
|
setCompileSdkVersion(Config.compileSdk)
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@ -89,32 +90,6 @@ class AllProjectConfigurer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
|
||||||
isAbortOnError = true
|
|
||||||
isCheckAllWarnings = true
|
|
||||||
isWarningsAsErrors = true
|
|
||||||
|
|
||||||
ignore(
|
|
||||||
"SyntheticAccessor",
|
|
||||||
"GoogleAppIndexingApiWarning",
|
|
||||||
"LockedOrientationActivity",
|
|
||||||
//TODO stop ignoring below this
|
|
||||||
"LabelFor",
|
|
||||||
"LogConditional",
|
|
||||||
"ConvertToWebp",
|
|
||||||
"UnknownNullness",
|
|
||||||
"SelectableText",
|
|
||||||
"MissingTranslation",
|
|
||||||
"IconDensities",
|
|
||||||
"ContentDescription",
|
|
||||||
"IconDipSize",
|
|
||||||
"UnusedResources",
|
|
||||||
"NonConstantResourceId",
|
|
||||||
"NotifyDataSetChanged"
|
|
||||||
)
|
|
||||||
lintConfig = target.rootProject.file("lintConfig.xml")
|
|
||||||
}
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
resources.excludes.apply {
|
resources.excludes.apply {
|
||||||
add("META-INF/DEPENDENCIES")
|
add("META-INF/DEPENDENCIES")
|
||||||
@ -139,6 +114,36 @@ class AllProjectConfigurer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun configureCommonExtension(target: Project) {
|
||||||
|
target.configureExtension<CommonExtension<*, *, *, *>> {
|
||||||
|
lint {
|
||||||
|
abortOnError = true
|
||||||
|
checkAllWarnings = true
|
||||||
|
warningsAsErrors = true
|
||||||
|
|
||||||
|
disable.apply {
|
||||||
|
add("SyntheticAccessor")
|
||||||
|
add("GoogleAppIndexingApiWarning")
|
||||||
|
add("LockedOrientationActivity")
|
||||||
|
// TODO stop ignoring below this
|
||||||
|
add("LabelFor")
|
||||||
|
add("LogConditional")
|
||||||
|
add("ConvertToWebp")
|
||||||
|
add("UnknownNullness")
|
||||||
|
add("SelectableText")
|
||||||
|
add("MissingTranslation")
|
||||||
|
add("IconDensities")
|
||||||
|
add("ContentDescription")
|
||||||
|
add("IconDipSize")
|
||||||
|
add("UnusedResources")
|
||||||
|
add("NonConstantResourceId")
|
||||||
|
add("NotifyDataSetChanged")
|
||||||
|
}
|
||||||
|
lintConfig = target.rootProject.file("lintConfig.xml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun configureJacoco(target: Project) {
|
fun configureJacoco(target: Project) {
|
||||||
target.configurations.all {
|
target.configurations.all {
|
||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
|
@ -48,6 +48,7 @@ class KiwixConfigurationPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun doDefaultConfiguration(target: Project) {
|
private fun doDefaultConfiguration(target: Project) {
|
||||||
allProjectConfigurer.configureBaseExtension(target, "${target.projectDir}")
|
allProjectConfigurer.configureBaseExtension(target)
|
||||||
|
allProjectConfigurer.configureCommonExtension(target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ android {
|
|||||||
applicationId = "org.kiwix"
|
applicationId = "org.kiwix"
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions("default")
|
flavorDimensions += "default"
|
||||||
productFlavors.apply {
|
productFlavors.apply {
|
||||||
CustomApps.createDynamically(project.file("src"), this)
|
CustomApps.createDynamically(project.file("src"), this)
|
||||||
all {
|
all {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user