-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
223 lines (182 loc) · 4.88 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
import com.github.rjeschke.txtmark.*
import org.apache.tools.ant.filters.*
apply plugin: "base"
apply plugin: "groovy"
apply plugin: "maven"
apply from: "conf.gradle"
group = "edu.harvard.chs"
version = '3.3.2'
apply from: "versions.gradle"
if (hasProperty('pub')) {
System.err.print "Using configuration data from ${pub}"
File confFile = new File(pub)
if (! confFile.exists()) {
throw new Exception("No publication configuration file ${pub} found.")
} else {
apply from: pub
}
} else {
File confFile = new File("pub.gradle")
if (! confFile.exists()) {
throw new Exception("No publication configuration file ${confFile} found\
.")
} else {
println "Using default configuration in 'pub.gradle'"
apply from: "pub.gradle"
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'com.github.rjeschke', name: 'txtmark', version: '0.11'
}
}
repositories {
mavenCentral()
}
configurations {
rngs
lib
}
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: groovyVersion
//compile group: 'org.iso_relax.verifier.jaxp.validation', name: 'isorelax-jaxp-bridge', version : '1.0'
compile group: 'com.thaiopensource', name:'jing', version: jingVersion
testCompile group: "junit", name: "junit", version: junitVersion
testCompile group: "org.concordion", name: "concordion", version: concordionVersion
//testCompile group: 'junit', name: 'junit', version: junitVersion
testCompile group :'xmlunit', name: 'xmlunit', version: xmlunitVersion
}
task sourcesZip(type: Zip, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task docsZip(type: Zip, dependsOn: groovydoc) {
classifier = 'groovydoc'
from groovydoc.destinationDir
description = 'Builds zip file of java/groovy docs'
}
task schemas(type: Zip) {
classifier = 'schemas'
description = 'Builds zip file of TextInventory schemas.'
from(file("schemas"))
include("**/*.rng")
baseName = "textInventorySchemas"
}
artifacts {
lib jar
archives docsZip
archives sourcesZip
archives schemas
}
uploadArchives {
repositories.mavenDeployer {
repository(url: nexusRepo) {
authentication (userName: nexusUser, password: nexusPassword)
}
}
}
uploadRngs {
repositories.mavenDeployer {
repository(url: nexusRepo) {
authentication (userName: nexusUser, password: nexusPassword)
}
}
}
uploadLib {
repositories.mavenDeployer {
repository(url: nexusRepo) {
authentication (userName: nexusUser, password: nexusPassword)
}
}
doLast {
System.err.println "Code library uploaded."
}
}
/*
// for specs with concordion:
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
}
}
test {
java {
srcDir "specs/java"
}
resources {
srcDir "${buildDir}/specs"
}
}
}
task cpResources(type: Copy) {
description "Copies specification resources into build area"
from "specs/resources"
into "${buildDir}/specs"
}
cpResources.doFirst {
println "\n\nAbout to run 'cpResources' task"
}
cpResources.doLast {
println "Copied resources into ${buildDir}/specs\n\n"
}
task setUpResources(dependsOn: [cpResources]) {
description "Converts specification markdown to HTML for concordion"
}
setUpResources.doFirst {
println "About to run 'setUpResources' task"
}
setUpResources.doLast {
println "READING FILE TREE FROM " + mdSrc
FileTree tree = fileTree(mdSrc) {
include "** / *.md"
}
tree.visit { f ->
if (f.relativePath.isFile()) {
File inFile = new File("${mdSrc}/${f.relativePath}")
println "Working on " + inFile
def segs = f.relativePath.getSegments()
String treePath = "${buildDir}/specs"
Integer limit = segs.size() - 1
segs.eachWithIndex { s, i ->
if (i < limit) {
treePath = "${treePath}/${s}"
File nxtDir = new File(treePath)
if (! nxtDir.exists()) {
nxtDir.mkdir()
}
}
}
File outDir = new File(treePath)
String htmlFileName = f.relativePath.getLastName().replaceFirst(/.md$/,".html")
File htmlFile = new File(outDir, htmlFileName)
println "Created ${htmlFile}"
String body = Processor.process(inFile.getText("UTF-8"),Configuration.DEFAULT)
htmlFile.setText("${htmlPreface}${body}${htmlEnd}", "UTF-8")
}
}
}
test.dependsOn setUpResources
test {
systemProperties 'concordion.output.dir': file("${buildDir}/concordion-results")
}
test.doFirst {
println "About to run 'test' task"
}
*/
task mapVersion() {
}
mapVersion.doLast {
tokenMap["version"] = version
}
task conc(type: Copy, dependsOn: [test, mapVersion]) {
from "${buildDir}/concordion-results"
into "${buildDir}/concordion-formatted"
filter(ReplaceTokens, tokens: tokenMap)
}