mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2026-08-18 11:05:49 +00:00
### Description Migrate Gradle dependencies to version catalogs. This is the modern style of managing dependencies. Confirmed with diff on `./gradlew :app:dependencies` that no versions changed. ### Checklist <!-- To help us keep the issue tracker clean and work as efficient as possible, please make sure that you have done all of the following. You can tick the boxes below by placing an x inside the brackets like this: [x] --> - [x] I have read the contribution guidelines: https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md#submit-a-pull-request - [x] I have performed a self-review of my code, going through my changes line by line and carefully considering why this line change is necessary - [x] I have run the automated code checks using `./gradlew checkstyle lint` - [x] My code follows the style guidelines of the AntennaPod project: https://antennapod.org/contribute/develop/app/code-style - [x] I have mentioned the corresponding issue and the relevant keyword (e.g., "Closes: #xy") in the description (see https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) - [x] If it is a core feature, I have added automated tests
159 lines
4.7 KiB
Groovy
159 lines
4.7 KiB
Groovy
android {
|
|
compileSdk 36
|
|
|
|
defaultConfig {
|
|
minSdk 23
|
|
targetSdk 36
|
|
|
|
vectorDrawables.useSupportLibrary true
|
|
vectorDrawables.generatedDensities = []
|
|
|
|
testApplicationId "de.danoeh.antennapod.core.tests"
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
resourceConfigurations += ["en", "ar", "br", "ca", "cs", "da", "de", "el", "es", "et", "eu", "fa", "fi", "fr", "gl", "hi", "hu", "in", "it", "iw", "ja", "ko", "lt", "nb", "nl", "pl", "pt", "pt-rBR", "ro", "ru", "sc", "sk", "sl", "sr", "sv", "tr", "uk", "zh-rCN", "zh-rTW"]
|
|
|
|
buildConfigField "boolean", "USE_MEDIA3_PLAYBACK_SERVICE", "true"
|
|
manifestPlaceholders = [oldServiceEnabled: "false", newServiceEnabled: "true"]
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard.cfg"
|
|
resValue "string", "app_name", "AntennaPod"
|
|
}
|
|
debug {
|
|
resValue "string", "app_name", "AntennaPod Debug"
|
|
}
|
|
}
|
|
|
|
packagingOptions {
|
|
resources {
|
|
excludes += ["META-INF/LICENSE.txt",
|
|
"META-INF/NOTICE.txt",
|
|
"META-INF/CHANGES",
|
|
"META-INF/README.md"]
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_21
|
|
targetCompatibility JavaVersion.VERSION_21
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs.addAll([
|
|
"-Xlint:all,-deprecation,-serial,-this-escape,-unchecked,-processing,-classfile",
|
|
"-Werror",
|
|
])
|
|
}
|
|
|
|
testOptions {
|
|
animationsDisabled = true
|
|
unitTests {
|
|
includeAndroidResources = true
|
|
}
|
|
}
|
|
|
|
lint {
|
|
disable "GradleDependency", "OutdatedLibrary", "AndroidGradlePluginVersion", "CheckResult"
|
|
checkDependencies true
|
|
warningsAsErrors true
|
|
abortOnError true
|
|
checkGeneratedSources = true
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding true
|
|
buildConfig true
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// align all versions of kotlin transitive dependencies, see
|
|
// https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7
|
|
implementation platform(libs.kotlin.bom)
|
|
}
|
|
|
|
tasks.withType(Test).configureEach {
|
|
testLogging {
|
|
exceptionFormat "full"
|
|
events "skipped", "passed", "failed"
|
|
showStandardStreams true
|
|
displayGranularity 2
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.github.spotbugs'
|
|
|
|
spotbugs {
|
|
toolVersion = '4.8.6'
|
|
effort = 'max'
|
|
reportLevel = 'medium'
|
|
excludeFilter = rootProject.file('config/spotbugs/exclude.xml')
|
|
ignoreFailures = true // Handled by printing task
|
|
}
|
|
|
|
gradle.taskGraph.whenReady { taskGraph ->
|
|
taskGraph.allTasks.each { task ->
|
|
if (task.name.toLowerCase().contains('spotbugs')) {
|
|
task.doLast {
|
|
def reportFile = task.project.file("build/reports/spotbugs/debug.xml")
|
|
def reportFilePlay = task.project.file("build/reports/spotbugs/playDebug.xml")
|
|
|
|
if (reportFile.exists()) {
|
|
parseSpotBugsXml(task, reportFile)
|
|
}
|
|
if (reportFilePlay.exists()) {
|
|
parseSpotBugsXml(task, reportFilePlay)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def parseSpotBugsXml(task, xmlFile) {
|
|
def slurped = new groovy.xml.XmlSlurper().parse(xmlFile)
|
|
|
|
def foundErrors = false
|
|
slurped['BugInstance'].each { bug ->
|
|
logger.error "[SpotBugs] ${bug['LongMessage']} [${bug.@'type'}]"
|
|
bug['SourceLine'].each { line ->
|
|
logger.error "[SpotBugs] ${line['Message']}"
|
|
foundErrors = true
|
|
}
|
|
}
|
|
if (foundErrors) {
|
|
throw new TaskExecutionException(task,
|
|
new Exception("SpotBugs violations were found. See output above for details."))
|
|
}
|
|
}
|
|
|
|
apply plugin: 'checkstyle'
|
|
|
|
checkstyle {
|
|
toolVersion = '10.12.0'
|
|
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
|
|
ignoreFailures = false
|
|
showViolations = true
|
|
}
|
|
|
|
afterEvaluate {
|
|
tasks.matching { it.name == 'lint' }.configureEach {
|
|
dependsOn tasks.matching { t -> t.name == 'spotbugsDebug' }
|
|
dependsOn tasks.matching { t -> t.name == 'spotbugsPlayDebug' }
|
|
}
|
|
}
|
|
|
|
tasks.register('checkstyle', Checkstyle) {
|
|
group = "verification"
|
|
|
|
classpath = files()
|
|
source = fileTree('src/main/java') { include '**/*.java' }
|
|
if (file("src/free/java").exists()) source += fileTree("src/free/java") { include '**/*.java' }
|
|
if (file("src/play/java").exists()) source += fileTree("src/play/java") { include '**/*.java' }
|
|
|
|
exclude '**/gen/**'
|
|
exclude '**/R.java'
|
|
exclude '**/BuildConfig.java'
|
|
}
|