forked from docToolchain/docToolchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
168 lines (158 loc) · 5.52 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import java.util.zip.ZipFile
/*
* This build file is part of the docToolchain
*/
plugins {
id "org.asciidoctor.convert" version "2.4.0"
id "org.aim42.htmlSanityCheck" version "1.1.6"
id "com.github.ben-manes.versions" version "0.42.0"
id "org.openapi.generator" version "4.3.1"
id "de.undercouch.download" version "5.0.2"
id 'org.jbake.site' version '5.5.0'
//gretty 4.0.0 does not work with java 8
id 'org.gretty' version '3.0.6'
}
apply plugin:'groovy'
dependencies {
testImplementation(
('junit:junit:4.13.2'),
('org.spockframework:spock-core:1.3-groovy-2.5'),
('com.athaydes:spock-reports:1.6.2'),
//('org.slf4j:slf4j-api:1.7.13'),
//('org.slf4j:slf4j-simple:1.7.13'),
gradleTestKit()
)
}
if (project.name!=rootProject.name) {
// disable all tasks which are not docToolchain tasks
// this avoids for example that task 'check' runs if invoked in main project
gradle.taskGraph.whenReady {
tasks.each { task ->
if (task.group in ['docToolchain', 'Documentation', 'docToolchain helper']
|| task.name in ['htmlSanityCheck', 'streamingExecute', 'tasks', 'clean']) {
task.enabled = true
} else {
task.enabled = false
}
}
}
if (docDir=='.') {
throw new Exception("""
You are running docToolchain as git submodule.
That is great!
Currently, it is still configured to build its own manual,
because the property docDir points to docToolchain itself.
Please configure docToolchain to point to your doc-sources.
You can do so by specifying it in your build.gradle or on the
command line. Example:
./gradlew generateHTML -PdocDir=../.
see https://docs-as-co.de/getstarted/tutorial2 for more details.
""")
}
}
//all available docToolchain modules
//the first is mandatory
apply from: 'scripts/AsciiDocBasics.gradle'
//the following are optional
apply from: 'scripts/fixEncoding.gradle'
apply from: 'scripts/prependFilename.gradle'
apply from: 'scripts/exportEA.gradle'
apply from: 'scripts/exportPPT.gradle'
apply from: 'scripts/exportVisio.gradle'
apply from: 'scripts/exportChangelog.gradle'
apply from: 'scripts/exportContributors.gradle'
apply from: 'scripts/exportJiraIssues.gradle'
apply from: 'scripts/exportJiraSprintChangelog.gradle'
apply from: 'scripts/exportExcel.gradle'
apply from: 'scripts/exportMarkdown.gradle'
apply from: 'scripts/pandoc.gradle'
apply from: 'scripts/publishToConfluence.gradle'
apply from: 'scripts/htmlSanityCheck.gradle'
apply from: 'scripts/collectIncludes.gradle'
apply from: 'scripts/exportMetrics.gradle'
apply from: 'scripts/exportOpenApi.gradle'
apply from: 'scripts/downloadTemplate.gradle'
apply from: 'scripts/generateSite.gradle'
apply from: 'scripts/copyThemes.gradle'
apply from: 'scripts/fixGlobalReferences.gradle'
task autobuildSite(
group: 'docToolchain',
description: 'linux: automatically re-build the static site every time a change in src/docs is detected') {
// this is a stub ony to show some help for the "tasks" task
// the real implementation can be found in /bin/doctoolchain
}
task prepareDist() {
doLast {
def distFolder = "dist/docToolchain-"+dtc_version
println "generate distribution for "+dtc_version
new File(buildDir, distFolder).mkdirs()
copy{
from new File("./bin")
into new File(buildDir, distFolder+"/bin")
}
copy{
from (new File("./gradle")) {
include "*"
include "**/*"
}
into new File(buildDir,distFolder+"/gradle")
}
copy{
from (new File("./resources")) {
include "*"
include "**/*"
}
into new File(buildDir,distFolder+"/resources")
}
copy{
from new File("./scripts")
into new File(buildDir,distFolder+"/scripts")
}
copy{
from (new File("./src/site")) {
include "*"
include "**/*"
}
into new File(buildDir,distFolder+"/src/site")
}
copy{
from (new File("./template_config")) {
include "*"
include "**/*"
}
into new File(buildDir,distFolder+"/template_config")
}
copy{
from (new File(".")) {
include '.gitmodules'
include 'build.gradle'
include 'gradle.properties'
include 'gradlew*'
include 'init.gradle'
include 'LICENCE'
include 'README.adoc'
include 'settings.gradle'
}
into new File(buildDir,distFolder+"/.")
}
}
}
task createDist(type: Zip, dependsOn: prepareDist) {
def distFolder = "dist"
from new File(buildDir,distFolder)
include '*'
include '**/*' //to include contents of a folder present inside Reports directory
archiveFileName = 'docToolchain-'+dtc_version+'.zip'
destinationDirectory = new File(buildDir, distFolder)
destinationDir(file(buildDir))
}
task downloadDependencies {
doLast {
configurations.findAll{it.canBeResolved}.each{it.resolve()}
}
}
// let's set a defaultTask for convenience
//defaultTasks 'exportChangeLog','exportJiraIssues','asciidoctor'
//defaultTasks 'generateHTML', 'htmlSanityCheck'
//defaultTasks 'exportMarkdown', 'exportContributors', 'generateHTML', 'htmlSanityCheck'
//copyDocs