Files
AntennaPod/common.gradle
Hans-Peter Lehmann a0252f17e8 Upgrade target API version (#8286)
### Description

Upgrade target API version. For this, we need to upgrade robolectric and
transitively also the Java version and spotbugs version

### 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
- [x] I have run the automated code checks using `./gradlew checkstyle
spotbugsPlayDebug spotbugsDebug :app:lintPlayDebug`
- [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
2026-02-18 13:03:21 +01:00

131 lines
3.9 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
}
testOptions {
animationsDisabled = true
unitTests {
includeAndroidResources = true
}
}
lint {
disable "GradleDependency", "OutdatedLibrary", "AndroidGradlePluginVersion"
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("org.jetbrains.kotlin:kotlin-bom:1.9.24")
}
tasks.withType(Test).configureEach {
testLogging {
exceptionFormat "full"
events "skipped", "passed", "failed"
showStandardStreams true
displayGranularity 2
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs << "-Xlint"
}
}
}
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."))
}
}