-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
96 lines (83 loc) · 2.49 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
plugins {
id 'java'
id 'org.asciidoctor.jvm.gems' version '4.0.4'
id 'org.asciidoctor.jvm.convert' version '4.0.4' apply false
id 'org.asciidoctor.jvm.pdf' version '4.0.4'
id 'org.asciidoctor.jvm.epub' version '4.0.4'
id 'se.patrikerdes.use-latest-versions' version '0.2.18'
id 'com.github.ben-manes.versions' version '0.52.0'
}
repositories {
mavenCentral()
ruby {
gems()
}
}
/**
* Take the version in version.txt as version for the project
*/
version = file('version.txt').text.trim()
asciidoctorj {
version = '2.5.7'
requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
modules {
pdf {
version '2.3.7'
}
}
}
import org.asciidoctor.gradle.jvm.AsciidoctorTask
def attrs = [
'sourcedir' : '../examples/',
'source-highlighter': 'rouge',
'epub3-stylesdir' : './styles/epub',
// NOTE don't include leading ./ because it messes up paths in the epub files
'imagesdir' : 'images',
'toc' : 'left',
'icons' : 'font',
'sectanchors' : '',
'idprefix' : '',
'idseparator' : '-',
'listing-caption' : 'Listing']
tasks.withType(AsciidoctorTask) { task ->
attributes attrs
sourceDir 'src/docs/asciidoc/modules/ROOT'
baseDirFollowsSourceDir()
sources {
include 'index.adoc'
}
}
task html(type: AsciidoctorTask, description: 'Generates single page HTML') {
outputDir "$buildDir/asciidoc/html5"
outputOptions {
backends 'html5'
}
}
task prepress(type: AsciidoctorTask, description: 'Generates PDF for prepress printing') {
attributes attrs + ['media': 'prepress', 'pdfmarks': '', 'pdf-theme': 'prepress', 'source-highlighter': '']
outputDir "$buildDir/asciidoc/pdf-prepress"
outputOptions {
backends 'pdf'
setSeparateOutputDirs false
}
}
task pdf(type: AsciidoctorTask, description: 'Generates PDF for download') {
attributes attrs + ['pdfmarks': '']
outputDir "$buildDir/asciidoc/pdf-screen"
outputOptions {
backends 'pdf'
setSeparateOutputDirs false
}
}
task epub(type: AsciidoctorTask, description: 'Generates EPUB3') {
attributes attrs + ['source-highlighter': 'coderay']
outputDir "$buildDir/asciidoc/epub3"
outputOptions {
backends 'epub3'
}
}
pdf.shouldRunAfter html
prepress.shouldRunAfter pdf
epub.shouldRunAfter prepress
task all(dependsOn: ['html', 'pdf', 'prepress', 'epub'])
defaultTasks 'all'