generated from isaqb-org/advanced-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
104 lines (84 loc) · 3.05 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
104
import org.asciidoctor.gradle.jvm.AsciidoctorTask
import java.text.SimpleDateFormat
plugins {
id "org.asciidoctor.jvm.base" version "3.3.2"
id "org.asciidoctor.jvm.convert" version "3.3.2"
id "org.asciidoctor.jvm.pdf" version "3.3.2"
}
repositories {
mavenCentral()
}
asciidoctorj {
version = '2.5.3'
}
ext {
today = new Date()
versionDate = new SimpleDateFormat("yyyyMMdd").format(today)
releaseVersion = System.getenv("RELEASE_VERSION")
localVersion = "LocalBuild"
project.version = releaseVersion == null ? localVersion : releaseVersion;
curriculumFileName = "curriculum-cloudinfra"
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(WorkerExecutor we, String curriculumFileName, String versionDate, String language) {
super(we)
forkOptions {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}
sourceDir = new File("./docs/")
baseDir = new File ("./docs/")
sources {
include "index.adoc"
include "${curriculumFileName}.adoc"
}
outputDir = new File("./build/")
outputOptions {
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,
'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", "renderDE", "renderEN"
}
task renderDE(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "DE"]) {
doLast {
addSuffixToCurriculum("-de")
}
}
task renderEN(type: RenderCurriculumTask,
constructorArgs: [curriculumFileName, versionDate, "EN"]) {
doLast {
addSuffixToCurriculum("-en")
}
}
apply from: 'scripts/includeLearningObjectives.gradle'
defaultTasks "buildDocs"