-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
805 lines (731 loc) · 34.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
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
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
<project name="esup-ecm-config" default="deploy">
<property file="build.properties"/>
<property file="default.properties"/>
<property file="ori.properties" />
<property name="unused.component.dir" value="unused"/>
<property name="utils.dir" value="${basedir}/utils" />
<property name="jboss.log4j.level" value="INFO"/>
<property name="esup-ecm.file" value="${esup-ecm.version}" />
<condition property="isMysql" value="true">
<equals arg1="${db.type}" arg2="MySQL"/>
</condition>
<condition property="isPostGresSql" value="true">
<equals arg1="${db.type}" arg2="PostgreSQL"/>
</condition>
<taskdef
resource="net/sf/antcontrib/antlib.xml"
classpath="ant-utils/ant-contrib-1.0.jar"/>
<target name="server">
<if>
<equals arg1="${server}" arg2="jboss"/>
<then>
<property name="nuxeo-dm.file" value="nuxeo-dm-5.3.1-jboss_02.zip"/>
<property name="nuxeo-dm-unziped.file" value="${nuxeo.dir.parent}/nuxeo-dm-5.3.1-jboss/server/default/deploy/nuxeo.ear/nuxeo.war/WEB-INF/web.xml"/>
<property name="nuxeo.dir" value="${nuxeo.dir.parent}/nuxeo-dm-5.3.1-jboss"/>
<property name="plugins.dir" value="${nuxeo.dir}/server/default/deploy/nuxeo.ear/plugins"/>
<property name="config.dir" value="${nuxeo.dir}/server/default/deploy/nuxeo.ear/config"/>
</then>
</if>
<if>
<equals arg1="${server}" arg2="tomcat"/>
<then>
<echo message="**************************************************************************************************************"/>
<echo message="**************************************************************************************************************"/>
<echo message="********* ************"/>
<echo message="********* ************"/>
<echo message="********* -- TOMCAT -- ************"/>
<echo message="********* ************"/>
<echo message="********* DO NOT USE IN PRODUCTION ************"/>
<echo message="********* ************"/>
<echo message="********* ************"/>
<echo message="**************************************************************************************************************"/>
<echo message="**************************************************************************************************************"/>
<property name="nuxeo-dm.file" value="nuxeo-dm-5.3.0-GA-tomcat.zip"/>
<property name="nuxeo-dm-unziped.file" value="${nuxeo.dir.parent}/nuxeo-distribution-tomcat/nxserver/nuxeo.war/WEB-INF/web.xml"/>
<property name="nuxeo.dir" value="${nuxeo.dir.parent}/nuxeo-distribution-tomcat"/>
<property name="plugins.dir" value="${nuxeo.dir}/nxserver/bundles"/>
<property name="config.dir" value="${nuxeo.dir}/nxserver/config"/>
</then>
</if>
</target>
<target name="prepare" depends="server">
<mkdir dir="${unused.component.dir}"/>
<touch file="${unused.component.dir}/doNotDelete"/>
<mkdir dir="build"/>
<mkdir dir="build"/>
<mkdir dir="build/jboss"/>
<mkdir dir="build/tomcat"/>
<mkdir dir="build/nxOOo"/>
<mkdir dir="build/esup-ecm-config-plugin"/>
<mkdir dir="packages"/>
<available file="packages/${nuxeo-dm.file}" property="nuxeo-dm.file.present" />
<available file="${nuxeo-dm-unziped.file}" property="nuxeo-dm.unziped.file.present" />
<antcall target="get.nuxeo-dm.file" />
<antcall target="download-maven"/>
<chmod dir="${maven.bin}" perm="755" includes="**/mvn*"/>
</target>
<target name="get.nuxeo-dm.file" unless="nuxeo-dm.file.present">
<echo message="Download ${nuxeo-dm.file} in the packages directory."/>
<echo message="Ce téléchargement peut prendre plusieurs minutes..."/>
<get src="http://www.nuxeo.org/static/releases/nuxeo-5.3.1/${nuxeo-dm.file}" dest="packages/${nuxeo-dm.file}" verbose="false"/>
</target>
<target name="deploy.nuxeo" depends="prepare">
<antcall target="deploy.nuxeo.dm" />
</target>
<target name="deploy.nuxeo.dm" unless="nuxeo-dm.unziped.file.present">
<unzip src="packages/${nuxeo-dm.file}" dest="${nuxeo.dir.parent}" />
</target>
<target name="clean" description="clean build">
<delete dir="build"/>
<delete dir="packages"/>
<delete dir="esup-ecm-config-plugin/target"/>
<delete dir="${unused.component.dir}" />
</target>
<target name="copy.src.build" depends="prepare">
<copy todir="build" overwrite="yes">
<fileset dir="db-configs"/>
</copy>
<copy todir="build/jboss" overwrite="yes">
<fileset dir="jboss"/>
</copy>
<copy todir="build/tomcat" overwrite="yes">
<fileset dir="tomcat"/>
</copy>
<!-- delete to avoid unexpected deleted files -->
<delete dir="build/esup-ecm-config-plugin"/>
<copy todir="build/esup-ecm-config-plugin" overwrite="yes">
<fileset dir="esup-ecm-config-plugin"/>
</copy>
<copy todir="build/nxOOo" overwrite="yes">
<fileset dir="nxOOo"/>
</copy>
<copy todir="build/esup-ecm-config-plugin/src/main/resources/nuxeo.war/img" overwrite="yes">
<fileset dir="nxOOo"/>
</copy>
</target>
<target name="replace.token.config" depends="copy.src.build">
<echo message="Update databases description files" />
<replace dir="build" includes="config/*.xml,config/sql.properties,datasources/*.xml,tomcat/*.xml">
<replacefilter
token="@databaseType@" value="${db.type}" />
<replacefilter
token="@jdbcDriver@" value="${db.driver}" />
<replacefilter
token="@db.jdbc.options@" value="${db.jdbc.options}" />
<replacefilter
token="@sqlServer@" value="${db.server}" />
<replacefilter
token="@sqlPort@" value="${db.port}" />
<replacefilter
token="@sqlDb@" value="${db.name}" />
<replacefilter
token="@sqlUser@" value="${db.user}" />
<replacefilter
token="@sqlPassword@" value="${db.password}" />
<replacefilter
token="@sqlStorageServer@" value="${db.storage.server}" />
<replacefilter
token="@sqlStoragePort@" value="${db.storage.port}" />
<replacefilter
token="@sqlStorageDb@" value="${db.storage.name}" />
<replacefilter
token="@sqlStorageUser@" value="${db.storage.user}" />
<replacefilter
token="@sqlStoragePassword@" value="${db.storage.password}" />
</replace>
<echo message="Update configuration plugin files" />
<!-- tools -->
<replace file="build/jboss/jbossctl" >
<replacefilter token="@jbossUser@" value="${jboss.user}" />
<replacefilter token="@jbossHome@" value="${nuxeo.dir}" />
<replacefilter token="@jbossBindAdress@" value="${jboss.bind.address}" />
<replacefilter token="@jdkHome@" value="${jdk.home}" />
<replacefilter token="@consoleLog@" value="${jboss.console.log}" />
<replacefilter token="@serverLog@" value="${jboss.server.log}" />
</replace>
<replace file="build/jboss/server.xml">
<replacefilter token="@tomcatPortHttp@" value="${tomcat.port.http}" />
<replacefilter token="@tomcatPortJk@" value="${tomcat.port.jk}" />
</replace>
<replace file="build/tomcat/server.xml">
<replacefilter token="@tomcatPortHttp@" value="${tomcat.port.http}" />
<replacefilter token="@tomcatPortJk@" value="${tomcat.port.jk}" />
</replace>
<replace file="build/jboss/jboss-log4j.xml">
<replacefilter token="@threshold@" value="${jboss.log4j.level}" />
<replacefilter token="@serverLog@" value="${jboss.server.log}" />
</replace>
<replace file="build/nxOOo/nxopenoffice">
<replacefilter token="@OOoPort@" value="${openoffice.port}" />
<replacefilter token="@OOoPath@" value="${openoffice.home}" />
</replace>
<!-- build.properties -->
<replace file="build/esup-ecm-config-plugin/build.properties"
token="@nuxeo.dir@" value="${nuxeo.dir}" />
<replace file="build/esup-ecm-config-plugin/build.properties"
token="@server@" value="${server}" />
<replace file="build/esup-ecm-config-plugin/build.properties"
token="@plugins.dir@" value="${plugins.dir}" />
<!-- Nuxeo properties -->
<replace file="build/config/nuxeo.properties">
<replacefilter token="@instanceName@" value="${ecm.instance.name}" />
<replacefilter token="@instanceDescription@" value="${ecm.instance.description}" />
<replacefilter token="@productName@" value="${ecm.product.name}" />
<replacefilter token="@productVersion@" value="${esup-ecm.version}" />
</replace>
<!-- auth -->
<if>
<equals arg1="${auth.plugin}" arg2="ldap"/>
<then>
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/esup-login-contrib.xml">
<replacefilter token="@begin.use.cas@" value="<!-- " />
<replacefilter token="@end.use.cas@" value=" -->" />
<replacefilter token="@begin.use.ldap@" value="" />
<replacefilter token="@end.use.ldap@" value="" />
</replace>
</then>
<else>
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/esup-login-contrib.xml">
<replacefilter token="@begin.use.cas@" value="" />
<replacefilter token="@end.use.cas@" value="" />
<replacefilter token="@begin.use.ldap@" value="<!-- " />
<replacefilter token="@end.use.ldap@" value=" -->" />
</replace>
</else>
</if>
<!-- CAS -->
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/esup-login-contrib.xml"
token="@sso-cas-url@" value="${cas.url}" />
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/esup-login-contrib.xml"
token="@nuxeo-url@" value="${nuxeo.url}" />
<!-- LDAP -->
<replace file="build/esup-ecm-config-plugin/src/main/resources/config/default-ldap-users-directory-bundle.xml">
<replacefilter token="@ldapUrl@" value="${ldap.url}" />
<replacefilter token="@ldapSearchBaseDn@" value="${ldap.user.searchBaseDn}" />
<replacefilter token="@ldapFirstName@" value="${ldap.user.firstName}" />
<replacefilter token="@ldapLastName@" value="${ldap.user.lastName}" />
<replacefilter token="@ldapCompagny@" value="${ldap.user.company}" />
<replacefilter token="@ldapEmail@" value="${ldap.user.email}" />
</replace>
<!-- not a anonymous LDAP access -->
<if>
<equals arg1="${ldap.bind}" arg2="true"/>
<then>
<replace file="build/esup-ecm-config-plugin/src/main/resources/config/default-ldap-users-directory-bundle.xml">
<replacefilter token="@begin.ldap.bind@" value="" />
<replacefilter token="@end.ldap.bind@" value="" />
<replacefilter token="@ldap.bindDn@" value="${ldap.bindDn}" />
<replacefilter token="@ldap.bindPassword@" value="${ldap.bindPassword}" />
</replace>
</then>
<else>
<replace file="build/esup-ecm-config-plugin/src/main/resources/config/default-ldap-users-directory-bundle.xml">
<replacefilter token="@begin.ldap.bind@" value="<!-- " />
<replacefilter token="@end.ldap.bind@" value=" -->" />
</replace>
</else>
</if>
<replace file="build/esup-ecm-config-plugin/src/main/resources/config/default-ldap-groups-directory-bundle.xml">
<replacefilter token="@ldapSearchBaseDn@" value="${ldap.group.searchBaseDn}" />
</replace>
<!-- NOTIFICATION -->
<replace file="build/config/notification/mail-service.xml">
<replacefilter token="@mail.pop3.host@" value="${mail.pop3.host}" />
<replacefilter token="@mail.smtp.host@" value="${mail.smtp.host}" />
<replacefilter token="@mail.smtp.port@" value="${mail.smtp.port}" />
<replacefilter token="@mail.from@" value="${mail.from}" />
</replace>
<replace file="build/config/notification/notification-config.xml">
<replacefilter token="@nuxeo-url@" value="${nuxeo.url}" />
<replacefilter token="@productName@" value="${ecm.product.name}" />
</replace>
<!-- USER SERVICES -->
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/esup-actions-contrib.xml">
<replacefilter token="@showUserManager@" value="${use.users.manager}" />
<replacefilter token="@showVocabulariesManager@" value="${use.vocabularies.manager}" />
<replacefilter token="@showThemesManager@" value="${use.themes.manager}" />
<replacefilter token="@use.personnal.workspace@" value="${use.personnal.workspace}" />
<replacefilter token="@showUserDashBoard@" value="${show.user.dashboard}" />
<replacefilter token="@showRepository@" value="${show.repository}" />
<replacefilter token="@show.tab.theme@" value="${show.tab.theme}" />
<replacefilter token="@show.tab.metadata@" value="${show.tab.metadata}" />
<replacefilter token="@show.tab.preview@" value="${show.tab.preview}" />
<replacefilter token="@show.tab.files.view@" value="${show.tab.files.view}" />
<replacefilter token="@show.tab.files.edit@" value="${show.tab.files.edit}" />
<replacefilter token="@show.tab.relations@" value="${show.tab.relations}" />
<replacefilter token="@show.tab.workflow@" value="${show.tab.workflow}" />
<replacefilter token="@show.tab.my.subscriptions@" value="${show.tab.my.subscriptions}" />
<replacefilter token="@show.tab.manage.subscriptions@" value="${show.tab.manage.subscriptions}" />
<replacefilter token="@show.tab.content.history@" value="${show.tab.content.history}" />
<replacefilter token="@show.comments@" value="${show.comments}" />
<replacefilter token="@show.document.lock@" value="${show.document.lock}" />
</replace>
<if> <!-- needed for userWorkspaceManagerActions evaluation in esup-actions-contrib.xml -->
<equals arg1="${use.personnal.workspace}" arg2="true"/>
<then>
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/esup-actions-contrib.xml">
<replacefilter token="@begin.use.personnal.workspace@" value="" />
<replacefilter token="@end.use.personnal.workspace@" value="" />
</replace>
</then>
<else>
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/esup-actions-contrib.xml">
<replacefilter token="@begin.use.personnal.workspace@" value="<!-- " />
<replacefilter token="@end.use.personnal.workspace@" value=" -->" />
</replace>
</else>
</if>
<!-- Administrator ID -->
<replace file="build/esup-ecm-config-plugin/src/main/resources/config/default-virtual-groups-bundle.xml">
<replacefilter token="@defaultAdministratorId@" value="${ldap.user.defaultAdministratorId}" />
<replacefilter token="@defaultGroup@" value="${ldap.group.defaultGroup}" />
</replace>
<!-- logo -->
<antcall target="_replace.local.logo" />
<antcall target="_default.local.logo" />
<!-- banner background -->
<basename property="local.banner.background.name" file="${local.banner.background.path}"/>
<replace file="build/esup-ecm-config-plugin/src/main/resources/themes/palettes/esup-etablissementbackgrounds.properties">
<replacefilter token="@backgroundBanner@" value="${local.banner.background.name}" />
<replacefilter token="@cellBackgroundColor@" value="${local.cell.background.color}" />
</replace>
<!-- borders -->
<replace file="build/esup-ecm-config-plugin/src/main/resources/themes/palettes/esup-etablissementborders.properties">
<replacefilter token="@backgroundBanner@" value="${local.banner.background.name}" />
<replacefilter token="@cellBackgroundColor@" value="${local.cell.background.color}" />
</replace>
<!-- startup page -->
<replace file="build/esup-ecm-config-plugin/src/main/resources/OSGI-INF/deployment-fragment.xml">
<replacefilter token="@startupPage@" value="${startup.page}" />
</replace>
</target>
<target name="_replace.local.logo" if="local.logo.path">
<echo message="Install local logo" />
<copy file="${local.logo.path}" todir="build/esup-ecm-config-plugin/src/main/resources/nuxeo.war/img" overwrite="yes"/>
<basename property="local.logo.name" file="${local.logo.path}"/>
<replace file="build/esup-ecm-config-plugin/src/main/resources/nuxeo.war/incl/esup-logo-etablissement.xhtml">
<replacefilter token="@logoEtablissement@" value="${local.logo.name}" />
</replace>
</target>
<target name="_default.local.logo" unless="local.logo.path">
<echo message="Install default logo" />
<basename property="default.logo.name" file="${default.logo.path}"/>
<replace file="build/esup-ecm-config-plugin/src/main/resources/nuxeo.war/incl/esup-logo-etablissement.xhtml">
<replacefilter token="@logoEtablissement@" value="${default.logo.name}" />
</replace>
</target>
<!-- sqlStorage Repository -->
<target name="deploy.sql.storage" depends="deploy.sql.storage.config.postgresql,deploy.sql.storage.config.mysql">
<echo message="Install sql-storage repository" />
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/sql-storage-repository-mysql-ds.xml"/>
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/sql-storage-repository-postgresql-ds.xml"/>
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/nxtags-mysql-ds.xml"/>
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/nxtags-postgresql-ds.xml"/>
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/unified-nuxeo-postgresql-ds.xml"/>
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/unified-nuxeo-mysql-ds.xml"/>
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/config/default-repository-postgresql-mysql.xml"/>
<delete file="${nuxeo.dir}/server/default/deploy/nuxeo.ear/config/default-repository-config-mysql.xml"/>
</target>
<!-- sqlStorage with mysql -->
<target name="deploy.sql.storage.config.mysql" if="isMysql" >
<echo message="Install sql-storage mysql" />
<if>
<equals arg1="${server}" arg2="jboss"/>
<then>
<copy file="build/datasources/sql-storage-repository-mysql-ds.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/default-repository-ds.xml" overwrite="yes"/>
<copy file="build/datasources/nxtags-mysql-ds.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/nxtags-ds.xml" overwrite="yes"/>
<copy file="build/datasources/unified-nuxeo-mysql-ds.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/unified-nuxeo-ds.xml" overwrite="yes"/>
<copy file="build/config/default-repository-config-mysql.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/config/default-repository-config.xml" overwrite="yes"/>
</then>
</if>
<if>
<equals arg1="${server}" arg2="tomcat"/>
<then>
<copy file="build/tomcat/default-repository-config-mysql.xml" tofile="${config.dir}/default-repository-config.xml" overwrite="yes"/>
<copy file="build/tomcat/nuxeo.xml" tofile="${nuxeo.dir}/conf/Catalina/localhost/nuxeo.xml" overwrite="yes"/>
</then>
</if>
</target>
<!-- sqlStorage with postgresql -->
<target name="deploy.sql.storage.config.postgresql" if="isPostGresSql">
<echo message="Install sql-storage postgresql" />
<if>
<equals arg1="${server}" arg2="jboss"/>
<then>
<copy file="build/datasources/sql-storage-repository-postgresql-ds.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/default-repository-ds.xml" overwrite="yes"/>
<copy file="build/datasources/nxtags-postgresql-ds.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/nxtags-ds.xml" overwrite="yes"/>
<copy file="build/datasources/unified-nuxeo-postgresql-ds.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources/unified-nuxeo-ds.xml" overwrite="yes"/>
<copy file="build/config/default-repository-config-postgresql.xml" tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/config/default-repository-config.xml" overwrite="yes"/>
</then>
</if>
<if>
<equals arg1="${server}" arg2="tomcat"/>
<then>
<copy file="build/tomcat/default-repository-config-postgresql.xml" tofile="${config.dir}/default-repository-config.xml" overwrite="yes"/>
<copy file="build/tomcat/nuxeo.xml" tofile="${nuxeo.dir}/conf/Catalina/localhost/nuxeo.xml" overwrite="yes"/>
</then>
</if>
</target>
<target name="deploy.plugin" depends="replace.token.config">
<!-- this stuff cannot be configured with a nuxeo plugin -->
<copy todir="${nuxeo.dir}/server/default/deploy/nuxeo.ear/datasources" overwrite="yes">
<fileset dir="build/datasources"/>
</copy>
<!-- Jena database type and transaction mode -->
<copy file="build/config/sql.properties" tofile="${config.dir}/sql.properties" overwrite="yes"/>
<!-- usual nuxeo.properties -->
<copy file="build/config/nuxeo.properties" tofile="${config.dir}/nuxeo.properties" overwrite="yes"/>
<!-- Patch : nuxeo 5.3 tomcat distribution does not used sql.properties -->
<if>
<equals arg1="${server}" arg2="tomcat"/>
<then>
<replace file="${config.dir}/nxrelations-default-jena-bundle.xml" >
<replacefilter token="Derby" value="$${org.nuxeo.ecm.sql.jena.databaseType}" />
</replace>
<replace file="${config.dir}/commentService-config-bundle.xml" >
<replacefilter token="Derby" value="$${org.nuxeo.ecm.sql.jena.databaseType}" />
</replace>
</then>
</if>
<!-- Repository backend -->
<antcall target="deploy.sql.storage" />
<!-- Notification service -->
<copy file="build/config/notification/mail-service.xml" tofile="${nuxeo.dir}/server/default/deploy/mail-service.xml" overwrite="yes"/>
<copy file="build/config/notification/notification-config.xml" tofile="${config.dir}/notification-config.xml" overwrite="yes"/>
<!-- server configuration -->
<if>
<equals arg1="${server}" arg2="jboss"/>
<then>
<copy file="build/jboss/jbossctl" todir="${nuxeo.dir}/bin" overwrite="yes"/>
<chmod perm="+x">
<fileset dir="${nuxeo.dir}/bin">
<include name="**/*.sh"/>
<include name="**/jbossctl"/>
</fileset>
</chmod>
<copy file="build/jboss/server.xml" tofile="${nuxeo.dir}/server/default/deploy/jboss-web.deployer/server.xml" overwrite="yes"/>
<copy file="build/jboss/jboss-log4j.xml" tofile="${nuxeo.dir}/server/default/conf/jboss-log4j.xml" overwrite="yes"/>
</then>
</if>
<if>
<equals arg1="${server}" arg2="tomcat"/>
<then>
<copy file="build/tomcat/server.xml" tofile="${nuxeo.dir}/conf/server.xml" overwrite="yes"/>
</then>
</if>
<!-- openoffice configuration -->
<copy todir="${openoffice.home}/nxOOo" overwrite="yes">
<fileset dir="build/nxOOo"/>
</copy>
<chmod perm="+x">
<fileset dir="${openoffice.home}/nxOOo">
<include name="**/nxopenoffice"/>
</fileset>
</chmod>
<!-- others librairies [drivers postgres,mysql] -->
<if>
<equals arg1="${server}" arg2="jboss"/>
<then>
<!-- remove bad mySQL Driver from nuxeo 5.3 -->
<delete>
<fileset dir="${nuxeo.dir}/server/default/lib" includes="mysql-connector*"/>
</delete>
<copy todir="${nuxeo.dir}/server/default/lib" overwrite="yes">
<fileset dir="lib"/>
</copy>
</then>
</if>
<if>
<equals arg1="${server}" arg2="tomcat"/>
<then>
<!-- remove bad mySQL Driver from nuxeo 5.3 -->
<delete>
<fileset dir="${nuxeo.dir}/server/default/lib" includes="mysql-connector*"/>
</delete>
<copy todir="${nuxeo.dir}/lib" overwrite="yes">
<fileset dir="lib"/>
</copy>
</then>
</if>
<!-- plugins addons -->
<!-- do not delete with tomcat because plungins with nuxeo jar -->
<if>
<equals arg1="${server}" arg2="jboss"/>
<then>
<delete>
<fileset dir="${plugins.dir}" includes="**/*.jar"/>
</delete>
</then>
</if>
<copy todir="${plugins.dir}" overwrite="yes">
<fileset dir="nuxeo-addons"/>
</copy>
<!-- Nx patches -->
<antcall target="patch" />
<!-- configuration plugin deploy -->
<subant target="deploy" buildpath="build/esup-ecm-config-plugin">
<property name="utils.dir" value="${utils.dir}" />
</subant>
</target>
<target name="patch">
<if>
<istrue value="${isMysql}"/>
<then>
<echo message="***** mysql"/>
<copy tofile="${nuxeo.dir}/server/default/deploy/nuxeo.ear/system/nuxeo-core-storage-sql-1.6.1.jar" file="nuxeo-patches/nuxeo-core-storage-sql-1.6.1-SUPNXP-1790.jar" overwrite="yes"/>
</then>
</if>
<!-- seam.debug -->
<if>
<istrue value="${seam.debug}"/>
<then>
<touch file="${config.dir}/seam-debug.properties"/>
</then>
</if>
</target>
<target name="web" description="Copy web files to a live JBoss">
<copy todir="${nuxeo.dir}/server/default/deploy/nuxeo.ear/nuxeo.war" overwrite="true">
<fileset dir="${basedir}/esup-ecm-config-plugin/src/main/resources/nuxeo.war/" />
</copy>
</target>
<target name="seam" depends="copy.src.build" description="Copy seam beans a live JBoss">
<subant target="seam" buildpath="build/esup-ecm-config-plugin">
<property name="utils.dir" value="${utils.dir}" />
<property name="seam.hotdeploy.dir" location="${nuxeo.dir}/server/default/deploy/nuxeo.ear/nuxeo.war/WEB-INF/dev/"/>
</subant>
</target>
<target name="manage.nuxeo.component">
<property name="system.path" value="server/default/deploy/nuxeo.ear/system" />
<!-- dont use opensocial-->
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-opensocial*.jar"/>
<!-- nuxeo-opensocial-gadgets-core needed by webengine ! -->
<exclude name="nuxeo-opensocial-gadgets-core*.jar" />
</fileset>
</move>
<!-- personnal Workspace -->
<if>
<istrue value="${use.personnal.workspace}"/>
<then>
<move todir="${nuxeo.dir}/${system.path}" verbose="true">
<fileset dir="${unused.component.dir}">
<filename name="nuxeo-platform-userworkspace*.jar"/>
</fileset>
</move>
</then>
<else>
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-platform-userworkspace*.jar"/>
</fileset>
</move>
</else>
</if>
<!-- website document -->
<if>
<istrue value="${use.website.type}"/>
<then>
<move todir="${nuxeo.dir}/${system.path}" verbose="true">
<fileset dir="${unused.component.dir}">
<filename name="nuxeo-webengine-sites*.jar"/>
</fileset>
</move>
<if>
<istrue value="${use.blog.type}"/>
<then>
<move todir="${nuxeo.dir}/${system.path}" verbose="true">
<fileset dir="${unused.component.dir}">
<filename name="nuxeo-webengine-blogs*.jar"/>
</fileset>
</move>
</then>
</if>
</then>
<else>
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-webengine-sites*.jar"/>
</fileset>
</move>
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-webengine-blogs*.jar"/>
</fileset>
</move>
</else>
</if>
<!-- image document -->
<if>
<istrue value="${use.image.type}"/>
<then>
<move todir="${nuxeo.dir}/${system.path}" verbose="true">
<fileset dir="${unused.component.dir}">
<filename name="nuxeo-platform-imaging*.jar"/>
</fileset>
</move>
</then>
<else>
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-platform-imaging*.jar"/>
</fileset>
</move>
</else>
</if>
<!-- forum document -->
<if>
<istrue value="${use.forum.type}"/>
<then>
<move todir="${nuxeo.dir}/${system.path}" verbose="true">
<fileset dir="${unused.component.dir}">
<filename name="nuxeo-platform-forum*.jar"/>
</fileset>
</move>
</then>
<else>
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-platform-forum*.jar"/>
</fileset>
</move>
</else>
</if>
<!-- mail document -->
<if>
<istrue value="${use.mail.type}"/>
<then>
<move todir="${nuxeo.dir}/${system.path}" verbose="true">
<fileset dir="${unused.component.dir}">
<filename name="nuxeo-platform-mail-*.jar"/>
</fileset>
</move>
</then>
<else>
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-platform-mail-*.jar"/>
</fileset>
</move>
</else>
</if>
<!-- virtual navigation -->
<if>
<istrue value="${use.virtual.navigation}"/>
<then>
<move todir="${nuxeo.dir}/${system.path}" verbose="true">
<fileset dir="${unused.component.dir}">
<filename name="nuxeo-platform-virtualnavigation-web*.jar"/>
</fileset>
</move>
</then>
<else>
<move todir="${unused.component.dir}" verbose="true">
<fileset dir="${nuxeo.dir}/${system.path}">
<filename name="nuxeo-platform-virtualnavigation-web*.jar"/>
</fileset>
</move>
</else>
</if>
</target>
<target name="undeploy" depends="server" description="Undeploy">
<delete dir="${nuxeo.dir}" />
<delete dir="${unused.component.dir}"/>
</target>
<target name="deploy" depends="server,deploy.nuxeo,deploy.plugin,manage.nuxeo.component" description="Deploy" />
<!-- ==================== download-maven Target =================================== -->
<property name="maven.url" value="http://www.apache.org/dist/maven/binaries" />
<property name="maven.version" value="2.2.1" />
<property name="maven.zipfile" value="apache-maven-${maven.version}-bin.zip" />
<property name="maven.bin" value="${utils.dir}/apache-maven-${maven.version}/bin" />
<!-- ==================== depends-maven Target =================================== -->
<target name="depends-maven">
<available property="maven.dir.available" file="${maven.bin}" type="dir"/>
</target>
<target name="download-maven" unless="maven.dir.available" depends="depends-maven">
<echo message="${maven.bin} non trouve, je telecharge..."/>
<mkdir dir="${utils.dir}"/>
<get src="${maven.url}/${maven.zipfile}" dest="${utils.dir}/${maven.zipfile}"/>
<unzip src="${utils.dir}/${maven.zipfile}" dest="${utils.dir}"/>
<delete file="${utils.dir}/${maven.zipfile}"/>
<echo message="maven.bin=${maven.bin}"/>
</target>
<target name="buildzip" depends="prepare" description="Construct ${esup-ecm.file}.zip">
<echo message="Construct ${esup-ecm.file}.zip ...."/>
<delete file="packages/${esup-ecm.file}.zip"/>
<zip destfile="packages/${esup-ecm.file}.zip" >
<zipfileset dir="" prefix="${esup-ecm.file}">
<include name="**/*"/>
<exclude name="**/.*"/>
<exclude name="**/build/**"/>
<exclude name="**/unused/**"/>
<exclude name="**/oldies/**"/>
<exclude name="packages/${esup-ecm.file}.zip"/>
<exclude name="packages/${nuxeo-dm.file}"/>
<exclude name="build.properties"/>
</zipfileset>
</zip>
</target>
<target name="installPatchOOo" description="How to install Nuxeo patch for openoffice">
<echo message="Execute the following commands : "/>
<echo message="${openoffice.home}/program/unopkg add --shared ${openoffice.home}/nxOOo/patch/nxSkipInstallWizard.oxt
"/>
<echo message="${openoffice.home}/program/unopkg add --shared ${openoffice.home}/nxOOo/patch/nxOOoAutoListen.oxt
"/>
</target>
<!-- ==================== Target :: Remplacement des paramètres depuis le fichier central =================================== -->
<property name="commons.parameters.local.file" value="commons-parameters.properties" />
<!-- Télécharge le fichier de propriétés -->
<target name="download-commons.parameters.local.file" if="commons.parameters.central.file.url">
<echo message="je copie en local ${commons.parameters.central.file.url} ..."/>
<get dest="${commons.parameters.local.file}" src="${commons.parameters.central.file.url}"/>
</target>
<!-- Teste si le fichier de propriétés local existe -->
<target name="test-available-commons.parameters.local.file">
<available file="${commons.parameters.local.file}" property="commons.parameters.local.file.exists"/>
<echo message="${commons.parameters.local.file} existe ? ${commons.parameters.local.file.exists}"/>
</target>
<!-- Copie init-build.properties en build.properties -->
<target name="init-build.properties" depends="download-commons.parameters.local.file,test-available-commons.parameters.local.file" if="commons.parameters.local.file.exists">
<echo message="initialise le fichier build.properties"/>
<echo message="${commons.parameters.local.file}"/>
<delete file="build.properties" />
<copy file="init-build.properties" tofile="build.properties">
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"/>
</filterchain>
<filterset
begintoken="["
endtoken="]"
filtersfile="${commons.parameters.local.file}"/>
</copy>
<echo message="remplacement des paramètres effectué dans build.properties !"/>
</target>
<!-- Replace the values -->
<target name="init-build" depends="init-build.properties" description="Initialise le fichier build.properties avec le remplacement des variables">
<if>
<equals arg1="${from.quick.install}" arg2="true" />
<then>
<echo message="on change la valeur de commons.parameters.central.file.url dans init-build.properties ..." />
<replace
file="init-build.properties"
dir="."
value="${commons.parameters.central.file.url}">
<include name="init-build.properties"/>
<include name="build.properties"/>
<replacetoken>[COMMONS_PARAMETERS_CENTRAL_FILE_URL]</replacetoken>
</replace>
<replace
dir="."
value="/">
<include name="init-build.properties"/>
<include name="build.properties"/>
<replacetoken>\</replacetoken>
</replace>
</then>
<else>
<echo message="on ne change pas la valeur de commons.parameters.central.file.url dans init-build.properties ..." />
</else>
</if>
</target>
</project>