-
Notifications
You must be signed in to change notification settings - Fork 735
/
build.gradle
174 lines (153 loc) · 4.47 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
plugins {
id 'base'
id 'io.spring.javaformat' version "$javaFormatVersion" apply false
id 'io.spring.nohttp' version '0.0.11' apply false
id 'maven-publish'
}
allprojects {
group = "org.springframework.restdocs"
repositories {
mavenCentral()
maven {
url "https://repo.spring.io/milestone"
content {
includeGroup "io.micrometer"
includeGroup "io.projectreactor"
includeGroup "org.springframework"
}
}
if (version.endsWith('-SNAPSHOT')) {
maven { url "https://repo.spring.io/snapshot" }
}
}
}
apply plugin: "io.spring.nohttp"
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
nohttp {
source.exclude "buildSrc/.gradle/**"
source.exclude "**/build/**"
source.exclude "**/target/**"
}
ext {
javadocLinks = [
"https://docs.spring.io/spring-framework/docs/$springFrameworkVersion/javadoc-api/",
"https://docs.jboss.org/hibernate/validator/7.0/api/",
"https://jakarta.ee/specifications/bean-validation/3.0/apidocs/"
] as String[]
}
check {
dependsOn checkstyleNohttp
}
subprojects { subproject ->
plugins.withType(JavaPlugin) {
subproject.apply plugin: "io.spring.javaformat"
subproject.apply plugin: "checkstyle"
java {
sourceCompatibility = 17
targetCompatibility = 17
}
configurations {
all {
resolutionStrategy.cacheChangingModulesFor 0, "minutes"
}
internal {
canBeConsumed = false
canBeResolved = false
}
compileClasspath.extendsFrom(internal)
runtimeClasspath.extendsFrom(internal)
testCompileClasspath.extendsFrom(internal)
testRuntimeClasspath.extendsFrom(internal)
}
test {
testLogging {
exceptionFormat "full"
}
}
tasks.withType(JavaCompile) {
options.compilerArgs = [ "-Werror", "-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:rawtypes", "-Xlint:varargs", "-Xlint:options" ]
options.encoding = "UTF-8"
}
tasks.withType(Test) {
maxHeapSize = "1024M"
}
checkstyle {
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
configProperties = [ "checkstyle.config.dir" : rootProject.file("config/checkstyle") ]
toolVersion = "10.12.4"
}
dependencies {
checkstyle("com.puppycrawl.tools:checkstyle:${checkstyle.toolVersion}")
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
}
plugins.withType(MavenPublishPlugin) {
javadoc {
description = "Generates project-level javadoc for use in -javadoc jar"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = "Spring REST Docs $version"
options.docTitle = "${options.header} API"
options.links = javadocLinks
options.addStringOption "-quiet"
options.encoding = "UTF-8"
options.source = "17"
}
java {
withJavadocJar()
withSourcesJar()
}
}
}
plugins.withType(MavenPublishPlugin) {
subproject.apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
}
task api (type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
project.rootProject.gradle.projectsEvaluated {
Set<String> excludedProjects = ['spring-restdocs-asciidoctor']
Set<Project> publishedProjects = rootProject.subprojects.findAll { it != project}
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
.findAll { !excludedProjects.contains(it.name) }
.findAll { !it.name.startsWith('spring-boot-starter') }
dependsOn publishedProjects.javadoc
source publishedProjects.javadoc.source
classpath = project.files(publishedProjects.javadoc.classpath)
destinationDir = project.file "${buildDir}/docs/javadoc"
options {
author = true
docTitle = "Spring REST Docs ${project.version} API"
encoding = "UTF-8"
memberLevel = "protected"
outputLevel = "quiet"
source = "17"
splitIndex = true
use = true
windowTitle = "Spring REST Docs ${project.version} API"
}
}
}
task docsZip(type: Zip, dependsOn: [":docs:asciidoctor", ":api"]) {
group = "Distribution"
archiveBaseName = "spring-restdocs"
archiveClassifier = "docs"
description = "Builds -${archiveClassifier} archive containing API and reference documentation"
destinationDirectory = file("${project.buildDir}/distributions")
from(project.tasks.findByPath(":docs:asciidoctor")) {
into "reference/htmlsingle"
}
from(api) {
into "api"
}
}
publishing {
publications {
maven(MavenPublication) {
artifact docsZip
}
}
}