forked from mraible/infoq-mini-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
90 lines (74 loc) · 2.61 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0'
classpath 'com.bluepapa32:gradle-watch-plugin:0.1.5'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
classpath 'org.asciidoctor:asciidoctorj-epub3:1.5.0-alpha.6'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.11'
classpath 'org.jruby:jruby-complete:9.1.2.0'
}
}
apply plugin: 'java'
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.bluepapa32.watch'
version = '2.0.0-SNAPSHOT'
asciidoctorj {
version = '1.5.4.1'
}
import org.asciidoctor.gradle.AsciidoctorTask
def attrs = ['sourcedir' : '../../../main/webapp',
'source-highlighter': 'coderay',
'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' : '-']
tasks.withType(AsciidoctorTask) { task ->
attributes attrs
sources {
include 'index.adoc'
}
}
task html(type: AsciidoctorTask, description: 'Generates single page HTML') {
backends 'html5'
}
// NOTE please use ./generate-pdf.sh instead of this task for now
task prepress(type: AsciidoctorTask, description: 'Generates PDF for prepress printing') {
attributes attrs + ['media' : 'prepress', 'pdfmarks': '', 'pdf-theme': 'infoq-prepress']
requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
backends 'pdf'
outputDir "$buildDir/asciidoc/pdf-prepress"
separateOutputDirs false
}
// NOTE please use ./generate-pdf.sh screen instead of this task for now
task pdf(type: AsciidoctorTask, description: 'Generates PDF') {
attributes attrs + ['pdfmarks': '']
requires file('src/main/ruby/asciidoctor-pdf-extensions.rb')
backends 'pdf'
}
task epub(type: AsciidoctorTask, description: 'Generates EPUB3') {
backends 'epub3'
}
task mobi(type: AsciidoctorTask, description: 'Generates MOBI') {
backends 'epub3'
attrs.put('ebook-format', 'kf8')
attributes attrs
}
pdf.shouldRunAfter html
epub.shouldRunAfter pdf
//task all(dependsOn: ['html', 'pdf', 'epub', 'mobi'])
task all(dependsOn: ['html', 'epub', 'mobi'])
defaultTasks 'all'
watch {
asciidoc {
files fileTree(dir: 'src/docs/asciidoc', include: '**/*.adoc')
tasks 'asciidoctor'
}
}