-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
101 lines (83 loc) · 2.84 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
buildscript {
repositories {
jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.github.jeysal:gradle-graphviz-plugin:1.4.0'
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.6'
// asciidoctor-diagram PlantUML integration via jruby
id 'com.github.jruby-gradle.base' version '1.5.0'
}
// Since asciidocs are the only output of this subproject, assembly should include them
assemble.dependsOn asciidoctor
dependencies {
// override asciidoctor's old (1.7) jruby version
asciidoctor 'org.jruby:jruby-complete:9.1.13.0'
gems('rubygems:asciidoctor-diagram:1.5.4.1') {
exclude module: 'asciidoctor'
exclude module: 'thread_safe'
}
gems 'rubygems:asciidoctor-pdf:1.5.0.alpha.16'
gems 'rubygems:rouge:3.0.0'
}
asciidoctorj.version = '1.5.6'
jruby.execVersion '9.1.13.0'
// The gems are just utility for rendering diagrams, they do not belong in the outputDir
jrubyPrepare.outputDir = file('.gradle/gems')
import org.asciidoctor.gradle.AsciidoctorTask
import org.asciidoctor.gradle.ResourceCopyProxyImpl
import org.gradle.internal.FileUtils
// asciidoctor pdf task
task asciidoctorPdf(type: AsciidoctorTask) {
backends 'pdf'
}
assemble.dependsOn asciidoctor, asciidoctorPdf
// common asciidoctor config
[asciidoctor, asciidoctorPdf]*.configure {
dependsOn jrubyPrepare
requires = ['asciidoctor-diagram']
gemPath = jrubyPrepare.outputDir
sourceDir = file 'src'
sources {
include 'index.adoc'
}
outputDir = file("$outputDir")
separateOutputDirs = false
attributes imagesdir: "$outputDir/images",
outdir: outputDir
attributes encoding: 'utf-8',
lang: 'de',
toc: 'left',
'toc-title': 'Inhaltsverzeichnis',
'table-caption': 'Tabelle',
'figure-caption': 'Abbildung',
'appendix-caption': 'Anhang',
numbered: '',
sectnumlevels: 6,
toclevels: 3,
icons: 'font',
experimental: '',
'data-uri': '', // embed images directly in the html
'source-highlighter': it.name == 'asciidoctor' ? 'highlightjs': 'rouge',
'pdf-stylesdir': file('src/theme'),
'pdf-style': 'custom',
'pdf-fontsdir': file('src/fonts'),
'plantuml-config': file('plantuml.config.txt')
inputs.files 'src/theme', 'src/fonts', 'plantuml.config.txt'
// start out by copying resources ourselves as asciidoctor does it too late
doFirst {
new ResourceCopyProxyImpl(project).copy(
separateOutputDirs
? new File(outputDir, FileUtils.toSafeFileName(backend))
: outputDir,
resourceCopySpec
)
}
}
// portable Graphviz dot executable for asciidoctor-diagram
apply plugin: 'com.github.jeysal.graphviz'