-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.xml
266 lines (230 loc) · 12.8 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!--
© Copyright IBM Corporation 2014, 2017.
This is licensed under the following license.
The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html)
U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
-->
<project name="Informatica" default="main" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="build.dir" value="${basedir}/build" />
<property name="build.plugin.dir" value="${build.dir}/plugin" />
<property name="build.tmp.dir" value="${build.dir}/tmp" />
<property name="build.tmp.groovy.dir" value="${build.tmp.dir}/groovy" />
<property name="build.test.dir" value="${build.dir}/test" />
<property name="build.test.java.dir" value="${build.test.dir}/java" />
<property name="build.test.classes.dir" value="${build.test.dir}/classes" />
<property name="build.java.dir" value="${build.dir}/java"/>
<property name="license.dir" value="${basedir}/license" />
<property name="plugin.dir" value="${basedir}/plugin" />
<property name="src.dir" value="${basedir}/src" />
<property name="src.main.dir" value="${src.dir}/main" />
<property name="src.main.groovy.dir" value="${src.main.dir}/groovy" />
<property name="src.main.java.dir" value="${src.main.dir}/java" />
<property name="src.main.scripts.dir" value="${src.main.dir}/scripts" />
<property name="src.test.dir" value="${src.dir}/test" />
<property name="src.test.java.dir" value="${src.test.dir}/java" />
<property name="doc.dir" value="${basedir}/doc" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="lib.build.dir" value="${lib.dir}/build" />
<property name="lib.build.classes.dir" value="${lib.build.dir}/classes" />
<property name="lib.build.gputil.dir" value="${lib.build.dir}/gputil" />
<property name="lib.build.gputil.sources.dir" value="${lib.build.gputil.dir}/sources" />
<property name="lib.build.gputil.classes.dir" value="${lib.build.gputil.dir}/classes" />
<property name="lib.test.dir" value="${lib.dir}/test" />
<property name="lib.test.java.dir" value="${lib.test.dir}/java" />
<property name="lib.test.dir" value="${lib.dir}/test" />
<property name="releases.dir" value="${basedir}/releases" />
<property name="releases.report.dir" value="${releases.dir}/report" />
<property name="plugin" value="Informatica-UCD" />
<xmlproperty file="${plugin.dir}/plugin.xml" collapseAttributes="true"/>
<property name="version" value="${plugin.header.identifier.version}" />
<property name="buildLife" value="dev" />
<property name="pluginDist" value="${releases.dir}/${plugin}-v${version}.${buildLife}.zip" />
<target name="main" depends="clean, resolve, compile-classes, build, dist">
<echo>Plugin build complete!</echo>
</target>
<!-- ================================================================== -->
<!-- PATHS -->
<!-- ================================================================== -->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<path id="classpath.build">
<fileset dir="${lib.build.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${lib.build.classes.dir}"/>
<pathelement location="${lib.build.gputil.classes.dir}"/>
</path>
<path id="classpath.test">
<fileset dir="${lib.test.dir}">
<include name="*.jar"/>
</fileset>
<path refid="classpath.build"/>
</path>
<!-- =================================================== -->
<!-- TASK DEFINTITION TARGET -->
<!-- =================================================== -->
<target name="taskdef" unless="taskdef.no">
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
<classpath>
<path refid="classpath.test"/>
</classpath>
</taskdef>
</target>
<!-- =================================================== -->
<!-- BUILD TARGET -->
<!-- =================================================== -->
<!-- Copy in the dependencies -->
<target name="build" depends="resolve">
<!-- inputs (info, upgrade, plugin, and scripts) -->
<copy todir="${build.plugin.dir}">
<fileset dir="${plugin.dir}">
<include name="info.xml" />
<include name="upgrade.xml" />
<include name="plugin.xml" />
</fileset>
<!-- scripts -->
<fileset dir="${src.main.scripts.dir}" />
</copy>
<replace file="${build.plugin.dir}/info.xml" token="#RELEASE_VERSION#" value="${version}.${buildLife}" />
<mkdir dir="${build.plugin.dir}/license"/>
<!-- copy license -->
<copy todir="${build.plugin.dir}/license">
<fileset dir="${license.dir}" />
</copy>
<mkdir dir="${build.plugin.dir}/doc"/>
<!-- copy doc -->
<copy todir="${build.plugin.dir}/doc">
<fileset dir="${doc.dir}" />
</copy>
<mkdir dir="${build.plugin.dir}/lib"/>
<!-- copy libs -->
<copy todir="${build.plugin.dir}/lib">
<fileset dir="${lib.dir}" >
<exclude name="**/build/**"/>
<exclude name="**/test/**"/>
</fileset>
</copy>
<!-- Copy Classes -->
<mkdir dir="${build.plugin.dir}/classes"/>
<mkdir dir="${lib.build.classes.dir}"/>
<copy todir="${build.plugin.dir}/classes">
<!-- Groovy -->
<fileset dir="${src.main.groovy.dir}">
<include name="**/*.groovy" />
</fileset>
<!-- Java -->
<fileset dir="${lib.build.classes.dir}">
<include name="**/*.class" />
</fileset>
</copy>
</target>
<!-- =================================================== -->
<!-- DIST TARGET -->
<!-- =================================================== -->
<target name="dist" depends="resolve">
<zip destfile="${pluginDist}" basedir="${build.plugin.dir}" update="false"/>
</target>
<!-- =================================================== -->
<!-- CLEAN TARGET -->
<!-- =================================================== -->
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${lib.dir}" />
<delete file="${pluginDist}" />
</target>
<!-- =================================================== -->
<!-- RESOLVE TARGET -->
<!-- =================================================== -->
<target name="resolve" depends="install-ivy" unless="resolve.no" description="Resolve all dependencies">
<mkdir dir="${lib.dir}"/>
<mkdir dir="${lib.build.dir}"/>
<mkdir dir="${lib.test.dir}"/>
<ivy:retrieve conf="default" pattern="${lib.dir}/[artifact]-[revision](-[classifier]).[ext]"/>
<ivy:retrieve conf="build" pattern="${lib.dir}/[conf]/[artifact]-[revision](-[classifier]).[ext]"/>
<ivy:retrieve conf="test" pattern="${lib.dir}/[conf]/[artifact]-[revision](-[classifier]).[ext]"/>
</target>
<!-- =================================================== -->
<!-- INSTALL IVY TARGET -->
<!-- =================================================== -->
<available classname="org.apache.ivy.Main" property="ivy.installed"/>
<target name="install-ivy" depends="-install, -fail"></target>
<target name="-install" description="Install ivy" unless="ivy.installed">
<!-- Installation -->
<property name="antHome" value="${user.home}${file.separator}.ant"/>
<mkdir dir="${antHome}${file.separator}lib"/>
<get dest="${antHome}${file.separator}lib${file.separator}ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
<echo message="SUCCESS! Ivy has been installed in ${antHome}." />
<!-- Determine whether to continue or fail -->
<property name="failIvy" value="true"/>
<condition property="do.fail">
<equals arg1="${failIvy}" arg2="true" />
</condition>
</target>
<!-- Default to fail if Ivy installed, unless -DfailIvy=false : Used for .travis -->
<target name="-fail" if="do.fail">
<fail message="Please run the build again.${line.separator}Note: If you get this message more than once, trying specify your Ant's home directory with the flag: ant -DantHome='ant/home/directory/here' or set/export the `ANT_HOME` environment variable." />
</target>
<!-- =================================================== -->
<!-- TEST TARGET -->
<!-- =================================================== -->
<target name="run-tests" depends="compile-classes, compile-tests" unless="tests.no">
<mkdir dir="${releases.report.dir}"/>
<junit printsummary="yes" haltonfailure="no" showoutput="false" failureproperty="tests.failed">
<classpath refid="classpath.test" />
<classpath location="${lib.test.java.dir}" />
<formatter type="xml" />
<formatter type="plain" />
<batchtest fork="yes" todir="${releases.report.dir}">
<fileset dir="${src.test.java.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<fail message="JUnit Tests Failed. View 'releases/report' for full output log." if="tests.failed" />
</target>
<!-- =================================================== -->
<!-- COMPILE TARGETS -->
<!-- =================================================== -->
<target name="compile-classes" description="Compile Groovy or Java classes." depends="resolve, taskdef" unless="compile.no">
<!-- Recompile the Groovy Plugin Utils -->
<mkdir dir="${lib.build.gputil.classes.dir}"/>
<unzip dest="${lib.build.gputil.sources.dir}">
<fileset dir="${lib.build.dir}">
<filename regex="groovy-plugin-utils-.*.jar"/>
</fileset>
</unzip>
<groovyc srcdir="${lib.build.gputil.sources.dir}" destdir="${lib.build.gputil.classes.dir}">
<include name="**/*.groovy"/>
<classpath path="${lib.build.dir}">
<fileset dir=".">
<include name="**/*.jar"/>
</fileset>
</classpath>
<javac debug="on" deprecation="true"/>
</groovyc>
<!-- Groovy -->
<mkdir dir="${build.tmp.groovy.dir}"/>
<groovyc srcdir="${src.main.dir}" destdir="${build.tmp.groovy.dir}">
<include name="**/*.groovy"/>
<classpath refid="classpath.build"/>
<javac debug="on" deprecation="true"/>
</groovyc>
<delete dir="${build.tmp.groovy.dir}" />
<!-- Java -->
<mkdir dir="${lib.build.classes.dir}"/>
<javac srcdir="${src.main.java.dir}" destdir="${lib.build.classes.dir}" includeantruntime="false">
<include name="**/*.java"/>
<classpath refid="classpath.build"/>
</javac>
</target>
<!-- Java Tests -->
<target name="compile-tests" description="Compile Java Test Files..." depends="compile-classes">
<mkdir dir="${lib.test.java.dir}"/>
<javac srcdir="${src.test.java.dir}" destdir="${lib.test.java.dir}" includeantruntime="false">
<classpath refid="classpath.test"/>
</javac>
</target>
</project>