-
Notifications
You must be signed in to change notification settings - Fork 7.3k
/
build.gradle
125 lines (110 loc) · 3.52 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
import net.ltgt.gradle.errorprone.CheckSeverity
buildscript {
dependencies {
classpath libs.androidPlugin
classpath libs.kotlin.gradlePlugin
classpath libs.kotlin.serializationPlugin
classpath libs.dokkaPlugin
classpath libs.gradleMavenPublishPlugin
classpath libs.spotlessPlugin
classpath libs.errorpronePlugin
classpath libs.animalSnifferPlugin
classpath libs.protobufPlugin
}
repositories {
mavenCentral()
google()
gradlePluginPortal()
}
}
subprojects {
tasks.withType(JavaCompile).configureEach { task ->
task.options.encoding = 'UTF-8'
}
plugins.withType(JavaBasePlugin).configureEach {
java.toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
tasks.withType(Test).configureEach {
testLogging {
if (System.getenv("CI") == "true") {
events = ["failed", "skipped", "passed"]
}
exceptionFormat "full"
}
}
apply plugin: 'net.ltgt.errorprone'
dependencies {
errorproneJavac libs.errorproneJavac
errorprone libs.errorproneCore
}
tasks.withType(JavaCompile).configureEach { task ->
task.options.errorprone {
excludedPaths = '.*/build/generated/source/proto/.*'
check('MissingFail', CheckSeverity.ERROR)
check('MissingOverride', CheckSeverity.ERROR)
check('UnusedException', CheckSeverity.ERROR)
check('UnusedMethod', CheckSeverity.ERROR)
check('UnusedNestedClass', CheckSeverity.ERROR)
check('UnusedVariable', CheckSeverity.ERROR)
check('WildcardImport', CheckSeverity.ERROR)
}
}
plugins.withId('java-library') {
project.apply plugin: 'ru.vyarus.animalsniffer'
animalsniffer {
sourceSets = [sourceSets.main] // Only check main sources, ignore test code.
}
dependencies {
signature 'org.codehaus.mojo.signature:java18:1.0@signature'
if (project.path != ':retrofit-converters:java8' &&
project.path != ':retrofit-converters:jaxb' &&
project.path != ':retrofit-converters:jaxb3' &&
project.path != ':retrofit-adapters:java8') {
signature 'net.sf.androidscents.signature:android-api-level-21:5.0.1_r2@signature'
}
}
plugins.apply('com.diffplug.spotless')
spotless {
java {
googleJavaFormat(libs.googleJavaFormat.get().version)
.formatJavadoc(false)
removeUnusedImports()
target 'src/*/java*/**/*.java'
}
kotlin {
ktlint(libs.ktlint.get().version)
.editorConfigOverride([
// Making something an expression body should be a choice around readability.
'ktlint_standard_function-expression-body': 'disabled',
])
target 'src/**/*.kt'
}
}
}
}
tasks.create('clean', Delete) {
delete = layout.buildDirectory
}
tasks.create('prepareWebsite', Copy) {
description = 'Combines the static website along with generated documentation'
group = JavaBasePlugin.DOCUMENTATION_GROUP
into layout.buildDirectory.dir('docs/site')
from('website')
gradle.projectsEvaluated {
into('2.x') {
subprojects { subproject ->
if (subproject.name == 'retrofit-bom') return
if (!subproject.plugins.hasPlugin('com.vanniktech.maven.publish')) return
into(subproject.POM_ARTIFACT_ID) {
if (subproject.plugins.hasPlugin('org.jetbrains.dokka')) {
from subproject.tasks.named('dokkaHtml').flatMap { it.outputDirectory }
} else {
from subproject.tasks.named('javadoc').map { it.destinationDir }
}
}
}
}
}
}