-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
173 lines (141 loc) · 4.42 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
plugins {
id 'org.asciidoctor.convert' version '1.5.7'
id 'com.github.ben-manes.versions' version '0.17.0'
id "com.moowork.gulp" version "1.2.0"
id "com.moowork.node" version "1.2.0"
id "de.undercouch.download" version "3.3.0"
}
apply plugin: 'org.asciidoctor.convert'
import org.apache.tools.ant.filters.ConcatFilter
ext {
docsSources = new File(buildDir, "docs-sources")
docs = new File(buildDir, "docs")
src = new File("src")
srcGen = new File(buildDir, "src-gen")
userDocsDest = new File(src, "docs/user-documentation")
}
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
configurations {
docs_1_0_0 {
transitive = false
}
docs_1_1_0 {
transitive = false
}
docs_1_2_0 {
transitive = false
}
docs_1_3_0 {
transitive = false
}
docs_1_4_0 {
transitive = false
}
}
dependencies {
// 1.0.0
docs_1_0_0 "io.georocket:georocket-docs:1.0.0:sources"
docs_1_0_0 "io.georocket:georocket-client-api:1.0.0:javadoc"
docs_1_0_0 "io.georocket:georocket-server-api:1.0.0:javadoc"
// 1.1.0
docs_1_1_0 "io.georocket:georocket-docs:1.1.0:sources"
docs_1_1_0 "io.georocket:georocket-client-api:1.1.0:javadoc"
docs_1_1_0 "io.georocket:georocket-server-api:1.1.0:javadoc"
// 1.2.0
docs_1_2_0 "io.georocket:georocket-docs:1.2.0:sources"
docs_1_2_0 "io.georocket:georocket-client-api:1.2.0:javadoc"
docs_1_2_0 "io.georocket:georocket-server-api:1.2.0:javadoc"
// 1.3.0
docs_1_3_0 "io.georocket:georocket-docs:1.3.0:sources"
docs_1_3_0 "io.georocket:georocket-client-api:1.3.0:javadoc"
docs_1_3_0 "io.georocket:georocket-server-api:1.3.0:javadoc"
// 1.4.0-SNAPSHOT
docs_1_4_0 "io.georocket:georocket-docs:1.4.0-SNAPSHOT:sources"
docs_1_4_0 "io.georocket:georocket-client-api:1.4.0-SNAPSHOT:javadoc"
docs_1_4_0 "io.georocket:georocket-server-api:1.4.0-SNAPSHOT:javadoc"
}
gulp {
colors = true
}
node {
version = new File(projectDir, ".tool-versions").text.split(/\s+/)[1]
download = true
}
task wrapper(type: Wrapper) {
gradleVersion = '4.8.1'
}
task extractDocs {
doLast {
// extract each 'docs' artifact to a separate directory
[configurations.docs_1_0_0, configurations.docs_1_1_0,
configurations.docs_1_2_0, configurations.docs_1_3_0,
configurations.docs_1_4_0].each { cfg ->
cfg.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from zipTree(artifact.file)
into new File(new File(docsSources, artifact.name), artifact.moduleVersion.id.version)
}
}
}
}
}
task copyDocs(dependsOn: [extractDocs, asciidoctor]) {
doLast {
// copy latest version of user documentation
copy {
from new File(asciidoctor.outputDir, "html5/1.3.0")
into new File(srcGen, "georocket-docs-html")
}
// copy all versions of user documentation
copy {
from new File(asciidoctor.outputDir, "html5")
into new File(srcGen, "georocket-docs-html")
}
// copy client API
copy {
from new File(docsSources, "georocket-client-api")
into new File(docs, "api/client")
}
// copy server API
copy {
from new File(docsSources, "georocket-server-api")
into new File(docs, "api/server")
}
}
}
task prepareUserDocs(dependsOn: [copyDocs]) {
doLast {
copy {
from new File(srcGen, "georocket-docs-html")
into userDocsDest
}
}
}
task cleanUserDocs(type: Delete) {
delete userDocsDest
}
task cleanNodeModules(type: Delete) {
delete new File(projectDir, "node_modules")
}
asciidoctor {
sourceDir new File(docsSources, "georocket-docs")
options template_dirs: ["${projectDir}/asciidoctor-backends"]
resources {
from(sourceDir) {
include "**/images/*"
}
}
// disable idprefix and set id separator so that the Bootstrap scrollspy
// plugin correctly finds headings
attributes "idprefix": "", "idseparator": "-"
}
asciidoctor.dependsOn(extractDocs)
gulp_build.dependsOn copyDocs, prepareUserDocs, npm_install
assemble.dependsOn gulp_build
clean.dependsOn cleanUserDocs, cleanNodeModules
defaultTasks "build"