forked from spring-projects/spring-restdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
202 lines (169 loc) · 5.07 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
plugins {
id 'io.spring.javaformat' version "$javaFormatVersion" apply false
id 'io.spring.nohttp' version '0.0.6.RELEASE' apply false
id 'maven-publish'
}
allprojects {
group = "org.springframework.restdocs"
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
}
}
apply plugin: "samples"
apply plugin: "io.spring.nohttp"
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
nohttp {
source.exclude "samples/rest-notes-slate/slate/source/javascripts/lib/_jquery*.js"
source.exclude "buildSrc/.gradle/**"
source.exclude "**/build/**"
source.exclude "**/target/**"
}
ext {
springVersion = "5.0.15.RELEASE"
javadocLinks = [
"https://docs.oracle.com/javase/8/docs/api/",
"https://docs.spring.io/spring-framework/docs/$springVersion/javadoc-api/",
"https://docs.jboss.org/hibernate/stable/beanvalidation/api/",
"https://docs.jboss.org/hibernate/stable/validator/api/"
] as String[]
}
subprojects { subproject ->
plugins.withType(JavaPlugin) {
subproject.apply plugin: "io.spring.javaformat"
subproject.apply plugin: "checkstyle"
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
internal {
canBeConsumed = false
canBeResolved = false
}
compileClasspath.extendsFrom(internal)
runtimeClasspath.extendsFrom(internal)
testCompileClasspath.extendsFrom(internal)
testRuntimeClasspath.extendsFrom(internal)
}
test {
testLogging {
exceptionFormat "full"
}
}
compileJava {
options.compilerArgs = [ "-Xlint:deprecation", "-Xlint:-options", "-Werror" ]
}
tasks.withType(JavaCompile) {
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 = "8.22"
}
dependencies {
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:$javaFormatVersion")
}
plugins.withType(MavenPublishPlugin) {
subproject.apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
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 = "1.8"
}
java {
withJavadocJar()
withSourcesJar()
}
}
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
}
samples {
dependOn "spring-restdocs-core:publishToMavenLocal"
dependOn "spring-restdocs-mockmvc:publishToMavenLocal"
dependOn "spring-restdocs-restassured:publishToMavenLocal"
dependOn "spring-restdocs-webtestclient:publishToMavenLocal"
dependOn "spring-restdocs-asciidoctor:publishToMavenLocal"
restNotesSpringHateoas {
workingDir "$projectDir/samples/rest-notes-spring-hateoas"
}
restNotesSpringDataRest {
workingDir "$projectDir/samples/rest-notes-spring-data-rest"
}
testNg {
workingDir "$projectDir/samples/testng"
}
restAssured {
workingDir "$projectDir/samples/rest-assured"
}
webTestClient {
workingDir "$projectDir/samples/web-test-client"
}
slate {
workingDir "$projectDir/samples/rest-notes-slate"
build false
}
junit5 {
workingDir "$projectDir/samples/junit5"
}
}
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 = "1.8"
splitIndex = true
use = true
windowTitle = "Spring REST Docs ${project.version} API"
}
}
}
task docsZip(type: Zip, dependsOn: [":docs:asciidoctor", ":api", ":restNotesSpringHateoasGradle"]) {
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"
}
from(api) {
into "api"
}
from(file("samples/rest-notes-spring-hateoas/build/docs/asciidoc")) {
into "samples/restful-notes"
}
}
publishing {
publications {
maven(MavenPublication) {
artifact docsZip
}
}
}