forked from isaqb-org/curriculum-flex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
103 lines (88 loc) · 2.83 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
import org.asciidoctor.gradle.AsciidoctorTask
import java.text.SimpleDateFormat
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.asciidoctor:asciidoctorj-pdf:1.5.3"
}
}
plugins {
id "org.asciidoctor.convert" version "1.6.0"
}
ext {
today = new Date()
versionDate = new SimpleDateFormat("yyyyMMdd").format(today)
project.version = project.file("./document.version").text
curriculumFileName = "curriculum-flex"
addSuffixToCurriculum = { suffix ->
for (extension in ["html", "pdf"]) {
File source = new File("${buildDir}/${curriculumFileName}.${extension}")
File target = new File("${buildDir}/${curriculumFileName}${suffix}.${extension}")
source.renameTo(target)
}
}
}
class RenderCurriculumTask extends AsciidoctorTask {
@Inject
RenderCurriculumTask(String curriculumFileName, String versionDate, String language, boolean withRemarks) {
sourceDir = new File("./docs/")
sources {
include "index.adoc"
include "${curriculumFileName}.adoc"
}
outputDir = new File("./build/")
separateOutputDirs = false
backends 'pdf', 'html5'
def fileVersion = project.version.trim() + "-" + language
attributes = [
'icons' : 'font',
'version-label' : '',
'revnumber' : fileVersion,
'revdate' : versionDate,
'document-version' : fileVersion + "-" + versionDate,
'currentDate' : versionDate,
'language' : language,
'withRemarks' : withRemarks,
'curriculumFileName': curriculumFileName,
'debug_adoc' : false,
'pdf-stylesdir' : '../pdf-theme/themes',
'pdf-fontsdir' : '../pdf-theme/fonts',
'pdf-style' : 'isaqb',
'stylesheet' : '../html-theme/adoc-github.css',
'stylesheet-dir' : '../html-theme'
]
}
}
task buildDocs {
group 'Documentation'
description 'Grouping task for generating all languages in several formats'
dependsOn "includeLearningObjectives", "renderNoRemarksDE", "renderNoRemarksEN"
}
task renderNoRemarksDE(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "DE", false]) {
doLast {
addSuffixToCurriculum("-de")
}
}
task renderWithRemarksDE(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "DE", true]) {
doLast {
addSuffixToCurriculum("-remarks-de")
}
}
task renderNoRemarksEN(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "EN", false]) {
doLast {
addSuffixToCurriculum("-en")
}
}
task renderWithRemarksEN(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "EN", true]) {
doLast {
addSuffixToCurriculum("-remarks-en")
}
}
apply from: 'scripts/includeLearningObjectives.gradle'
defaultTasks "buildDocs"