-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
240 lines (213 loc) · 8.82 KB
/
build.xml
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
<project name="Vagabond"
default="jar"
basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<description>
Vagabond is a system for explaining errors in data exchange.
</description>
<!-- Import macro definitions and common stuff -->
<import file="antutils/ant-common.xml" />
<!-- Main Class and Packages-->
<property name="jar.creator" value="Illinois Institute of Technology, Department of Computer Science" />
<property name="package" value="org.vagabond" />
<property name="mvn.description" value="Vagabond is a tool for automatic generation of explanations for data exchange errors." />
<property name="mvn.url" value="http://www.cs.iit.edu/%7edbgroup/research/vagabond.php" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="artifactId" value="vagabond" />
<!-- ClassPath Setup -->
<property name="classpath.name.bin" value="classpath.bin" />
<property name="classpath.name.build" value="classpath.build" />
<!-- Properties -->
<property name="xmlschema.model" location="resource/xmlschema/mappingScenario.xsd" />
<property name="xmlschema.expl" location="resource/xmlschema/explanationAndErrors.xsd" />
<property name="mainclass.loader" value="org.vagabond.commandline.loader.CommandLineLoader" />
<property name="mainclass.explgen" value="org.vagabond.commandline.explgen.CommandLineExplGen" />
<!-- ********************************************************************************
Task definitions
******************************************************************************** -->
<!-- create dirs and setup basic properties -->
<target name="mkdirs-and-setup-props">
<set-default-props />
<!-- dirs -->
<property name="dir.deploy" value="${basedir}/deploy" />
<property name="dir.deploylib" value="${dir.deploy}/lib" />
<property name="jar.bin" value="${dir.deploy}/${artifactId}.jar" />
<!-- XML and XBeans setup -->
<property name="xbeans.targetdir" location="${dir.build}/xbeans" />
<property name="xbeans.srcdir" location="${xbeans.targetdir}/src" />
<property name="xbeans.bindir" location="${xbeans.targetdir}/bin" />
<property name="xbeans.jar.name" value="vagabond-xml-model" />
<property name="xbeans.jar.model" location="${dir.library}/${xbeans.jar.name}.jar" />
<property name="xbeans.jar.expl" location="${dir.library}/vagabond-xml-model-expl.jar" />
<property name="xbeans.ivy.model" location="${dir.buildresource}/xmlmodel.ivy.xml" />
<property name="xbeans.ivy.expl" location="${dir.buildresource}/xmlexpl.ivy.xml" />
<property name="xbeans.model.mvn.description" value="Vagabond XML model for storing data integration metadata (schemas, mappings, constraints)." />
<property name="xbeans.model.mvn.url" value="${mvn.url}" />
<property name="xbeans.expl.mvn.description" value="Vagabond XML model for storing explanations for data exchange errors." />
<property name="xbeans.expl.mvn.url" value="${mvn.url}" />
<create-build-dirs />
<!-- check whether XML beans need to be regenerated or not -->
<uptodate srcfile="${xmlschema.model}"
targetfile="${xbeans.jar.model}"
property="skip.xmlbeans.model" value="true"/>
<uptodate srcfile="${xmlschema.expl}"
targetfile="${xbeans.jar.expl}"
property="skip.xmlbeans.expl" value="true"/>
<condition property="skip.xmlbeans">
<and>
<isset property="skip.xmlbeans.model" />
<isset property="skip.xmlbeans.expl" />
</and>
</condition>
<echo message="${skip.xmlbeans}" />
</target>
<!-- clean all builds -->
<target name="clean-all"
description="cleanup all build artifacts"
depends="mkdirs-and-setup-props">
<clean-build-dirs />
<delete file="${xbeans.jar.model}" />
<delete file="${xbeans.jar.expl}" />
</target>
<!-- download dependencies with ivy -->
<target name="download-dependencies"
depends="mkdirs-and-setup-props"
description="use ivy to download dependencies">
<ivy-download-deps/>
<classpath-from-dir dir="${dir.buildlib}"
pathname="${classpath.name.build}"
pathnamejar="${classpath.name.build}.jar"/>
</target>
<!-- create task defs and setup classpaths -->
<target name="define-tasks-and-setup-paths"
depends="download-dependencies">
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean"
classpathref="${classpath.name.build}" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
classpathref="${classpath.name.build}">
</taskdef>
</target>
<target name="compile" depends="define-tasks-and-setup-paths,generate-xml-bindings">
<classpath-from-dir dir="${dir.library}"
pathname="${classpath.name.bin}"
pathnamejar="${classpath.name.bin}.jar"/>
<javac srcdir="${dir.source}" destdir="${dir.bin}"
classpathref="${classpath.name.bin}" debug="on" includeantruntime="false">
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="jar" depends="compile">
<property name="fullJarClasspath" value="${classpath.bin.jar} resource/ lib/" />
<mkdir dir="${dir.deploy}" />
<!-- copy resources -->
<copy todir="${dir.deploy}" file="${dir.resource}/buildFiles/loader.sh" />
<copy todir="${dir.deploy}" file="${dir.resource}/buildFiles/loader.bat" />
<copy todir="${dir.deploy}" file="${dir.resource}/buildFiles/expl.sh" />
<copy todir="${dir.deploy}" file="${dir.resource}/buildFiles/expl.bat" />
<chmod perm="775" type="file">
<fileset dir="${dir.deploy}">
<include name="**/*.sh"/>
<include name="**/*.bat"/>
</fileset>
</chmod>
<mkdir dir="${dir.deploylib}" />
<copy todir="${dir.deploylib}">
<fileset dir="${dir.library}" />
</copy>
<mkdir dir="${dir.deploy}/resource" />
<copy todir="${dir.deploy}/resource">
<fileset dir="${dir.resource}">
<exclude name="buildFiles/**" />
<exclude name="test/**" />
<exclude name="log4jproperties.txt" />
</fileset>
</copy>
<copy todir="${dir.deploy}/resource" file="${dir.resource}/buildFiles/log4jproperties.txt" />
<!-- create jar file -->
<jar destfile="${jar.bin}" basedir="${dir.bin}">
<manifest>
<attribute name="Main-Class" value="${mainclass.explgen}" />
<attribute name="Created-By" value="${jar.creator}" />
<attribute name="Class-Path" value="${fullJarClasspath}" />
</manifest>
</jar>
</target>
<target name="generate-xml-bindings"
depends="generate-xml-jar,generate-xml-src"
>
</target>
<target name="generate-xml-src"
depends="define-tasks-and-setup-paths"
>
<description>This task generates the java source files from the xsd schema.</description>
<xmlbean schema="${xmlschema.model}"
classgendir="${dir.bin}"
srcgendir="${xbeans.srcdir}/model"
classpathref="${classpath.name.build}"
javasource="1.6" />
<xmlbean schema="${xmlschema.expl}"
classgendir="${dir.bin}"
srcgendir="${xbeans.srcdir}/expl"
classpathref="${classpath.name.build}"
javasource="1.6" />
</target>
<target name="generate-xml-jar"
depends="define-tasks-and-setup-paths"
unless="skip.xmlbeans">
<description>This task generates a jar file containing the classes generated from the xsd schema.</description>
<xmlbean schema="${xmlschema.model}"
debug="on"
destfile="${xbeans.jar.model}"
classpathref="${classpath.name.build}"
javasource="1.6" />
<xmlbean schema="${xmlschema.expl}"
debug="on"
destfile="${xbeans.jar.expl}"
classpathref="${classpath.name.build}"
javasource="1.6" />
</target>
<!-- deploy to mvn central -->
<target name="deploy-snapshot"
depends="jar,java-doc"
description="generate jars and pom.xml and deploy them as a snapshot to OSSRH">
<deploy-to-maven-central release="no"/>
<deploy-to-maven-central
ivyfile="${xbeans.ivy.model}"
copyjar="${xbeans.jar.model}"
srcdir="${xbeans.srcdir}/model"
description="${xbeans.model.mvn.description}"
url="${xbeans.model.mvn.url}"
release="no"/>
<deploy-to-maven-central
ivyfile="${xbeans.ivy.expl}"
copyjar="${xbeans.jar.expl}"
srcdir="${xbeans.srcdir}/expl"
description="${xbeans.expl.mvn.description}"
url="${xbeans.expl.mvn.url}"
release="no"/>
</target>
<target name="deploy-mvn-central"
depends="jar,java-doc"
description="generate jars and pom.xml and deploy them to maven central via OSSRH">
<deploy-to-maven-central release="yes"/>
<deploy-to-maven-central
ivyfile="${xbeans.ivy.model}"
copyjar="${xbeans.jar.model}"
srcdir="${xbeans.srcdir}/model"
description="${xbeans.model.mvn.description}"
url="${xbeans.model.mvn.url}"
release="yes"/>
<deploy-to-maven-central
ivyfile="${xbeans.ivy.expl}"
copyjar="${xbeans.jar.expl}"
srcdir="${xbeans.srcdir}/expl"
description="${xbeans.expl.mvn.description}"
url="${xbeans.expl.mvn.url}"
release="yes"/>
</target>
</project>