forked from orbeon/orbeon-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
683 lines (609 loc) · 32.3 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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
<!--
Copyright (C) 2004-2014 Orbeon, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License as published by the Free Software Foundation; either version
2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<project name="orbeon" default="orbeon-dev-war" xmlns:xdb="http://exist-db.org/ant">
<!-- Properties to update when version number changes -->
<property name="version.number" value="2022.1-SNAPSHOT"/>
<property name="edition" value="CE"/>
<property file="build-local.properties"/>
<!-- Expose environment variables -->
<property environment="env"/>
<taskdef name="jarjar" classname="org.pantsbuild.jarjar.JarJarTask">
<classpath>
<pathelement location="lib_ant/jarjar-1.7.2.jar"/>
<pathelement location="lib_ant/asm-7.0.jar"/>
<pathelement location="lib_ant/asm-commons-7.0.jar"/>
<pathelement location="lib_ant/asm-tree-7.0.jar"/>
<pathelement location="lib_ant/asm-analysis-7.0.jar"/>
<pathelement location="lib_ant/maven-plugin-api-3.3.9.jar"/>
</classpath>
</taskdef>
<!-- ant-contrib, for tasks like <if> -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib_ant/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<taskdef resource="proguard/ant/task.properties">
<classpath>
<pathelement location="lib_ant/proguard-7.2.1.jar"/>
<pathelement location="lib_ant/proguard-ant-7.2.1.jar"/>
</classpath>
</taskdef>
<!--
These JARs are checked in. They can be rebuilt with the jarjar target
- xerces-2.12-orbeon.jar
- msv-20081113-orbeon.jar
For directory scanner and SSH support:
- ant-1_6_5.jar
For SSH support (currently in oxf:file processor)
- ant-jsch-1_6_5.jar
- jsch-0.1.42.jar
For the XQuery Processor:
- xqjapi.jar
- xqj2-0.0.1.jar
- exist-xqj-1.0.1.jar
oxf:pdf-to-image:
- icepdf-core-5.1.1.jar
- jai-imageio-core-1.3.1-SNAPSHOT.jar
- jai-core-1.1.3.jar
-->
<target name="init">
<tstamp>
<format property="time" pattern="yyyyMMddHHmm" timezone="GMT"/>
</tstamp>
<property name="release.number" value="${version.number}.${time}"/>
<property name="versioned-name" value="orbeon-${release.number}-${edition}"/>
<property name="unversioned-name" value="orbeon-${edition}"/>
<property name="versioned-proxy-portlet-name" value="orbeon-${release.number}-proxy-portlet"/>
<property name="unversioned-proxy-portlet-name" value="orbeon-proxy-portlet"/>
<!-- User-friendly message -->
<echo message="Building Orbeon Forms ${release.number}"/>
<echo message="Using Ant ${ant.version}"/>
</target>
<target name="sbt-clean" depends="init" description="Remove all sbt-generated files">
<exec executable="sbt" failonerror="true">
<!-- sbt options are in `.sbtopts` -->
<arg value="-Dorbeon.version=${release.number}"/>
<arg value="-Dorbeon.edition=${edition}"/>
<arg value="project root"/>
<arg value="clean"/>
</exec>
</target>
<target name="clean-keep-exist" depends="sbt-clean" description="Remove all generated files except the local eXist database">
<delete includeEmptyDirs="true">
<fileset dir="build">
<exclude name="orbeon-war/WEB-INF/exist-data"/>
<exclude name="orbeon-war/WEB-INF/exist-data/**"/>
</fileset>
</delete>
</target>
<target name="clean" depends="clean-keep-exist" description="Remove all generated files except the local eXist database"/>
<target name="mega-clean" depends="sbt-clean" description="Remove all generated files">
<delete dir="build"/>
</target>
<target name="prepare" depends="init">
<mkdir dir="build/lib"/>
</target>
<target name="jarjar" depends="prepare">
<!-- Xerces fat JAR -->
<jarjar jarfile="lib/xerces-2.12-orbeon.jar">
<zipfileset src="lib/src/xerces-xercesImpl-2.12.jar">
<!-- Don't expose any services -->
<exclude name="META-INF/**"/>
<exclude name="org/apache/wml/**"/>
<exclude name="org/apache/html/**"/>
<exclude name="org/w3c/**"/>
</zipfileset>
<zipfileset src="lib/src/xerces-serializer-2.12.jar">
<!-- Don't expose any services -->
<exclude name="META-INF/**"/>
</zipfileset>
<rule pattern="org.apache.**" result="org.orbeon.apache.@1"/>
</jarjar>
<!-- MSV fat JAR -->
<jarjar jarfile="lib/msv-20081113-orbeon.jar">
<zipfileset src="lib/src/msv-20081113_orbeon_20081209.jar"/>
<zipfileset src="lib/src/msv-isorelax-20070407.jar"/>
<zipfileset src="lib/src/msv-relaxngDatatype-20070407.jar"/>
<zipfileset src="lib/src/msv-xsdlib-20070407_orbeon_20120712.jar"/>
<rule pattern="com.sun.msv.**" result="org.orbeon.msv.@1"/>
<rule pattern="com.sun.xml.**" result="org.orbeon.msv.xml.@1"/>
<rule pattern="org.iso_relax.**" result="org.orbeon.msv.iso_relax.@1"/>
<rule pattern="jp.gr.xml.relax.**" result="org.orbeon.msv.gr.xml.relax.@1"/>
<rule pattern="org.relaxng.datatype.**" result="org.orbeon.msv.relaxng.datatype.@1"/>
</jarjar>
</target>
<target name="xforms-filter-jar" depends="war-common">
<!-- <target name="xforms-filter-jar" depends="prepare">-->
<local name="temp.jar"/>
<tempfile property="temp.jar" prefix="proguard" suffix=".jar" destdir="build/temp" deleteonexit="true"/>
<proguard>
-verbose
-dontobfuscate
-dontnote
-forceprocessing
-optimizations !method/inlining/unique,!method/inlining/short
<!-- -whyareyoukeeping class org.orbeon.saxon.om.NodeInfo-->
-injars orbeon-war/jvm/target/webapp/WEB-INF/lib/(!orbeon-form-builder*.jar,!orbeon-form-runner*.jar,orbeon-*.jar;)
-injars orbeon-war/jvm/target/webapp/WEB-INF/lib/(scala-*.jar,parboiled*.jar,enumeratum*.jar,circe-*.jar,cats-*.jar,jawn-*.jar,sbinary*.jar,log4s*.jar,shapeless*.jar,autowire*.jar;)
-injars orbeon-war/jvm/target/webapp/WEB-INF/lib/(commons-fileupload-*.jar,commons-pool-*.jar,commons-io-*,commons-lang3-*.jar,commons-codec-*.jar,commons-collections4-*.jar;)
-injars orbeon-war/jvm/target/webapp/WEB-INF/lib/(saxon-*.jar,http*.jar,jcl-over-slf4j-*.jar,log4j-*.jar;)
-injars orbeon-war/jvm/target/webapp/WEB-INF/lib/ehcache-2.10.9.2.jar
-injars orbeon-war/jvm/target/webapp/WEB-INF/lib/(tink-*.jar,gson-*.jar,protobuf-*.jar;)
-injars orbeon-war/jvm/target/webapp/WEB-INF/lib/(javax.activation-*.jar;)
<!-- -ignorewarnings-->
-dontwarn net.sf.ehcache.**
-dontwarn org.terracotta.**
-dontwarn org.apache.http.auth.KerberosCredentials
-dontwarn org.apache.http.impl.auth.**
-dontwarn org.apache.http.impl.client.cache.memcached.**
-dontwarn org.orbeon.saxon.ant.**
-dontwarn org.orbeon.saxon.xqj.**
-dontwarn com.google.crypto.tink.**
-dontwarn com.google.protobuf.**
-dontwarn org.apache.logging.log4j.core.**
-dontwarn org.apache.logging.log4j.util.**
-dontwarn org.slf4j.ext.**
-dontwarn org.orbeon.apache.xerces.**
-dontwarn org.orbeon.oxf.xml.xerces.**
-dontwarn scala.collection.immutable.VM
-dontwarn scala.reflect.**
-dontwarn scala.tools.nsc.**
-dontwarn javax.jms.**
-dontwarn javax.mail.**
-dontwarn org.orbeon.oxf.processor.**
-dontwarn org.orbeon.oxf.util.ImageMetadata**
-dontwarn org.orbeon.oxf.util.ImageSupport**
-dontwarn org.orbeon.xforms.**
-dontwarn org.orbeon.oxf.xforms.**
-libraryjars ${java.home}/jmods(java/**.class,javax/**.class,org/w3c/**.class,org/xml/**.class)
-libraryjars orbeon-war/jvm/target/webapp/WEB-INF/lib/slf4j-api-2.0.3.jar
-libraryjars lib/proguard/(javax.servlet-api-*.jar;)
-libraryjars lib/proguard/(portlet-api-*.jar;)
-libraryjars lib/proguard/(liferay-portal-service-*.jar;)
-libraryjars lib/proguard/(liferay-portal-kernel-*.jar;)
-outjars ${temp.jar}(**.class,!**)
-keep public class org.orbeon.oxf.servlet.OrbeonXFormsFilter {
public static *;
}
</proguard>
<jarjar jarfile="build/lib/orbeon-xforms-filter.jar">
<zipfileset src="${temp.jar}"/>
<rule pattern="org.orbeon.oxf.servlet.OrbeonXFormsFilter*" result="org.orbeon.oxf.servlet.OrbeonXFormsFilter@1"/>
<rule pattern="org.orbeon.**" result="org.orbeon.private.orbeon.@1"/>
<rule pattern="org.apache.**" result="org.orbeon.private.apache.@1"/>
<rule pattern="com.google.**" result="org.orbeon.private.google.@1"/>
<rule pattern="scala.**" result="org.orbeon.private.scala.@1"/>
<rule pattern="enumeratum.**" result="org.orbeon.private.enumeratum.@1"/>
</jarjar>
<delete file="${temp.jar}"/>
</target>
<target name="war-common" depends="prepare">
<exec executable="sbt" failonerror="true">
<!-- sbt options are in `.sbtopts` -->
<arg value="-Dorbeon.version=${release.number}"/>
<arg value="-Dorbeon.edition=${edition}"/>
<arg value="project root"/>
<arg value="package"/>
</exec>
</target>
<target name="orbeon-dev-war" depends="war-common" description="Create exploded WAR">
<copy todir="build/orbeon-war">
<fileset dir="orbeon-war/jvm/target/webapp">
<!-- Filter local eXist that that might (but shouldn't) be in there -->
<exclude name="WEB-INF/exist-data/**"/>
</fileset>
</copy>
</target>
<target name="orbeon-dist-war" depends="war-common, exist-import-sample-data-to-build" description="Creates Orbeon Forms WAR">
<mkdir dir="build/distrib"/>
<zip zipfile="build/distrib/${versioned-name}.war">
<zipfileset dir="orbeon-war/jvm/target/webapp">
<!-- Filter local eXist that that might (but shouldn't) be in there -->
<exclude name="WEB-INF/exist-data/**"/>
<exclude name="WEB-INF/lib/orbeon-embedding.jar"/>
<exclude name="WEB-INF/lib/orbeon-proxy-portlet.jar"/>
</zipfileset>
<!-- eXist sample database -->
<zipfileset dir="build/exist-data" prefix="WEB-INF/exist-data">
<exclude name="*.log"/>
<exclude name="*.lck"/>
</zipfileset>
</zip>
</target>
<target name="xforms-filter-war" depends="xforms-filter-jar" description="Create XForms filter WAR">
<mkdir dir="build/distrib"/>
<war destfile="build/distrib/orbeon-${release.number}-xforms-filter.war">
<webinf dir="descriptors/xforms-filter/WEB-INF"/>
<lib dir="build/lib">
<include name="orbeon-xforms-filter.jar"/>
</lib>
<zipfileset dir="descriptors/xforms-filter" prefix="">
<include name="*.jsp"/>
</zipfileset>
</war>
</target>
<target name="orbeon-auth-war" depends="war-common" description="Creates Orbeon Forms orbeon-auth.war">
<mkdir dir="build/distrib"/>
<war destfile="build/distrib/orbeon-auth.war" webxml="descriptors/orbeon-auth-war/web.xml">
<zipfileset dir="src/target/scala-2.12/classes" prefix="WEB-INF/classes">
<include name="org/orbeon/oxf/controller/AuthorizerServlet*.class"/>
</zipfileset>
</war>
</target>
<!-- Zip sources file -->
<target name="orbeon-src" depends="prepare" description="Create Zip file with the sources">
<mkdir dir="build/distrib"/>
<zip zipfile="build/distrib/${versioned-name}-src.zip">
<zipfileset dir="${basedir}">
<exclude name="**/.git"/>
<exclude name="**/.git/**"/>
<exclude name="build"/>
<exclude name="build/**"/>
<exclude name="**/target"/>
<exclude name="**/target/**"/>
<exclude name="cache"/>
<exclude name="cache/**"/>
<exclude name="tmp"/>
<exclude name="tmp/**"/>
<exclude name="tools"/>
<exclude name="tools/**"/>
<exclude name="resources-local"/>
<exclude name="resources-local/**"/>
<exclude name="src/resources-local"/>
<exclude name="src/resources-local/**"/>
<!-- In case there were some temporary files left by the ProGuard tasks here -->
<exclude name="*.jar"/>
<!-- In case there are some leftover log files -->
<exclude name="*.log"/>
<!-- Not sure why JUnit outputs those here -->
<exclude name="junit*.properties"/>
<!-- Don't include a license with the source -->
<exclude name="**/license.xml"/>
<exclude name="**/orbeon-private.xml"/>
<!-- No travis build -->
<exclude name=".travis.yml"/>
</zipfileset>
</zip>
</target>
<target name="test-expand-war" depends="orbeon-dist-war">
<!-- Uncompress WAR -->
<unzip src="build/distrib/${versioned-name}.war" dest="build/orbeon-war-tomcat"/>
<!-- Copy test resources -->
<!-- TODO: We're mixing here the resources used by standalone tests and tests running in Tomcat -->
<mkdir dir="build/orbeon-war-tomcat/WEB-INF/resources/apps/unit-tests"/>
<copy todir="build/orbeon-war-tomcat/WEB-INF/resources">
<fileset dir="src/test/resources/">
<include name="apps/unit-tests/**"/>
<include name="config/**"/>
</fileset>
</copy>
</target>
<target name="skip-selenium">
<property name="skip.selenium" value="true"/>
</target>
<target name="skip-database">
<property name="skip.database" value="true"/>
</target>
<target name="test-unit" depends="init">
<exec executable="sbt" failonerror="true">
<!-- sbt options are in `.sbtopts` -->
<arg value="-Dorbeon.version=${release.number}"/>
<arg value="-Dorbeon.edition=${edition}"/>
<arg value="project root"/>
<arg value="test:test"/>
<arg value="db:test"/>
</exec>
</target>
<!-- TODO -->
<target name="test-integration" depends="test-expand-war">
<property name="tomcat-version" value="6.0.36"/>
<parallel failonany="true">
<property name="oracle.driver" value="oracle.jdbc.OracleDriver"/>
<property name="oracle.jar" value="lib/test/ojdbc6_g.jar"/>
<property name="mysql.driver" value="com.mysql.jdbc.Driver"/>
<property name="mysql.jar" value="lib/test/mysql-connector-java-5.1.26-bin.jar"/>
<property name="sqlserver.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="sqlserver.jar" value="lib/test/sqljdbc4.jar"/>
<property name="postgresql.driver" value="org.postgresql.Driver"/>
<property name="postgresql.jar" value="lib/test/postgresql-9.3-1102.jdbc4.jar"/>
<!-- Run Tomcat -->
<sequential>
<if>
<not><isset property="skip.selenium"/></not>
<then>
<!-- Only keep the 10 most recent databases on SQL Server -->
<!-- - Set delimiter to character we don't use, so the task doesn't spit the command on ';' -->
<sql driver="${sqlserver.driver}" url="${env.SQLSERVER_URL}"
userid="orbeon" password="${env.RDS_PASSWORD}"
expandProperties="true" delimiter="~"
autocommit="true">
<classpath><pathelement location="${sqlserver.jar}"/></classpath>
BEGIN
DECLARE @qry nvarchar(max);
SELECT @qry =
(
SELECT 'DROP DATABASE ' + to_drop.name + '; '
FROM
(
SELECT all_dbs.name
FROM
(
SELECT row_number() OVER (ORDER BY name DESC) AS row,
name
FROM sys.databases
WHERE name LIKE 'orbeon_%_tomcat'
) all_dbs
WHERE all_dbs.row > 10
) to_drop
WHERE name LIKE 'orbeon_%_tomcat'
FOR XML PATH('')
);
EXEC sp_executesql @qry;
END;
</sql>
<!-- Create schemas -->
<sql driver="${oracle.driver}" url="${env.ORACLE_URL}" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true">
<classpath><pathelement location="${oracle.jar}"/></classpath>
CREATE USER orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat IDENTIFIED BY ${env.RDS_PASSWORD};
ALTER USER orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat QUOTA UNLIMITED ON users;
GRANT CREATE SESSION TO orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
GRANT CREATE TABLE TO orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
GRANT CREATE TRIGGER TO orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
</sql>
<sql driver="${mysql.driver}" url="${env.MYSQL_URL}" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true">
<classpath><pathelement location="${mysql.jar}"/></classpath>
CREATE DATABASE orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
</sql>
<sql driver="${sqlserver.driver}" url="${env.SQLSERVER_URL}" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true">
<classpath><pathelement location="${sqlserver.jar}"/></classpath>
CREATE DATABASE orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
</sql>
<sql driver="${postgresql.driver}" url="${env.POSTGRESQL_URL}/orbeon" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true" autocommit="true">
<classpath><pathelement location="${postgresql.jar}"/></classpath>
CREATE DATABASE orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
</sql>
<!-- Uncompress Tomcat -->
<if>
<not><available file="build/apache-tomcat-${tomcat-version}"/></not>
<then><unzip src="test/lib/apache-tomcat-${tomcat-version}.zip" dest="build"/></then>
</if>
<!-- Put database driver in Tomcat's lib -->
<copy file="${mysql.jar}" todir="build/apache-tomcat-${tomcat-version}/lib"/>
<copy file="${oracle.jar}" todir="build/apache-tomcat-${tomcat-version}/lib"/>
<copy file="${sqlserver.jar}" todir="build/apache-tomcat-${tomcat-version}/lib"/>
<copy file="${postgresql.jar}" todir="build/apache-tomcat-${tomcat-version}/lib"/>
<!-- Put URL and passwords in Tomcat's server.xml -->
<replace file="test/catalina_base/conf/server.xml">
<replacefilter token="@RDS_PASSWORD@" value="${env.RDS_PASSWORD}"/>
<replacefilter token="@TRAVIS_BUILD_NUMBER@" value="${env.TRAVIS_BUILD_NUMBER}"/>
<replacefilter token="@ORACLE_URL@" value="${env.ORACLE_URL}"/>
<replacefilter token="@MYSQL_URL@" value="${env.MYSQL_URL}"/>
<replacefilter token="@SQLSERVER_URL@" value="${env.SQLSERVER_URL}"/>
<replacefilter token="@POSTGRESQL_URL@" value="${env.POSTGRESQL_URL}"/>
</replace>
<!-- Run -->
<java jar="build/apache-tomcat-${tomcat-version}/bin/bootstrap.jar" fork="true" taskname="tomcat">
<jvmarg value="-Dcatalina.home=build/apache-tomcat-${tomcat-version}"/>
<jvmarg value="-Dcatalina.base=test/catalina_base"/>
<jvmarg line="-server -verbosegc -Xms256m -Xmx1024m -Djava.awt.headless=true -XX:+PerfDisableSharedMem"/>
<jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=61155"/>
</java>
<delete dir="test/catalina_base/work"/>
</then>
</if>
</sequential>
<sequential>
<if>
<not><isset property="skip.selenium"/></not>
<then>
<!-- Wait for Tomcat to start -->
<waitfor maxwait="1" maxwaitunit="minute" checkevery="200">
<http url="http://localhost:8080/orbeon/home/"/>
</waitfor>
</then>
</if>
<delete dir="build/temp/test"/>
<mkdir dir="build/temp/test"/>
<delete dir="src/resources-packaged/ops/unit-tests/exist-data"/>
<mkdir dir="src/resources-packaged/ops/unit-tests/exist-data"/>
<!-- Run sbt tests -->
<exec executable="sbt" failonerror="true">
<!-- sbt options are in `.sbtopts` -->
<arg value="-Dorbeon.version=${release.number}"/>
<arg value="-Dorbeon.edition=${edition}"/>
<arg value="project root"/>
<arg value="test:test"/>
<arg value="db:test"/>
</exec>
<!-- Stop Tomcat -->
<if>
<not><isset property="skip.selenium"/></not>
<then>
<!-- Stop Tomcat -->
<java jar="build/apache-tomcat-${tomcat-version}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=build/apache-tomcat-${tomcat-version}"/>
<arg line="stop"/>
</java>
<!-- If we don't wait for Tomcat to be really stopped, databases won't let us users/schemas we're connected to
(todo: find a better way to know when Tomcat has properly shut down) -->
<sleep seconds="20"/>
<!-- Delete schemas -->
<sql driver="${oracle.driver}" url="${env.ORACLE_URL}" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true">
<classpath><pathelement location="${oracle.jar}"/></classpath>
DROP USER orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat CASCADE;
</sql>
<sql driver="${mysql.driver}" url="${env.MYSQL_URL}" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true">
<classpath><pathelement location="${mysql.jar}"/></classpath>
DROP DATABASE orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
</sql>
<sql driver="${sqlserver.driver}" url="${env.SQLSERVER_URL}" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true">
<classpath><pathelement location="${sqlserver.jar}"/></classpath>
DROP DATABASE orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
</sql>
<sql driver="${postgresql.driver}" url="${env.POSTGRESQL_URL}/orbeon" userid="orbeon" password="${env.RDS_PASSWORD}" expandProperties="true" autocommit="true">
<classpath><pathelement location="${postgresql.jar}"/></classpath>
DROP DATABASE orbeon_${env.TRAVIS_BUILD_NUMBER}_tomcat;
</sql>
</then>
</if>
</sequential>
</parallel>
</target>
<target name="orbeon-dist-packages" depends="orbeon-dist-war, xforms-filter-war, orbeon-auth-war, orbeon-src">
<!-- Create temporary zip file -->
<property name="tmp-zip" value="build/distrib/${versioned-name}-tmp.zip"/>
<zip zipfile="${tmp-zip}">
<zipfileset dir="build/distrib" fullpath="${versioned-name}/orbeon.war">
<include name="${versioned-name}.war"/>
</zipfileset>
<zipfileset dir="build/distrib" fullpath="${versioned-name}/orbeon-xforms-filter.war">
<include name="orbeon-${release.number}-xforms-filter.war"/>
</zipfileset>
<zipfileset dir="build/distrib" fullpath="${versioned-name}/orbeon-auth.war">
<include name="orbeon-auth.war"/>
</zipfileset>
<zipfileset file="README.md" prefix="${versioned-name}"/>
<zipfileset file="README.md" fullpath="${versioned-name}/README.txt"/>
<zipfileset file="LICENSE.txt" prefix="${versioned-name}"/>
<zipfileset dir="third-party-licenses" prefix="${versioned-name}/third-party-licenses"/>
</zip>
<!-- Fix EOL for Windows platform -->
<delete dir="build/temp/distrib"/>
<mkdir dir="build/temp/distrib"/>
<unzip src="${tmp-zip}" dest="build/temp/distrib"/>
<fixcrlf srcDir="build/temp/distrib" eol="crlf">
<include name="**/*.txt"/>
<include name="**/*.xml"/>
<include name="**/*.xsl"/>
<include name="**/*.xpl"/>
<include name="**/*.jsp"/>
<include name="**/*.jspx"/>
<include name="**/*.html"/>
<include name="**/*.htm"/>
<include name="**/*.js"/>
<include name="**/*.css"/>
<include name="**/*.java"/>
<include name="**/*.properties"/>
<include name="**/*.rng"/>
<include name="**/*.xsd"/>
<include name="**/*.xhtml"/>
<include name="**/*.wsdl"/>
</fixcrlf>
<zip zipfile="build/distrib/${versioned-name}.zip" basedir="build/temp/distrib"/>
<delete file="${tmp-zip}"/>
</target>
<target name="orbeon-dist-checksum" depends="orbeon-dist-packages">
<!-- Create md5 for all files -->
<checksum algorithm="MD5">
<fileset dir="build/distrib">
<include name="*.*"/>
</fileset>
</checksum>
</target>
<target name="orbeon-dist" depends="orbeon-dist-checksum"/>
<target name="exist-task" depends="war-common">
<!-- eXist tasks -->
<!-- http://exist-db.org/ant-tasks.html -->
<typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
<classpath>
<fileset dir="orbeon-war/jvm/target/webapp/WEB-INF/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</typedef>
</target>
<target name="exist-export-from-web-inf" depends="exist-task">
<delete dir="build/exist-data-exported"/>
<mkdir dir="build/exist-data-exported"/>
<xdb:extract
configuration="build/orbeon-war/WEB-INF/exist-conf.xml"
uri="xmldb:exist:///db"
initDb="true"
destdir="build/exist-data-exported"
subcollections="true"
createdirectories="true"/>
<move todir="build/exist-data-exported" includeEmptyDirs="false">
<fileset dir="build/exist-data-exported">
<include name="**/*.xhtml.xml"/>
</fileset>
<globmapper from="*.xhtml.xml" to="*.xhtml"/>
</move>
</target>
<target name="exist-import-sample-data-to-build" depends="exist-task">
<delete dir="build/exist-data"/>
<mkdir dir="build/exist-data"/>
<!-- Store config first -->
<xdb:store
configuration="${basedir}/descriptors/ant-exist-conf.xml"
uri="xmldb:exist:///db"
initDb="true"
createcollection="true"
createsubcollections="true"
user="admin"
password="">
<fileset dir="data">
<include name="system/**"/>
</fileset>
</xdb:store>
<!-- Store data -->
<xdb:store
configuration="${basedir}/descriptors/ant-exist-conf.xml"
uri="xmldb:exist:///db"
initDb="true"
createcollection="true"
createsubcollections="true"
user="guest"
password="guest">
<fileset dir="data">
<include name="orbeon/**"/>
</fileset>
</xdb:store>
<!-- Make sure the database is shut down -->
<xdb:shutdown
configuration="${basedir}/descriptors/ant-exist-conf.xml"
uri="xmldb:exist:///db"
user="admin"
password=""/>
</target>
<!--
For this to work:
- Comment out the eXist security filter in web.xml.
- Enable the xmlrpc servlet in web.xml.
- Start Orbeon Forms and access a form that requires eXist first.
-->
<target name="exist-import-sample-data-to-localhost" depends="exist-task">
<!-- Store config first -->
<xdb:store
uri="xmldb:exist://localhost:8080/orbeon/exist/xmlrpc/db"
initDb="true"
createcollection="true"
createsubcollections="true"
user="admin"
password="">
<fileset dir="data">
<include name="system/**"/>
</fileset>
</xdb:store>
<!-- Store data only -->
<xdb:store
uri="xmldb:exist://localhost:8080/orbeon/exist/xmlrpc/db"
initDb="true"
createcollection="true"
createsubcollections="true"
user="guest"
password="guest">
<fileset dir="data">
<include name="orbeon/**"/>
</fileset>
</xdb:store>
</target>
</project>