forked from scriptella/scriptella-etl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
209 lines (188 loc) · 9.97 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
<!--
Copyright 2006-2012 The Scriptella Project Team.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="scriptella" default="jar" xmlns:artifact="urn:maven-artifact-ant">
<description>
Build file for Scriptella Project.
Use build.properties/custom.build.properties to customize its behaviour.
</description>
<property file="custom.build.properties"/>
<property file="build.properties"/>
<xmlproperty file="pom.xml" prefix="pom.xml"/>
<property name="version" value="${pom.xml.project.version}"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="core" value="${basedir}/core"/>
<property name="tools" value="${basedir}/tools"/>
<property name="drivers" value="${basedir}/drivers"/>
<property name="samples" value="${basedir}/samples"/>
<property name="tmp.dir" value="${build.dir}/tmp"/>
<property name="reports.dir" value="${build.dir}/reports"/>
<property name="tests.report.dir" value="${reports.dir}/junit"/>
<property name="jar.name" value="scriptella.jar"/>
<property name="product.name" value="scriptella-${version}"/>
<property name="zip.name" value="${product.name}.zip"/>
<property name="srcide.zip.name" value="scriptella-src-ide.zip"/>
<property name="src.zip.name" value="scriptella-${version}-src.zip"/>
<fileset id="src.zip.fileset" dir="${basedir}"
includes="samples/** lib/** core/src/** tools/src/** drivers/src/** **/*build.xml build-templates/**
*.xml **/pom.xml *.properties forrest/**"
excludes="samples/lib/** custom*.properties forrest/build/**"/>
<property name="src.zip.includes" value=""/>
<property name="examples.zip.name" value="scriptella-examples-${version}.zip"/>
<tstamp/>
<target name="clean" unless="noclean">
<description>
Optional temp files cleanup.
</description>
<delete dir="${tmp.dir}" failonerror="no"/>
<ant dir="${core}" inheritall="false" target="clean"/>
<ant dir="${tools}" inheritall="false" target="clean"/>
<ant dir="${drivers}" inheritall="false" target="clean"/>
</target>
<target name="jar" depends="clean">
<description>
Produces main jar containing all required dependencies
</description>
<ant dir="${core}" inheritall="false"/>
<ant dir="${tools}" inheritall="false"/>
<ant dir="${drivers}" inheritall="false"/>
<copy todir="${build.dir}">
<fileset dir="${core}/build" includes="*.jar"/>
<fileset dir="${tools}/build" includes="*.jar"/>
<fileset dir="${drivers}/build" includes="*.jar"/>
</copy>
<delete file="${build.dir}/${jar.name}" failonerror="no"/>
<copy todir="${tmp.dir}" file="${basedir}/build-templates/MANIFEST.MF" overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<jar destfile="${build.dir}/${jar.name}" manifest="${tmp.dir}/MANIFEST.MF">
<fileset dir="${core}/build/tmp/classes" excludes="META-INF/*"/>
<fileset dir="${tools}/build/tmp/classes" excludes="META-INF/*"/>
<fileset dir="${drivers}/build/tmp/classes" excludes="META-INF/*"/>
<zipfileset src="${lib.dir}/commons-jexl.jar" excludes="META-INF/*"/>
<zipfileset src="${lib.dir}/commons-logging.jar"
excludes="META-INF/* **/NoOpLog* **/SimpleLog* **/LogSource*"/>
<zipfileset dir="${basedir}" includes="LICENSE NOTICE pom.xml" prefix="META-INF"/>
<manifest>
<attribute name="Main-Class" value="scriptella.tools.launcher.EtlLauncher"/>
</manifest>
</jar>
<!-- Update samples libs -->
<copy todir="${basedir}/samples/lib">
<fileset dir="${lib.dir}" excludes="spring.* h2.* lucene*"/>
<fileset file="${build.dir}/${jar.name}"/>
</copy>
</target>
<target name="zip" depends="jar">
<description>Prepares binary distribution</description>
<ant antfile="build-docs.xml" target="codereports"/>
<delete file="${build.dir}/${zip.name}" failonerror="false"/>
<delete file="${tmp.dir}/${srcide.zip.name}" failonerror="false"/>
<zip destfile="${tmp.dir}/${srcide.zip.name}">
<fileset dir="${core}/src/java" includes="**/*.java"/>
<fileset dir="${drivers}/src/java" includes="**/*.java"/>
<fileset dir="${tools}/src/java" includes="**/*.java"/>
</zip>
<zip destfile="${build.dir}/${zip.name}">
<zipfileset dir="${lib.dir}" includes="commons-*.jar commons-*.license.txt" prefix="${product.name}/lib"/>
<zipfileset dir="${build.dir}" includes="scriptella.jar docs/**" prefix="${product.name}"/>
<zipfileset dir="${build.dir}" includes="scriptella-*.jar" prefix="${product.name}/lib"/>
<zipfileset dir="${tools}/src/bin" prefix="${product.name}/bin"/>
<zipfileset dir="${basedir}" includes="README LICENSE NOTICE" prefix="${product.name}"/>
<zipfileset file="${tmp.dir}/${srcide.zip.name}" prefix="${product.name}"/>
</zip>
</target>
<target name="examples" depends="jar">
<description>Prepares examples distribution</description>
<delete file="${build.dir}/${examples.zip.name}" failonerror="false"/>
<zip destfile="${build.dir}/${examples.zip.name}">
<fileset dir="${basedir}/samples"/>
</zip>
</target>
<target name="srczip">
<description>Prepares src distribution</description>
<delete file="${build.dir}/${src.zip.name}" failonerror="false"/>
<zip destfile="${build.dir}/${src.zip.name}">
<fileset refid="src.zip.fileset"/>
</zip>
</target>
<target name="dist" depends="zip, srczip, examples">
<description>Prepares binary and src distribution</description>
</target>
<target name="test">
<description>
Runs unit tests and produces reports in ${tests.report.dir}.
The tests are runned per module to control dependencies between modules.
</description>
<ant dir="${core}" antfile="${core}/build.xml" target="test" inheritall="false"/>
<ant dir="${drivers}" antfile="${drivers}/build.xml" target="test" inheritall="false"/>
<ant dir="${tools}" antfile="${tools}/build.xml" target="test" inheritall="false"/>
<delete dir="${tests.report.dir}" failonerror="no"/>
<mkdir dir="${tests.report.dir}"/>
<junitreport todir="${tests.report.dir}">
<fileset dir="${core}/build/tmp/junit-xml" includes="TEST-*.xml"/>
<fileset dir="${drivers}/build/tmp/junit-xml" includes="TEST-*.xml"/>
<fileset dir="${tools}/build/tmp/junit-xml" includes="TEST-*.xml"/>
<report todir="${tests.report.dir}"/>
</junitreport>
<fail if="unit.tests.failed" message="JUnit test failed see ${tests.report.dir}"/>
</target>
<target name="coverage">
<description>
Runs junit and produce reports including code coverage.
Requires cobertura.dir to be specified in build.properties
</description>
<ant antfile="${basedir}/coverage.xml" inheritall="false"/>
</target>
<target name="deploy">
<description>
Publish libraries to Maven repositories, snapshot or release depending on current
version in pom.xml. Requires maven-ant-tasks.jar to be specified in build.properties
</description>
<!--Validation-->
<fail message="Maven Ant Tasks are required to publish libraries. Set maven-ant-tasks.jar property.
Maven Ant Tasks URL: http://maven.apache.org/ant-tasks/" unless="maven-ant-tasks.jar"/>
<condition property="no_maven-ant-tasks">
<available file="${maven-ant-tasks.jar}"/>
</condition>
<fail message="Maven Ant Tasks not found at ${no_maven-ant-tasks}" unless="no_maven-ant-tasks"/>
<!--End Validation-->
<path id="maven-ant-tasks.classpath" path="${maven-ant-tasks.jar}" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
classpathref="maven-ant-tasks.classpath"/>
<macrodef name="gpg">
<attribute name="file"/>
<sequential>
<delete file="@{file}.asc" failonerror="false"/>
<exec executable="gpg">
<arg value="-u"/>
<arg value="${gpg.key}"/>
<arg value="-ab"/>
<arg value="--passphrase"/>
<arg value="${gpg.passphrase}"/>
<arg value="@{file}"/>
</exec>
</sequential>
</macrodef>
<gpg file="pom.xml"/>
<artifact:deploy file="pom.xml">
<pom file="pom.xml" />
<attach file="pom.xml.asc" type="pom.asc"/>
</artifact:deploy>
<ant dir="${core}" antfile="${core}/build.xml" target="deploy" inheritall="false"/>
<ant dir="${drivers}" antfile="${drivers}/build.xml" target="deploy" inheritall="false"/>
<ant dir="${tools}" antfile="${tools}/build.xml" target="deploy" inheritall="false"/>
</target>
</project>