-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
157 lines (123 loc) · 3.85 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
buildscript {
dependencies {
classpath 'io.github.swagger2markup:swagger2markup-gradle-plugin:1.3.3'
classpath 'com.google.guava:guava:20.0'
}
}
plugins {
id 'org.springframework.boot' version '2.2.6.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id "io.freefair.lombok" version "4.1.6"
id 'java'
id("org.asciidoctor.jvm.convert") version "3.2.0"
id("org.asciidoctor.jvm.pdf") version "3.2.0"
id 'maven-publish'
id "org.datlowe.maven-publish-auth" version "2.0.2"
id 'com.gradle.plugin-publish' version '0.12.0'
id "com.sonalake.swagger-changelog" version "1.0.3"
}
apply plugin: 'io.github.swagger2markup'
group = 'com.sonalake'
version = '0.0.2-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
ext {
asciiDocOutputDir = file("${buildDir}/asciidoc/generated")
swaggerOutputDir = file("${buildDir}/swagger")
snippetsOutputDir = file("${buildDir}/generated-snippets")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc:2.0.4.RELEASE'
testImplementation 'capital.scalable:spring-auto-restdocs-core:2.0.8'
}
test {
systemProperties = System.properties
systemProperty 'sg.api.version', version
useJUnitPlatform()
}
// for docs
convertSwagger2markup {
dependsOn test
swaggerInput "${swaggerOutputDir}/swagger.json"
outputDir asciiDocOutputDir
config = [
'swagger2markup.pathsGroupedBy' : 'TAGS',
'swagger2markup.extensions.springRestDocs.snippetBaseUri': snippetsOutputDir.getAbsolutePath()
]
}
swaggerChangeLog {
groupId = "${rootProject.group}"
artifactId = "${rootProject.name}-API"
// where to find the nexus repo
nexusHome = 'http://atlanta.sonalake.corp:8081/nexus'
// where to store the changelog
targetdir = "${buildDir}/asciidoc/generated/changelog"
snapshotVersionFile = "${buildDir}/swagger/swagger.json"
}
// create a PDF from the asciidoc
asciidoctorPdf {
dependsOn convertSwagger2markup
dependsOn generateChangeLog
baseDirFollowsSourceDir()
sources {
include 'api-guide.adoc'
}
attributes = [
doctype : 'book',
toc : 'left',
toclevels : '3',
numbered : '',
sectlinks : '',
sectanchors : '',
hardbreaks : '',
generated : '../../../build/asciidoc/generated',
resources : '../../../src/main/resources',
snippets : '../../../build/generated-snippets',
changes : '../../../build/asciidoc/generated/changelog',
imagesdir : 'theme',
'pdf-stylesdir': 'theme',
'pdf-style' : 'simple-theme.yml',
revnumber : version
]
}
publishing {
publications {
swaggerPublication(MavenPublication) {
artifact "build/swagger/swagger.json"
pom {
description = 'The API guide for the autodoc project'
artifactId = "${rootProject.name}-API"
packaging = "json"
}
}
apiGuidePublication(MavenPublication) {
artifact "build/docs/asciidocPdf/api-guide.pdf"
pom {
description = 'The API guide for the autodoc project'
artifactId = "${rootProject.name}-APIDOC"
packaging = "pdf"
}
}
}
repositories {
maven {
def rootUrl = "http://atlanta.sonalake.corp:8081/nexus/content/repositories"
name = version.endsWith("SNAPSHOT") ? 'snapshots' : 'releases'
url "$rootUrl/$name"
}
}
}
tasks.withType(PublishToMavenRepository) { it.dependsOn asciidoctorPdf }