Repository navigation
Expand file tree
/
Copy pathcommon.gradle
More file actions
160 lines (135 loc) · 4.8 KB
/
Copy pathcommon.gradle
File metadata and controls
160 lines (135 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
android {
compileSdk 36
enableKotlin false
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-optimize.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
resValues 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'
}