105 lines
2.7 KiB
Groovy
105 lines
2.7 KiB
Groovy
|
android {
|
||
|
compileSdk 34
|
||
|
|
||
|
defaultConfig {
|
||
|
minSdk 21
|
||
|
targetSdk 34
|
||
|
|
||
|
vectorDrawables.useSupportLibrary true
|
||
|
vectorDrawables.generatedDensities = []
|
||
|
|
||
|
testApplicationId "de.danoeh.antennapod.core.tests"
|
||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||
|
}
|
||
|
|
||
|
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_11
|
||
|
targetCompatibility JavaVersion.VERSION_11
|
||
|
}
|
||
|
|
||
|
testOptions {
|
||
|
animationsDisabled = true
|
||
|
unitTests {
|
||
|
includeAndroidResources = true
|
||
|
}
|
||
|
}
|
||
|
|
||
|
lint {
|
||
|
disable "GradleDependency"
|
||
|
checkDependencies true
|
||
|
warningsAsErrors true
|
||
|
abortOnError true
|
||
|
checkGeneratedSources = true
|
||
|
}
|
||
|
|
||
|
buildFeatures {
|
||
|
viewBinding true
|
||
|
}
|
||
|
}
|
||
|
|
||
|
tasks.withType(Test) {
|
||
|
testLogging {
|
||
|
exceptionFormat "full"
|
||
|
events "skipped", "passed", "failed"
|
||
|
showStandardStreams true
|
||
|
displayGranularity 2
|
||
|
}
|
||
|
}
|
||
|
|
||
|
gradle.projectsEvaluated {
|
||
|
tasks.withType(JavaCompile) {
|
||
|
options.compilerArgs << "-Xlint"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
apply plugin: 'com.github.spotbugs'
|
||
|
|
||
|
spotbugs {
|
||
|
effort = 'max'
|
||
|
reportLevel = 'medium'
|
||
|
excludeFilter = rootProject.file('config/spotbugs/exclude.xml')
|
||
|
ignoreFailures = true // Handled by printing task
|
||
|
}
|
||
|
|
||
|
gradle.taskGraph.beforeTask { task ->
|
||
|
if (task.name.toLowerCase().contains('spotbugs')) {
|
||
|
task.doLast {
|
||
|
def reportFile = task.project.file("build/reports/spotbugs/playDebug.xml")
|
||
|
if (!reportFile.exists()) return
|
||
|
def slurped = new groovy.xml.XmlSlurper().parse(reportFile)
|
||
|
|
||
|
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."))
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|