forked from dita-ot/dita-ot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
246 lines (223 loc) · 8.42 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*
* This file is part of the DITA Open Toolkit project.
*
* Copyright 2015 Jarno Elovirta
*
* See the accompanying LICENSE file for applicable license.
*/
apply plugin: 'java'
apply plugin: 'maven'
group = 'org.dita-ot'
version = '2.4.6'
description = """DITA Open Toolkit"""
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'commons-codec', name: 'commons-codec', version:'1.10'
compile group: 'xerces', name: 'xercesImpl', version:'2.11.0'
compile group: 'xml-apis', name: 'xml-apis', version:'1.4.01'
compile group: 'xml-resolver', name: 'xml-resolver', version:'1.2'
compile group: 'net.sourceforge.saxon', name: 'saxon', version:'9.1.0.8', classifier:'dom'
compile group: 'net.sourceforge.saxon', name: 'saxon', version:'9.1.0.8'
compile group: 'com.ibm.icu', name: 'icu4j', version:'57.1'
compile group: 'org.apache.ant', name: 'ant', version:'1.10.1'
compile group: 'org.apache.ant', name: 'ant-launcher', version:'1.10.1'
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.23'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.1'
runtime group: 'org.apache.ant', name: 'ant-apache-resolver', version:'1.10.1'
testCompile group: 'nu.validator.htmlparser', name: 'htmlparser', version:'1.4'
testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'xmlunit', name: 'xmlunit', version:'1.6'
}
jar.archiveName = "${project.name}.jar"
test {
exclude '**/IntegrationTest*.class'
}
// Integration test
def integrationTestSystemProperties = [
temp_dir : "${buildDir}/tmp/integrationTest",
dita_dir : "${projectDir}/src/main",
basedir : "${projectDir}/src/test"
]
if (System.getProperty("test") != null) {
integrationTestSystemProperties["test"] = System.getProperty("test")
}
if (System.getProperty("log_level") != null) {
integrationTestSystemProperties["log_level"] = System.getProperty("log_level")
}
task integrationTest(type: Test, dependsOn: 'buildLocal') {
minHeapSize = "128m"
maxHeapSize = "1024m"
systemProperties = integrationTestSystemProperties
include '**/IntegrationTest*.class'
}
// Install
defaultTasks 'buildLocal'
task copyInstall(type: Copy) {
from (configurations.runtime.allArtifacts.files)
from (configurations.runtime) {
rename "ant-launcher(-\\d+(\\.\\d+(\\.\\d+)?)?)\\.jar", "ant-launcher.jar"
rename "ant(-\\d+(\\.\\d+(\\.\\d+)?)?)\\.jar", "ant.jar"
}
destinationDir = file("src/main/lib")
}
task buildLocal(type: JavaExec, dependsOn: [copyInstall, ":fo:copyInstall", ":axf:copyInstall", ":fop:copyInstall", ":xep:copyInstall", ":html5:compileSass"]) {
description "Build archives and install all plugins with dependencies"
main = "org.apache.tools.ant.launch.Launcher"
classpath = sourceSets.main.runtimeClasspath + files("${projectDir}/src/main", "${projectDir}/src/main/lib", "${projectDir}/src/main/resources")
workingDir file("${projectDir}/src/main")
args "-f"
args file("${projectDir}/src/main/integrator.xml")
}
// Distribution
def distTempDir = file("${buildDir}/tmp/dist")
def distVersion = project.hasProperty("commit") && (!project.hasProperty("tag") || tag.empty) ?
"${project.version}+${commit.substring(0, 7)}" :
"${project.version}"
def distFileName = (project.hasProperty("tag") && tag.empty) ?
"develop" :
"${project.version}"
task cleanDistTemp(type: Delete) {
delete distTempDir
}
task initDist(dependsOn: [jar, cleanDistTemp]) {
doLast {
distTempDir.mkdirs()
println "distVersion: ${distVersion}"
println "distFileName: ${distFileName}"
}
}
task copyDistTemp(type: Copy, dependsOn: initDist) {
from (configurations.runtime.allArtifacts.files) {
into "lib"
}
from (configurations.runtime) {
into "lib"
rename "ant-launcher(-\\d+(\\.\\d+(\\.\\d+)?)?)\\.jar", "ant-launcher.jar"
rename "ant(-\\d+(\\.\\d+(\\.\\d+)?)?)\\.jar", "ant.jar"
}
from (".") {
include "LICENSE"
}
from ("src/main") {
exclude "**/.gradle"
exclude "**/build.gradle"
exclude "**/settings.gradle"
exclude ".*"
exclude "local.properties"
exclude "build.log"
exclude "build_demo.xml"
exclude "catalog-dita.txt"
include "*.*"
include "bin/dita"
include "bin/dita.bat"
exclude "docsrc/*.md"
exclude "docsrc/*.xpr"
exclude "docsrc/site.*"
exclude "docsrc/build"
exclude "docsrc/temp"
include "docsrc/**"
include "dtd/**"
//include "lib/**/*.properties"
include "lib/configuration.properties"
exclude "plugins/org.dita-ot.html/**"
exclude "plugins/org.dita.html5/.sass-cache"
exclude "plugins/org.dita.html5/build"
exclude "plugins/org.dita.pdf2/src/**"
exclude "plugins/org.dita.pdf2/build"
exclude "plugins/org.dita.pdf2/bin/**"
exclude "plugins/org.dita.pdf2.axf/build"
exclude "plugins/org.dita.pdf2.axf/src"
exclude "plugins/org.dita.pdf2.fop/build"
exclude "plugins/org.dita.pdf2.xep/build"
exclude "plugins/org.dita.pdf2.xep/lib/xep/**"
exclude "plugins/org.dita.pdf2.xep/src"
exclude "temp"
include "plugins/**"
exclude "resources/org"
include "resources/**"
include "xsl/**"
// legacy build scripts
include "startcmd.*"
include "bin/ant"
include "bin/ant.*"
}
destinationDir = distTempDir
}
copyDistTemp.outputs.dir distTempDir
task updateConfiguration() {
doLast {
if (project.hasProperty('commit') && !commit.empty) {
ant.propertyfile(file: "${distTempDir}/lib/configuration.properties") {
entry(key: "otversion", operation: "=", value: "${distVersion}")
}
}
}
}
updateConfiguration.mustRunAfter copyDistTemp
task integrateDistTemp(type: JavaExec, dependsOn: [copyDistTemp, ":fo:copyDistTemp", ":axf:copyDistTemp", ":fop:copyDistTemp", ":xep:copyDistTemp", updateConfiguration]) {
main = "org.apache.tools.ant.launch.Launcher"
classpath = sourceSets.main.runtimeClasspath + files("${distTempDir}", "${distTempDir}/lib", "${distTempDir}/resources")
workingDir distTempDir
args "-f"
args file("${distTempDir}/integrator.xml")
}
task generateDocs(type: JavaExec, dependsOn: integrateDistTemp) {
main = "org.apache.tools.ant.launch.Launcher"
classpath = sourceSets.main.runtimeClasspath + files("${distTempDir}", "${distTempDir}/lib", "${distTempDir}/resources")
workingDir distTempDir
args "-f"
args file("${distTempDir}/docsrc/build.xml")
args "-Dbasedir=" + file("${distTempDir}/docsrc")
args "-Ddita.home=" + distTempDir
args "dist"
}
task cleanGenerateDocs(type: Delete) {
delete "${distTempDir}/docsrc/temp"
}
cleanGenerateDocs.mustRunAfter generateDocs
task generateJavadocs(type: Javadoc) {
classpath = sourceSets.main.compileClasspath
source = sourceSets.main.allJava
include "**/org/dita/dost/*.*"
include "**/org/dita/dost/exception/DITAOTException.*"
include "**/org/dita/dost/util/Configuration.*"
options.addStringOption("public")
title = "${project.description} ${project.version}"
destinationDir = file("${distTempDir}/doc/api")
}
task dist(type: Zip, dependsOn: [jar, generateDocs, cleanGenerateDocs, generateJavadocs]) {
into("dita-ot-${distVersion}") {
from (distTempDir) {
exclude "bin/dita"
exclude "bin/dita.bat"
// legacy build scripts
exclude "startcmd.*"
exclude "bin/ant"
exclude "bin/ant.*"
}
from (distTempDir) {
fileMode = 0755
include "bin/dita"
include "bin/dita.bat"
// legacy build scripts
include "startcmd.*"
include "bin/ant"
include "bin/ant.*"
}
}
archiveName "dita-ot-${distFileName}.zip"
}
test {
inputs.files (
'src/test/xsl/common/dita-utilities.xspec',
'src/test/xsl/common/uri-utils.xspec',
'src/test/xsl/plugins/org.dita.html5/xsl/functions.xspec',
'src/test/xsl/preprocess/maplinkImpl.xspec'
)
}