forked from OmixVisualization/qtjambi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
378 lines (321 loc) · 15 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<!--
TODO:
- ”ant all” should be ”ant full”.
- (new) ant all should build everything, only if it has not been built before.
- Tasks like ”ant library” should be meta tasks that pulls everything it needs,
and something like ant library-task should pull only stuff related to library.
Both should be documented.
- There should be direct way to export output of task to pastebin,
for example something like ant nc generator which sends the output to pastebin
and returns a link.
- Instead of version.properties there should be generic way to provide (default)
properties to Jambi, for example in form of file, or better, in qtjambi-deploy.
This can include stuff like debug flag and version.
-->
<project default="help" basedir="." name="qtjambi.main">
<property file="build.properties"/>
<property name="build.properties.loaded" value="true"/>
<!--
Import files containing tasks for the compilation.
-->
<import file="antfiles/setenv.xml"/>
<import file="antfiles/generator.xml"/>
<import file="antfiles/native.xml"/>
<import file="antfiles/java.xml"/>
<import file="antfiles/clean.xml"/>
<import file="antfiles/autotests.xml" />
<!-- These properties used to be at the top of build.properties
but no one is expected to change them.
-->
<property name="antjardir" location="antjar"/>
<property name="java.srcdir" location="src/java"/>
<!--
Initialization tasks. Note that the init.taskdef task depends on a jar
task, since ant-qtjambi.jar must be set in order for the
<qtjambi-initialize> task to be set at all.
-->
<target name="log">
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd_HH-mm-ss"/>
</tstamp>
<property name="build.log.dir" location="${basedir}/buildlogs"/>
<mkdir dir="${build.log.dir}"/>
<property name="build.log.filename" value="build_${timestamp}.log"/>
<property name="build.log.loglevel" value="info" />
<record name="${build.log.dir}/${build.log.filename}" loglevel="${build.log.loglevel}" append="false"/>
<echo message="Build logged to ${build.log.filename}"/>
</target>
<target name="init.taskdef" depends="log">
<mkdir dir="${antjardir}/ant-qtjambi"/>
<javac debug="true" deprecation="true" source="1.8" target="1.8"
fork="true" memorymaximumsize="1024m" verbose="false"
includeantruntime="true"
destdir="${antjardir}/ant-qtjambi">
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:-module,-options" />
<src path="${java.srcdir}/ant"/>
</javac>
<copy todir="${antjardir}/ant-qtjambi" includeemptydirs="false">
<fileset dir="${java.srcdir}/ant">
<include name="**/*"/>
<exclude name="**/.*"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
<taskdef resource="io/qt/tools/ant/ant-qtjambi.xml">
<classpath>
<pathelement path="${antjardir}/ant-qtjambi"/>
</classpath>
</taskdef>
</target>
<target name="init" depends="log, init.taskdef">
<qtjambi-initialize verbose="true"/>
</target>
<target name="init.build">
<qtjambi-initialize-build verbose="true"/>
</target>
<!--
END of initilization tasks
-->
<!--
Tools building
-->
<macrodef name="uic">
<attribute name="uifile"/>
<attribute name="targetpackage"/>
<attribute name="targetdirectory"/>
<attribute name="libfiles"/>
<attribute name="connections"/>
<sequential>
<if>
<os family="mac"/>
<then>
<property name="XstartOnFirstThread" value="-XstartOnFirstThread" />
</then>
<else>
<property name="XstartOnFirstThread" value="-Dx" />
</else>
</if>
<pathconvert property="librarypath">
<path>
<pathelement location="${tools.qt.bindir}"/>
<pathelement location="${tools.qt.libdir}"/>
</path>
</pathconvert>
<pathconvert property="classpath">
<path>
<pathelement location="${tools.qt.bindir}"/>
<pathelement location="${tools.qt.libdir}"/>
</path>
</pathconvert>
<trycatch>
<try>
<java fork="true" classname="io.qt.uic.Main" failonerror="true">
<jvmarg value="-Djava.library.path=${librarypath}"/>
<jvmarg value="-Dio.qt.deploymentdir=${outputDir}/tmp"/>
<jvmarg value="-Dio.qt.verbose-loading=true"/>
<jvmarg value="${XstartOnFirstThread}"/>
<arg value="-f" />
<arg value="-o" />
<arg value="@{targetdirectory}" />
<arg value="-p" />
<arg value="@{targetpackage}" />
<arg value="-c" />
<arg value="@{connections}" />
<arg value="@{uifile}" />
<env key="DYLD_LIBRARY_PATH" value="${librarypath}" />
<classpath>
<fileset dir="${deploymentdir}" includes="qtjambi-${qtjambi.jar.version}.jar,qtjambi-uic-${qtjambi.jar.version}.jar,@{libfiles}"/>
</classpath>
</java>
</try>
<finally>
<delete dir="${outputDir}/tmp"/>
</finally>
</trycatch>
</sequential>
</macrodef>
<target name="finished">
<echo>QtJambi ${qtjambi.jar.version}</echo>
</target>
<target name="help" description="log, Provides detailed help.">
<echo>
Welcome to Qt Jambi help task.
Quick howto:
[edit build.properties to suit your system]
set QTDIR to directory containing Qt either as environment variable or in build.properties.
ant all
Further options:
</echo>
<java classname="org.apache.tools.ant.Main" classpath="${java.class.path}" fork="true">
<arg value="-projecthelp" />
<arg value="-buildfile" />
<arg value="${ant.file}" />
</java>
</target>
<!--
Root targets
Specifies the top targets, which does not actually do anything, but
provides consistent and easy to use interface for humans to use.
-->
<target name="targetproxy">
<antcall inheritAll="false" target="${proxy.target}"/>
</target>
<target name="javadocs" depends="log, setenv, init.taskdef" description="Generates the Java Doc pages for QtJambi">
<foreach-version targets="javadocs-impl"/>
</target>
<target name="single.javadocs" depends="log, setenv, init.taskdef" description="Generates the Java Doc pages for QtJambi">
<foreach-version targets="single.javadocs-impl"/>
</target>
<target name="generator.make" depends="log, setenv, init.taskdef"
description="Compiles the generator.">
<foreach-version targets="generator.make-impl"/>
</target>
<target name="generator.make-impl" depends="init.build, tools.generator.make">
<antcall target="finished"/>
</target>
<target name="generate" depends="log, setenv, init.taskdef"
description="Compiles and runs the Qt Jambi Generator.">
<foreach-version targets="generate-impl"/>
</target>
<target name="generate-impl" depends="tools.generator.make, tools.generator.run"/>
<target name="generator.run" depends="log, setenv, init.taskdef"
description="Runs the Qt Jambi generator on the Qt headers">
<foreach-version targets="generator.run-impl"/>
</target>
<target name="generator.run-impl" depends="init.build, tools.generator.run">
<antcall target="finished"/>
</target>
<target name="library.native" depends="log, setenv, init.taskdef"
description="Compiles and bundles the Qt Jambi native libraries.">
<foreach-version targets="library.native-impl"/>
</target>
<target name="library.native-impl" depends="library.native.qmake-impl, library.native.make-impl, library.native.bundle-impl"/>
<target name="library.native.qmake" depends="log, setenv, init.taskdef" description="Runs qmake on the Qt Jambi native library">
<foreach-version targets="library.native.qmake-impl"/>
</target>
<target name="library.native.make" depends="log, setenv, init.taskdef" description="Runs make on the Qt Jambi native library">
<foreach-version targets="library.native.make-impl"/>
</target>
<target name="library.native.compile" depends="log, setenv, init.taskdef">
<foreach-version targets="library.native.compile-impl"/>
</target>
<target name="library.native.makebundle" depends="log, setenv, init.taskdef">
<foreach-version targets="library.native.makebundle-impl"/>
</target>
<target name="library.native.bundle" depends="log, setenv, init.taskdef">
<foreach-version targets="library.native.bundle-impl"/>
</target>
<target name="library.native.bundle.plugins" depends="log, setenv, init.taskdef">
<foreach-version targets="library.native.bundle.plugins-impl"/>
</target>
<target name="bundle.qtlib" depends="log, setenv, init.taskdef">
<foreach-version targets="bundle.qtlib-impl"/>
</target>
<target name="library.java" depends="log, setenv, init.taskdef"
description="Compiles and bundles the Qt Jambi java libraries.">
<foreach-version targets="library.java-impl"/>
</target>
<target name="library.java-impl" depends="init.build, javac.excludes, java.build.qtjambi"/>
<target name="plugins.java" depends="log, setenv, init.taskdef"
description="Compiles the Qt Jambi plugins.">
<foreach-version targets="plugins.java-impl"/>
</target>
<target name="plugins.java-impl" depends="init.build, javac.excludes, java.build.qtjambiplugins"/>
<target name="plugins" depends="log, setenv, init.taskdef"
description="Compiles and bundles the Qt Jambi plugins.">
<foreach-version targets="plugins-impl"/>
</target>
<target name="plugins-impl" depends="init.build, javac.excludes, java.build.qtjambiplugins, library.native.bundle.plugins-impl"/>
<target name="library" depends="log, setenv, init.taskdef"
description="Compiles and bundles the Qt Jambi libraries.">
<foreach-version targets="library-impl"/>
</target>
<target name="library-impl" depends="library.native.qmake-impl, library.native.make-impl, library.java-impl, library.native.bundle-impl"/>
<target name="all" depends="log, setenv, init.taskdef"
description="Generates, builds and bundles the Qt Jambi libraries.">
<foreach-version targets="all-impl"/>
</target>
<target name="all-impl" depends="generate-impl, library-impl"/>
<target name="clean" depends="log, setenv, init.taskdef"
description="Cleans everything">
<foreach-version targets="clean-impl"/>
</target>
<target name="tests.clean" depends="log, setenv, init.taskdef"
description="Cleans built test files">
<foreach-version targets="tests.clean-impl"/>
</target>
<target name="tests.generate" depends="log, setenv, init.taskdef"
description="Generates and builds all tests">
<foreach-version targets="tests.generate-impl"/>
</target>
<target name="tests.compile" depends="log, setenv, init.taskdef"
description="Builds all tests without recalling generator">
<foreach-version targets="tests.compile-impl"/>
</target>
<target name="tests.compile.native" depends="log, setenv, init.taskdef"
description="Builds native test components">
<foreach-version targets="tests.compile.native-impl"/>
</target>
<target name="tests.compile.java" depends="log, setenv, init.taskdef"
description="Builds java test components">
<foreach-version targets="tests.compile.java-impl"/>
</target>
<target name="tests.compile.plugins" depends="log, setenv, init.taskdef"
description="Builds plugins test components">
<foreach-version targets="tests.compile.plugins-impl"/>
</target>
<target name="tests.run" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.run-impl"/>
</target>
<target name="tests.run.all" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.run.all-impl"/>
</target>
<target name="tests.release.run" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.release.run-impl"/>
</target>
<target name="tests.debug.run" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.debug.run-impl"/>
</target>
<target name="tests.release.run8" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.release.run8-impl"/>
</target>
<target name="tests.debug.run8" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.debug.run8-impl"/>
</target>
<target name="tests.release.run.all" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.release.run.all-impl"/>
</target>
<target name="tests.debug.run.all" depends="log, setenv, init.taskdef"
description="Runs tests and generates report in TestReport subdir">
<foreach-version targets="tests.debug.run.all-impl"/>
</target>
<target name="deploy.snapshot" depends="log, setenv, init.taskdef"
description="Publishes QtJambi as Maven artifact snapshot.">
<foreach-version targets="init.build,deploy-snapshot"/>
</target>
<target name="deploy.release" depends="log, setenv, init.taskdef"
description="Publishes QtJambi as Maven artifact.">
<foreach-version targets="init.build,deploy-release"/>
</target>
<target name="deploy.bundle" depends="log, setenv, init.taskdef"
description="Publishes QtJambi as Maven artifact.">
<foreach-version targets="init.build,deploy-bundle"/>
</target>
<target name="deploy.bundle.release" depends="log, setenv, init.taskdef"
description="Publishes QtJambi as Maven artifact.">
<foreach-version targets="init.build,deploy-release,deploy-bundle"/>
</target>
<target name="test" depends="log, setenv, init.taskdef"
description="Publishes QtJambi as Maven artifact.">
<foreach-version targets="init.build,finished"/>
</target>
</project>