Podcini-podcast/common.gradle

110 lines
2.8 KiB
Groovy
Raw Permalink Normal View History

2024-02-05 21:50:43 +01:00
android {
defaultConfig {
minSdk 21
2024-02-14 07:09:48 +01:00
compileSdk 34
2024-02-05 21:50:43 +01:00
targetSdk 34
2024-02-14 07:09:48 +01:00
kotlinOptions {
jvmTarget = '17'
}
vectorDrawables.useSupportLibrary false
2024-02-05 21:50:43 +01:00
vectorDrawables.generatedDensities = []
2024-02-25 11:28:34 +01:00
testApplicationId "ac.mdiq.podcini.tests"
2024-02-05 21:50:43 +01:00
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard.cfg"
2024-02-20 11:30:25 +01:00
resValue "string", "app_name", "Podcini"
2024-02-05 21:50:43 +01:00
}
debug {
2024-02-20 11:30:25 +01:00
resValue "string", "app_name", "Podcini Debug"
2024-02-05 21:50:43 +01:00
}
}
packagingOptions {
resources {
excludes += ["META-INF/LICENSE.txt",
"META-INF/NOTICE.txt",
"META-INF/CHANGES",
"META-INF/README.md"]
}
}
compileOptions {
2024-02-14 07:09:48 +01:00
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
2024-02-05 21:50:43 +01:00
}
testOptions {
animationsDisabled = true
unitTests {
includeAndroidResources = true
}
}
lint {
disable "GradleDependency"
checkDependencies true
warningsAsErrors true
abortOnError true
checkGeneratedSources = true
}
buildFeatures {
viewBinding true
}
}
2024-02-14 07:09:48 +01:00
tasks.withType(Test).configureEach {
2024-02-05 21:50:43 +01:00
testLogging {
exceptionFormat "full"
events "skipped", "passed", "failed"
showStandardStreams true
displayGranularity 2
}
}
gradle.projectsEvaluated {
2024-02-14 07:09:48 +01:00
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs << "-Xlint"
}
2024-02-05 21:50:43 +01:00
}
}
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."))
}
}
}
}