-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebsite.gradle
173 lines (146 loc) · 4.75 KB
/
website.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
169
170
171
172
173
// The project is built with sbt.
//
// This gradle file builds the website
buildscript {
repositories {
mavenCentral()
maven { url "https://maven.restlet.talend.com" }
}
dependencies {
classpath group: 'org.docbook', name: 'docbook-xslt2', version: docbookXsltVersion
classpath group: 'com.xmlcalabash', name: 'xmlcalabash1-print', version: '1.1.4'
classpath group: 'com.xmlcalabash', name: 'xmlcalabash1-gradle', version: '1.1.2'
}
}
plugins {
id "scala"
id "maven"
id "de.undercouch.download" version "2.0.0"
}
configurations {
website
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://maven.restlet.org" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
apply plugin: 'org.docbook.task'
apply plugin: 'com.xmlcalabash.task'
import org.docbook.DocBookTask
import com.xmlcalabash.XMLCalabashTask
import de.undercouch.gradle.tasks.download.Download
project.ext.docbookXslt = "docbook-xslt2-$docbookXsltVersion"
defaultTasks 'website'
// Travis-CI seems to be having trouble downloading from http://cdn.docbook.org
// I wonder if it's refusing to download fro a plain http: URI?
// Anyway, the workaround is just to checkin the artifact for the time being.
task downloadDocBook(type: Copy) {
from 'src/website/resources'
into 'build'
}
task reallyDownloadDocBook(type: Download) {
src docbookXsltBaseUri + '/release/' + docbookXsltVersion + '/' + docbookXslt + '.zip'
dest new File(buildDir, docbookXslt + '.zip')
}
downloadDocBook.onlyIf { !file("$buildDir/${docbookXslt}.zip").exists() }
task setupDocBook(dependsOn: downloadDocBook, type: Copy) {
from zipTree(new File(buildDir, docbookXslt + '.zip'))
//from zipTree(downloadDocBook.dest)
into { "build" }
doLast {
copy {
from "build/$docbookXslt"
into 'build/docbook'
}
}
}
setupDocBook.onlyIf { !file("$buildDir/docbook").exists() }
// All of the hand-authored pages
def pages = [
'pages/index',
'pages/contact',
'pages/pipelines/index',
'pages/apis/index',
'pages/apis/pipelines',
'pages/apis/vocabulary',
'pages/apis/steps'
]
// Create a task for each page to update it if necessary
pages.each { page ->
task "$page" (dependsOn: ['menus','gitlog','copyrsrcs','setupDocBook'],
type: XMLCalabashTask) {
inputs.file "src/website/${page}.xml"
inputs.file "srcw/website/etc/menu.xml"
inputs.file "src/website/style/webpage.xpl"
inputs.file "src/website/style/webpage.xsl"
outputs.file "build/menus/PLACEHOLDER.html"
outputs.file "build/${page}.html"
input("source", "src/website/${page}.xml")
output("result", "build/${page}.html")
pipeline "src/website/style/webpage.xpl"
}
}
// The task that updates all of the page headers
task menus(type: XMLCalabashTask) {
inputs.file "src/website/etc/menu.xml"
inputs.file "src/website/style/menus.xsl"
inputs.file "src/website/style/menus.xpl"
outputs.file "build/menus/PLACEHOLDER.html"
input("source", "src/website/etc/menu.xml")
output("result", "build/menus/PLACEHOLDER.html")
pipeline "src/website/style/menus.xpl"
}
task builddirs {
doFirst {
mkdir("build")
mkdir("build/pages")
mkdir("build/pages/css")
mkdir("build/pages/images")
mkdir("build/pages/graphics")
}
}
// Copy a bunch of files
task copyrsrcs(dependsOn: ['copycss','copyjs','copyimages','copygraphics','copypages']) {
// nop
}
task copycss(dependsOn: builddirs, type: Copy) {
from 'src/website/css'
into 'build/pages/css'
}
task copyjs(dependsOn: builddirs, type: Copy) {
from 'src/website/js'
into 'build/pages/js'
}
task copyimages(dependsOn: builddirs, type: Copy) {
from 'src/website/images'
into 'build/pages/images'
}
task copygraphics(dependsOn: builddirs, type: Copy) {
from 'src/website/graphics'
into 'build/pages/graphics'
}
task copypages(dependsOn: builddirs, type: Copy) {
from 'src/website/pages'
into 'build/pages'
}
// Get the current git log in XML
// N.B. The output should go to build/etc but I *cannot* work out how
// to get Gradle to do that. If the directory doesn't exist, it fails.
// It fails before it even runs dependencies that would create the
// directory!?
task gitlog(dependsOn: builddirs, type: Exec) {
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine "cmd", "/c", "perl", "src/website/bin/git-log-summary"
} else {
commandLine "src/website/bin/git-log-summary"
}
standardOutput = new FileOutputStream(new File("src/website/etc/git-log-summary.xml"))
}
// The default task. It just depends on all the necessary pages
task website(dependsOn: [pages]) {
// nop
}
// Make the default build target also build the website
build.dependsOn website