This repository has been archived by the owner on Dec 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
140 lines (109 loc) · 3.34 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/***
* arc42 - quality requirements examples - gradle build script
=============================================================
*
* This is free software without any guarantees. Use at your own risk.
*
* See licence.txt for details.
*
*
* Credits:
* Peter Niederwieser, for instructions on how to:
* - call shell commands from gradle:
* http://forums.gradle.org/gradle/topics/how_to_execute_shell_command_source_or_dot_doestnt_work_with_exec
***************************************************************/
buildscript {
repositories {
jcenter()
}
dependencies {
// upgrade to latest jruby version due to a bugfix needed for Windows 10.
// can be removed, when asciidoctorj uses this as a default version.
classpath('org.jruby:jruby-complete:9.1.13.0')
// classpath('org.asciidoctor:asciidoctorj-epub3:1.5.0-alpha.16')
classpath('org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16')
classpath('org.asciidoctor:asciidoctorj-diagram:1.5.4.1')
}
}
plugins {
id 'org.asciidoctor.convert' version '1.5.3'
}
apply plugin: 'org.asciidoctor.convert'
ext {
srcDir = "$projectDir/src/asciidoc"
targetDir = "$buildDir"
}
asciidoctorj {
version = '1.5.6'
}
asciidoctor {
outputDir = file( targetDir )
sourceDir = file("$srcDir")
println "outputDir = " + outputDir
println "sourceDir = " + sourceDir
// enable the Asciidoctor Diagram extension
requires 'asciidoctor-diagram'
separateOutputDirs = false
sources { include "index.adoc" }
backends 'html5' , 'pdf' , 'docbook' //, 'epub3'
attributes = [
'release-branch': 'main',
'outputFile': "$outputDir/quality-requirements.pdf",
'source-highlighter': 'coderay',
'tabsize': '4',
'toc': 'left',
'icons': 'font',
'sectlink': true,
'sectanchors': true,
'idprefix': '',
'idseparator': '-',
'doctype': 'book',
'toclevels': 3,
'imagesdir': './images',
'homepage': 'http://github.com/arc42/quality-requirements',
'icons': 'font',
'numbered': true,
'version': project.version
]
resources {
// include architecture diagrams
from("${projectDir}/src/asciidoc") {
include 'images/**'
}
}
} // asciidoctor
task generateDocx( dependsOn: 'asciidoctor', type: Exec) {
description =
"""
Executing shell commands does currently NOT work from within
the IntelliJ JetGradle environment.
"""
executable "sh"
// calling pandoc over sh directly from gradle does not produce any output,
// therefore I delegated docx creation to a shell script.
args "create_docx_with_pandoc.sh"
}
task copyReleaseAssets(dependsOn: 'generateDocx', type: Copy) {
from(layout.buildDirectory) {
include '**/*.*'
exclude 'toArchive'
}
into layout.buildDirectory.dir("toArchive")
}
task createReleaseBundle( dependsOn: 'copyReleaseAssets', type: Zip) {
description =
"""
Create a ZIP file with all release assets.
"""
archiveFileName = "${project.name}.zip"
destinationDirectory = layout.buildDirectory.dir('dist')
from layout.buildDirectory.dir("toArchive")
}
task prepareGithubPagesContent(dependsOn: 'generateDocx', type: Copy) {
from(layout.buildDirectory) {
include 'images/**/*.*'
include '*.html'
}
into layout.buildDirectory.dir("gh-pages")
}
defaultTasks 'generateDocx'