118 lines
3.5 KiB
Groovy
118 lines
3.5 KiB
Groovy
|
/*
|
||
|
* Copyright (C) 2023 MURENA SAS
|
||
|
* Copyright (C) 2022 E FOUNDATION
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||
|
buildscript {
|
||
|
ext.buildConfig = [
|
||
|
'compileSdk': 34,
|
||
|
'minSdk' : 26,
|
||
|
'targetSdk' : 33,
|
||
|
'version' : [
|
||
|
'major': 1,
|
||
|
'minor': 20,
|
||
|
'patch': 0,
|
||
|
],
|
||
|
]
|
||
|
|
||
|
ext.buildConfig.version['name'] = "${buildConfig.version.major}.${buildConfig.version.minor}.${buildConfig.version.patch}"
|
||
|
ext.buildConfig.version['fullName'] = "${buildConfig.version.name}-${buildConfig.version.build}"
|
||
|
ext.buildConfig.version['code'] = buildConfig.version.major * 1000000 + buildConfig.version.minor * 1000 + buildConfig.version.patch
|
||
|
|
||
|
// Load properties either from local.properties or system environment (on CI).
|
||
|
apply from: rootProject.file('load-properties.gradle')
|
||
|
|
||
|
repositories {
|
||
|
google()
|
||
|
mavenCentral()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
plugins {
|
||
|
alias libs.plugins.spotless
|
||
|
alias libs.plugins.detekt
|
||
|
alias libs.plugins.benmanes.versions
|
||
|
alias libs.plugins.kotlin.android apply false
|
||
|
alias libs.plugins.android.application apply false
|
||
|
alias libs.plugins.kotlin.kapt apply false
|
||
|
alias libs.plugins.androidx.navigation.safeargs apply false
|
||
|
alias libs.plugins.android.library apply false
|
||
|
}
|
||
|
|
||
|
allprojects {
|
||
|
//Support @JvmDefault, and @OptIn
|
||
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||
|
kotlinOptions {
|
||
|
freeCompilerArgs = ['-Xjvm-default=all', '-opt-in=kotlin.RequiresOptIn']
|
||
|
|
||
|
jvmTarget = "17"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
spotless {
|
||
|
kotlin {
|
||
|
target("**/*.kt")
|
||
|
ktlint("1.0.1")
|
||
|
}
|
||
|
format 'misc', {
|
||
|
// define the files to apply `misc` to
|
||
|
target '*.gradle', '*.md', '.gitignore'
|
||
|
|
||
|
// define the steps to apply to those files
|
||
|
trimTrailingWhitespace()
|
||
|
endWithNewline()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
subprojects {
|
||
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
||
|
kotlinOptions {
|
||
|
// Treat all Kotlin warnings as errors
|
||
|
allWarningsAsErrors = true
|
||
|
|
||
|
freeCompilerArgs += "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
|
||
|
jvmTarget = "17"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
detekt {
|
||
|
toolVersion = libs.versions.detekt
|
||
|
|
||
|
source = files(
|
||
|
"src/main/java"
|
||
|
)
|
||
|
|
||
|
config.setFrom("detekt.yml")
|
||
|
baseline = file("detekt-baseline.xml")
|
||
|
parallel = false
|
||
|
buildUponDefaultConfig = true
|
||
|
allRules = false
|
||
|
disableDefaultRuleSets = false
|
||
|
debug = false
|
||
|
ignoreFailures = false
|
||
|
basePath = projectDir
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Object propOrDef(String propertyName, Object defaultValue) {
|
||
|
def propertyValue = project.properties[propertyName]
|
||
|
return propertyValue != null ? propertyValue : defaultValue
|
||
|
}
|