Fix Gradle deprecations (#6939)

This commit is contained in:
Taco 2024-02-25 07:39:44 -05:00 committed by GitHub
parent 55c72097b0
commit ef4af0d29d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 22 deletions

View File

@ -69,7 +69,7 @@ android {
}
androidResources {
additionalParameters "--no-version-vectors"
additionalParameters += ["--no-version-vectors"]
}
}
@ -150,7 +150,7 @@ if (project.hasProperty("antennaPodPlayPublisherCredentials")) {
}
}
task copyLicense(type: Copy) {
tasks.register('copyLicense', Copy) {
from "../LICENSE"
into "src/main/assets/"
rename { String fileName ->

View File

@ -65,7 +65,7 @@ checkstyle {
toolVersion '10.3.1'
}
task checkstyle(type: Checkstyle) {
tasks.register('checkstyle', Checkstyle) {
classpath = files()
source "${project.rootDir}"
exclude("**/gen/**")

View File

@ -56,7 +56,7 @@ android {
}
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
testLogging {
exceptionFormat "full"
events "skipped", "passed", "failed"
@ -66,8 +66,10 @@ tasks.withType(Test) {
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint"
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs << "-Xlint"
}
}
}
@ -80,24 +82,26 @@ spotbugs {
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)
gradle.taskGraph.whenReady { taskGraph ->
taskGraph.allTasks.each { 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
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."))
}
}
if (foundErrors) {
throw new TaskExecutionException(task,
new Exception("SpotBugs violations were found. See output above for details."))
}
}
}