@@ -8,7 +8,8 @@ repositories {
8
8
}
9
9
10
10
dependencies {
11
- asciidoctor ' io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.2.RELEASE'
11
+ asciidoctor ' io.spring.asciidoctor:spring-asciidoctor-extensions:0.2.0.RELEASE'
12
+ asciidoctor " org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16"
12
13
testCompile project(' :spring-restdocs-mockmvc' )
13
14
testCompile project(' :spring-restdocs-restassured' )
14
15
testCompile project(' :spring-restdocs-webtestclient' )
@@ -19,13 +20,82 @@ dependencies {
19
20
testCompile ' org.junit.jupiter:junit-jupiter-api'
20
21
}
21
22
23
+ ext {
24
+ docResourcesVersion = ' 0.1.3.RELEASE'
25
+ }
26
+
22
27
tasks. findByPath(" artifactoryPublish" )?. enabled = false
23
28
24
- asciidoctor {
29
+ configurations {
30
+ docs
31
+ }
32
+
33
+ dependencies {
34
+ docs " io.spring.docresources:spring-doc-resources:${ docResourcesVersion} @zip"
35
+ }
36
+
37
+ task prepareAsciidocBuild (type : Sync ) {
38
+ dependsOn configurations. docs
39
+ // copy doc resources
40
+ from {
41
+ configurations. docs. collect { zipTree(it) }
42
+ }
43
+ // and doc sources
44
+ from " ../docs/src/docs/asciidoc/"
45
+ // to a build directory of your choice
46
+ into " $buildDir /asciidoc/assemble"
47
+ }
48
+
49
+ task copyExamples (type : Copy ) {
50
+ dependsOn prepareAsciidocBuild
51
+ from " ../docs/src/test/java"
52
+ into " $buildDir /asciidoc/assemble/examples/java"
53
+ }
54
+
55
+ task(' makePDF' , type : org.asciidoctor.gradle.AsciidoctorTask ){
56
+ dependsOn copyExamples
57
+ backends ' pdf'
58
+ sourceDir " $buildDir /asciidoc/assemble"
25
59
sources {
26
60
include ' index.adoc'
27
61
}
28
- attributes ' revnumber' : project. version,
29
- ' branch-or-tag' : project. version. endsWith(' SNAPSHOT' ) ? ' master' : " v${ project.version} "
30
- inputs. files(sourceSets. test. java)
62
+ options doctype : ' book' , eruby : ' erubis'
63
+ logDocuments = true
64
+ attributes ' icons' : ' font' ,
65
+ ' examples-dir' : ' examples/java' ,
66
+ ' sectanchors' : ' ' ,
67
+ ' sectnums' : ' ' ,
68
+ ' toc' : ' ' ,
69
+ ' source-highlighter' : ' coderay' ,
70
+ revnumber : project. version
71
+ }
72
+
73
+ asciidoctor {
74
+ dependsOn makePDF
75
+ backends ' html5'
76
+ sourceDir " $buildDir /asciidoc/assemble"
77
+ resources {
78
+ from(sourceDir) {
79
+ include ' images/*' , ' css/**' , ' js/**'
80
+ }
81
+ }
82
+ options doctype : ' book' , eruby : ' erubis'
83
+ logDocuments = true
84
+ attributes ' docinfo' : ' shared' ,
85
+ ' examples-dir' : ' examples/java' ,
86
+ // use provided stylesheet
87
+ stylesdir : " css/" ,
88
+ stylesheet : ' spring.css' ,
89
+ ' linkcss' : true ,
90
+ ' icons' : ' font' ,
91
+ ' sectanchors' : ' ' ,
92
+ // use provided highlighter
93
+ ' source-highlighter=highlight.js' ,
94
+ ' highlightjsdir=js/highlight' ,
95
+ ' highlightjs-theme=atom-one-dark-reasonable' ,
96
+ ' idprefix' : ' ' ,
97
+ ' idseparator' : ' -' ,
98
+ ' spring-version' : project. version,
99
+ ' allow-uri-read' : ' ' ,
100
+ revnumber : project. version
31
101
}
0 commit comments