forked from bumptech/glide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
239 lines (211 loc) · 7.35 KB
/
build.gradle
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import se.bjurr.violations.gradle.plugin.ViolationsTask
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath libs.android.gradle
if (!hasProperty('DISABLE_ERROR_PRONE')) {
classpath libs.errorprone.gradle
}
classpath libs.proguard.gradle
classpath libs.violations
classpath libs.androidx.benchmark.gradle
classpath libs.kotlin.gradle
classpath libs.ksp.gradle
classpath libs.coroutines.binarycompat.gradle
classpath libs.dokka.gradle
classpath 'com.guardsquare:proguard-gradle:' + (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11) ? '7.3.2' : '7.1.0')
}
}
repositories {
google()
mavenCentral()
}
apply plugin: 'binary-compatibility-validator'
apply plugin: 'org.jetbrains.dokka'
apiValidation {
ignoredProjects += ["ksp", "test", "gallery", "integrationtest", "sqljournaldiskcache"]
nonPublicMarkers += ["com.bumptech.glide.integration.ktx.InternalGlideApi"]
}
// See http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html.
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
dokkaHtmlMultiModule.configure {
moduleName.set("Glide")
}
afterEvaluate {
tasks.named("dokkaHtmlMultiModule") {
pluginsMapConfiguration.set(
[
"org.jetbrains.dokka.base.DokkaBase": """{
"customStyleSheets": ["${projectDir.toString()}/static/logo-styles.css"],
"customAssets" : ["${projectDir.toString()}/static/logo-icon.svg", "${projectDir.toString()}/static/glide_circle_logo.png"]
}"""
]
)
}
}
subprojects { project ->
repositories {
google()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
gradlePluginPortal()
}
// Exclude packages not intended for public use.
if ([
"testutil",
"flickr",
"giphy",
"imgur",
"svg",
"gallery",
"contacturi",
"test",
"gif_decoder",
"gifencoder",
"compiler",
"benchmark",
"integrationtest",
"instrumentation",
"glide-parent",
"integration",
"samples",
"third_party"
].contains(project.getName())) {
afterEvaluate {
project.apply plugin: 'org.jetbrains.dokka'
project.tasks.dokkaHtmlPartial.enabled = false
}
} else {
afterEvaluate {
project.apply plugin: 'org.jetbrains.dokka'
project.tasks.dokkaHtmlPartial.configure {
dokkaSourceSets {
// Kotlin works out of the box
if (!project.plugins.hasPlugin("kotlin-android") && project.plugins.hasPlugin("com.android.library")) {
// Java Android modules
register("main") {
sourceRoots.from(project.android.sourceSets.main.java.srcDirs)
}
} else if (project.plugins.hasPlugin("java") && "ksp" != project.getName()) {
// Java only modules (ksp is not useful and uses multiple plugins)
register("main") {
sourceRoots.from(sourceSets.main.java.srcDirs)
}
}
}
}
}
}
afterEvaluate {
if (project.plugins.hasPlugin("com.android.application")) {
project.dependencies {
// Hack around some version mismatches: https://stackoverflow.com/questions/75263047/duplicate-class-in-kotlin-android
implementation(platform(libs.kotlin.bom))
}
}
}
tasks.withType(JavaCompile) {
// gifencoder is a legacy project that has a ton of warnings and is basically never
// modified, so we're not going to worry about cleaning it up.
// Imgur uses generated code from dagger that has warnings.
if ("gifencoder" != project.getName() && "imgur" != project.getName()) {
options.compilerArgs.addAll([
//Treat all warnings as errors.
"-Werror",
//Enable all warnings.
"-Xlint:all",
// Disable warnings about source 7 being obsolete.
"-Xlint:-options",
// Java expects every annotation to have a processor, but we use
// javax.annotation.Nullable, which doesn't have one.
"-Xlint:-processing",
// See https://github.com/google/dagger/issues/945
// and https://bugs.openjdk.java.net/browse/JDK-8190452
"-Xlint:-classfile",
// Disable deprecation warnings for ViewTarget/BaseTarget for now.
"-Xlint:-deprecation",
])
}
}
tasks.withType(Test) {
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
}
// Avoid issues like #2452.
tasks.withType(Jar) {
duplicatesStrategy = DuplicatesStrategy.FAIL
}
apply plugin: 'checkstyle'
checkstyle {
toolVersion = '8.45.1'
}
checkstyle {
configFile = rootProject.file('checkstyle.xml')
configProperties.checkStyleConfigDir = rootProject.rootDir
}
task checkstyle(type: Checkstyle) {
source 'src'
include '**/*.java'
exclude '**/gen/**'
// Caught by the violations plugin.
ignoreFailures = true
// empty classpath
classpath = files()
}
apply plugin: "se.bjurr.violations.violations-gradle-plugin"
task violations(type: ViolationsTask) {
minSeverity = 'INFO'
detailLevel = 'VERBOSE'
maxViolations = 0
diffMaxViolations = 0
// Formats are listed here: https://github.com/tomasbjerre/violations-lib
def dir = projectDir.absolutePath
violations = [
["PMD", dir, ".*/pmd/.*\\.xml\$", "PMD"],
["ANDROIDLINT", dir, ".*/lint-results\\.xml\$", "AndroidLint"],
["CHECKSTYLE", dir, ".*/checkstyle/.*\\.xml\$", "Checkstyle"],
]
}
afterEvaluate {
if (project.hasProperty("android")
&& project.name != 'pmd' ) {
android {
lint {
warningsAsErrors true
quiet true
// Caught by the violations plugin.
abortOnError false
}
// We don't need a BuildConfig constants class.
buildFeatures {
buildConfig = false
}
// Signing isn't relevant to a library. Our signing is done via
// a GPG key at upload time, there's no APK to sign.
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
}
if (project.tasks.findByName('check')) {
check.dependsOn('checkstyle')
check.finalizedBy violations
}
}
}