forked from joniles/mpxj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
675 lines (562 loc) · 28.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
<?xml version="1.0"?>
<project name="net.sf.mpxj" default="archive" basedir=".">
<target name="init" description="Initialize properties">
<tstamp />
<property name="current.version" value="7.9.5" />
<property name="ikvm.dir" value="${basedir}/../ikvm-8.0.5449.1" />
<property name="nuget.dir" value="${basedir}/../nuget" />
<property name="ruby.dir" value="C:/Ruby21"/>
<property name="windows.tools.dir" value="${basedir}/../NETFX 4.5.1 Tools" />
<property name="msbuild.dir" value="C:/Windows/Microsoft.NET/Framework/v3.5" />
<property name="junit.jar" value="${basedir}/../junit-4.11/junit-4.11.jar"/>
<property name="hamcrest.jar" value="${basedir}/../junit-4.11/hamcrest-core-1.3.jar"/>
<!-- These properties are only required if rebuilding JAXB generated source -->
<property name="mspdi.xsd" value="mspdi_pj15-correct.xsd" />
<property name="primavera.xsd" value="p6apibo.xsd" />
<property name="conceptdraw.xsd" value="document.xsd" />
<!-- This property is only required if you want to publish the site to SourceForge or build Maven artifacts -->
<property name="maven.dir" value="c:/java/apache-maven-3.6.0"/>
<property name="lib.dir" value="${basedir}/lib" />
<property name="lib.net.dir" value="${basedir}/lib.net" />
<property name="doc.dir" value="${basedir}/doc/api" />
<property name="docs.dir" value="${basedir}/docs" />
<property name="bak.dir" value="${basedir}/bak" />
<property name="distribution" value="${basedir}/../mpxj-${current.version}.zip" />
<property name="mpxj.snk" value="${basedir}/src.net/mpxj.snk"/>
<!--
MPXJ is targeted at Java 1.6, so to ensure that the builds we distribute
match this, we use this setting.
-->
<property name="target-jvm-version" value="1.6" />
<property name="poi.jar" value="poi-3.17" />
<path id="poi.path">
<pathelement location="${lib.dir}/${poi.jar}.jar" />
</path>
<property name="commons-collections.jar" value="commons-collections4-4.1" />
<path id="commons-collections.path">
<pathelement location="${lib.dir}/${commons-collections.jar}.jar" />
</path>
<property name="rtfparserkit.jar" value="rtfparserkit-1.13.0" />
<path id="rtfparserkit.path">
<pathelement location="${lib.dir}/${rtfparserkit.jar}.jar" />
</path>
<property name="sqlite-jdbc.jar" value="sqlite-jdbc-3.8.10.1" />
<path id="sqlite-jdbc.path">
<pathelement location="${lib.dir}/${sqlite-jdbc.jar}.jar" />
</path>
<path id="junit.path">
<pathelement location="${junit.jar}" />
</path>
<property name="poi.classpath" refid="poi.path" />
<property name="commons-collections.classpath" refid="commons-collections.path" />
<property name="rtfparserkit.classpath" refid="rtfparserkit.path" />
<property name="sqlite-jdbc.classpath" refid="sqlite-jdbc.path" />
<property name="junit.classpath" refid="junit.path" />
<property name="poi.dll" value="${lib.net.dir}\${poi.jar}.dll" />
<property name="commons-collections.dll" value="${lib.net.dir}\${commons-collections.jar}.dll" />
<property name="rtfparserkit.dll" value="${lib.net.dir}\${rtfparserkit.jar}.dll" />
<property name="sqlite-jdbc.dll" value="${lib.net.dir}\${sqlite-jdbc.jar}.dll" />
<property name="junit.dll" value="${lib.net.dir}\junit.dll" />
<property name="mpxj.dll" value="${lib.net.dir}\mpxj.dll" />
<property name="mpxj-test.dll" value="${lib.net.dir}\mpxj-test.dll" />
<property name="mpxj-for-vb.dll" value="${lib.net.dir}\mpxj-for-vb.dll" />
<property name="mpxj-for-csharp.dll" value="${lib.net.dir}\mpxj-for-csharp.dll" />
<property name="mpxj-utilities.dll" value="${lib.net.dir}\MpxjUtilities.dll" />
<property name="ikvmc.exe" value="${ikvm.dir}/bin/ikvmc.exe" />
<property name="ikvmstub.exe" value="${ikvm.dir}/bin/ikvmstub.exe" />
<property name="ikvm.working.dir" value="${basedir}/ikvm.tmp" />
<property name="vs.working.dir" value="${basedir}/vs.tmp" />
<available file="${ikvmc.exe}" property="ikvm.available" />
<property name="tlbexp.exe" value="${windows.tools.dir}/tlbexp.exe" />
<available file="${tlbexp.exe}" property="tlbexp.available" />
<property name="msbuild.exe" value="${msbuild.dir}/msbuild.exe" />
<condition property="msbuild.available">
<and>
<available file="${msbuild.exe}" property="msbuild.available" />
<isset property="ikvm.available"/>
</and>
</condition>
</target>
<target name="update-version-numbers" depends="init" description="Ensure that version numbers in the code are up-to-date">
<replaceregexp file="${basedir}/pom.xml"
match="<!-- MPXJ --><version>.*</version>"
replace="<!-- MPXJ --><version>${current.version}</version>"
byline="true"
/>
<replaceregexp
match='(\[assembly: (AssemblyVersion|AssemblyFileVersion)\(").+("\)\])'
replace='\1${current.version}.0\3'
byline="true">
<fileset dir="${basedir}/src.net" includes="**/*.cs" />
</replaceregexp>
<replaceregexp file="${basedir}/src.ruby/mpxj/lib/mpxj/version.rb"
match='VERSION = ".*"'
replace='VERSION = "${current.version}"'
byline="true"
/>
</target>
<target name="package" depends="init,update-version-numbers">
<exec executable="${maven.dir}/bin/mvn.cmd" dir="${basedir}">
<arg line="-DskipTests=true -Dmaven.javadoc.skip=true -Dsource.skip=true package" />
</exec>
<copy file="${basedir}/target/mpxj-${current.version}.jar" tofile="${basedir}/mpxj.jar"/>
<copy file="${basedir}/target/mpxj-${current.version}-tests.jar" tofile="${basedir}/mpxj-test.jar"/>
</target>
<target name="changelog" description="Update changelog">
<xslt in="${basedir}/src/changes/changes.xml" out="${basedir}/CHANGELOG.md" style="${basedir}/doc/changelog.xsl"/>
</target>
<target name="releasenotes" depends="init" description="Create release notes">
<xslt in="${basedir}/src/changes/changes.xml" out="${basedir}/../github-release.md" style="${basedir}/doc/github-releasenote.xsl">
<param name="version" expression="${current.version}"/>
</xslt>
<xslt in="${basedir}/src/changes/changes.xml" out="${basedir}/../readme.md" style="${basedir}/doc/sourceforge-releasenote.xsl">
<param name="version" expression="${current.version}"/>
</xslt>
</target>
<target name="gem-setup" depends="package" description="Build jars required by ruby gem and copy to correct location">
<copy file="${basedir}/mpxj.jar" todir="${basedir}/src.ruby/mpxj/lib/mpxj"/>
<copy todir="${basedir}/src.ruby/mpxj/lib/mpxj">
<fileset dir="${basedir}/lib" includes="*.jar" />
</copy>
<copy todir="${basedir}/src.ruby/mpxj/legal">
<fileset dir="${basedir}/legal" includes="*" />
</copy>
</target>
<target name="gem-test" depends="gem-setup" description="Run ruby gem tests">
<exec executable="${ruby.dir}/bin/bundle.bat" dir="${basedir}/src.ruby/mpxj">
<arg line="exec rspec spec" />
</exec>
</target>
<target name="gem-deploy" depends="gem-setup" description="Deploy rubygem to rubygems.org">
<exec executable="${ruby.dir}/bin/bundle.bat" dir="${basedir}/src.ruby/mpxj">
<arg line="exec rake build release:rubygem_push" />
</exec>
</target>
<target name="gem-copy" depends="gem-setup" description="Copy gem to a local directory">
<copy todir="//VBOXSVR/Downloads/mpxj.gem">
<fileset dir="${basedir}/src.ruby/mpxj" includes="**" />
</copy>
</target>
<target name="xjc" depends="init" description="Rebuild source generated by JAXB">
<property name="classes.dir" value="${basedir}/target/classes" />
<copy todir="${basedir}">
<fileset dir="${basedir}/jaxb" includes="*.xjb" />
</copy>
<exec executable="xjc" dir="${basedir}">
<arg line="-classpath ${classes.dir} -d ${basedir}/src/main/java -b ${basedir}/mspdi-binding.xjb -p net.sf.mpxj.mspdi.schema ${mspdi.xsd}" />
</exec>
<exec executable="xjc" dir="${basedir}">
<arg line="-dtd -classpath ${classes.dir} -d ${basedir}/src/main/java -p net.sf.mpxj.planner.schema ${basedir}/jaxb/mrproject-0.6.dtd" />
</exec>
<exec executable="xjc" dir="${basedir}">
<arg line="-classpath ${classes.dir} -d ${basedir}/src/main/java -b ${basedir}/pm-binding.xjb -p net.sf.mpxj.primavera.schema ${primavera.xsd}" />
</exec>
<exec executable="xjc" dir="${basedir}">
<arg line="-classpath ${classes.dir} -d ${basedir}/src/main/java -b ${basedir}/phoenix-binding.xjb -p net.sf.mpxj.phoenix.schema ${basedir}/jaxb/phoenix-4.5.xsd" />
</exec>
<exec executable="xjc" dir="${basedir}">
<arg line="-classpath ${classes.dir} -d ${basedir}/src/main/java -b ${basedir}/ganttproject-binding.xjb -p net.sf.mpxj.ganttproject.schema ${basedir}/jaxb/ganttproject-2.8.xsd" />
</exec>
<exec executable="xjc" dir="${basedir}">
<arg line="-classpath ${classes.dir} -d ${basedir}/src/main/java -b ${basedir}/conceptdraw-binding.xjb -p net.sf.mpxj.conceptdraw.schema ${conceptdraw.xsd}" />
</exec>
<exec executable="xjc" dir="${basedir}">
<arg line="-classpath ${classes.dir} -d ${basedir}/src/main/java -b ${basedir}/gantt-designer-binding.xjb -p net.sf.mpxj.ganttdesigner.schema ${basedir}/jaxb/gantt-designer.xsd" />
</exec>
<delete>
<fileset dir="${basedir}" includes="*.xjb" defaultexcludes="no" />
</delete>
</target>
<target name="ikvm-compile" depends="init" description="Compile everything ready for use with IKVM" if="ikvm.available">
<property name="ikvm.src.dir" value="${ikvm.working.dir}/src" />
<property name="ikvm.src.test.dir" value="${ikvm.working.dir}/src.test" />
<property name="ikvm.classes.dir" value="${ikvm.working.dir}/classes" />
<property name="ikvm.classes.test.dir" value="${ikvm.working.dir}/classes.test" />
<property name="ikvm.lib.dir" value="${ikvm.working.dir}/lib" />
<delete dir="${ikvm.working.dir}" />
<mkdir dir="${ikvm.src.dir}" />
<mkdir dir="${ikvm.src.test.dir}" />
<mkdir dir="${ikvm.classes.dir}" />
<mkdir dir="${ikvm.classes.test.dir}" />
<mkdir dir="${ikvm.lib.dir}" />
<exec executable="${ikvmstub.exe}" dir="${basedir}">
<arg line="-out:${ikvm.lib.dir}/mscorlib.jar mscorlib" />
</exec>
<copy todir="${ikvm.src.dir}">
<fileset dir="${basedir}/src/main/java" includes="**" />
</copy>
<copy todir="${ikvm.src.test.dir}">
<fileset dir="${basedir}/src/test/java" includes="**" />
</copy>
<replace dir="${ikvm.src.dir}" token="public class " value="import cli.System.Runtime.InteropServices.*;${line.separator}@ClassInterfaceAttribute.Annotation(ClassInterfaceType.__Enum.AutoDual)${line.separator}public class ">
<include name="**/*.java" />
<exclude name="**/schema/*.java" />
<exclude name="**/FieldMap.java" />
</replace>
<replace dir="${ikvm.src.dir}" token="public final class " value="import cli.System.Runtime.InteropServices.*;${line.separator}@ClassInterfaceAttribute.Annotation(ClassInterfaceType.__Enum.AutoDual)${line.separator} public final class ">
<include name="**/*.java" />
</replace>
<replace dir="${ikvm.src.dir}" token="public interface " value="import cli.System.Runtime.InteropServices.*;${line.separator}@ClassInterfaceAttribute.Annotation(ClassInterfaceType.__Enum.AutoDual)${line.separator} public interface ">
<include name="**/*.java" />
</replace>
<replace dir="${ikvm.src.dir}" token="class ProjectEntity" value="import cli.System.Runtime.InteropServices.*;${line.separator}@ClassInterfaceAttribute.Annotation(ClassInterfaceType.__Enum.AutoDual)${line.separator}public class ProjectEntity">
<include name="**/ProjectEntity.java" />
</replace>
<replace dir="${ikvm.src.dir}" token="public enum " value="import cli.System.Runtime.InteropServices.*;${line.separator}@ClassInterfaceAttribute.Annotation(ClassInterfaceType.__Enum.AutoDual)${line.separator}public enum ">
<include name="**/*.java" />
</replace>
<javac srcdir="${ikvm.src.dir}" destdir="${ikvm.classes.dir}" classpath="${classpath}:${poi.classpath}:${commons-collections.classpath}:${rtfparserkit.classpath}:${sqlite-jdbc.classpath}:${ikvm.lib.dir}/mscorlib.jar" debug="on" source="${target-jvm-version}" target="${target-jvm-version}" includeantruntime="false" excludes="net/sf/mpxj/explorer/**">
<compilerarg line="-encoding cp1252" />
</javac>
<javac srcdir="${ikvm.src.test.dir}" destdir="${ikvm.classes.test.dir}" classpath="${classpath}:${ikvm.classes.dir}:${poi.classpath}:${commons-collections.classpath}:${rtfparserkit.classpath}:${sqlite-jdbc.classpath}:${junit.classpath}:${ikvm.lib.dir}/mscorlib.jar" debug="on" source="${target-jvm-version}" target="${target-jvm-version}" includeantruntime="false">
<compilerarg line="-encoding cp1252" />
</javac>
<jar jarfile="${ikvm.working.dir}/mpxj.jar" basedir="${ikvm.classes.dir}" />
<jar jarfile="${ikvm.working.dir}/mpxj-test.jar" basedir="${ikvm.classes.test.dir}" />
</target>
<target name="ikvm-dll" depends="ikvm-compile" description="Build .net DLLs" if="ikvm.available">
<java classname="net.sf.mpxj.ikvm.MapFileGenerator" failonerror="true">
<arg value="${ikvm.working.dir}/mpxj.jar" />
<arg value="${ikvm.working.dir}/ikvm-remap-vb.xml" />
<arg value="False" />
<classpath>
<pathelement path="${classpath}" />
<pathelement path="${ikvm.working.dir}/mpxj.jar" />
<pathelement location="${junit.classpath}" />
<pathelement location="${poi.classpath}" />
<pathelement location="${commons-collections.classpath}" />
<pathelement location="${rtfparserkit.classpath}" />
<pathelement location="${sqlite-jdbc.classpath}" />
</classpath>
</java>
<java classname="net.sf.mpxj.ikvm.MapFileGenerator" failonerror="true">
<arg value="${ikvm.working.dir}/mpxj.jar" />
<arg value="${ikvm.working.dir}/ikvm-remap-csharp.xml" />
<arg value="True" />
<classpath>
<pathelement path="${classpath}" />
<pathelement path="${ikvm.working.dir}/mpxj.jar" />
<pathelement location="${junit.classpath}" />
<pathelement location="${poi.classpath}" />
<pathelement location="${commons-collections.classpath}" />
<pathelement location="${rtfparserkit.classpath}" />
<pathelement location="${sqlite-jdbc.classpath}" />
</classpath>
</java>
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0111 -nowarn:0100 -nowarn:0003 -out:${commons-collections.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 ${basedir}\lib\${commons-collections.jar}.jar" />
</exec>
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0111 -nowarn:0100 -nowarn:0003 -out:${poi.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 -reference:${commons-collections.dll} ${basedir}\lib\${poi.jar}.jar" />
</exec>
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0111 -nowarn:0100 -nowarn:0003 -out:${rtfparserkit.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 ${basedir}\lib\${rtfparserkit.jar}.jar" />
</exec>
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0111 -nowarn:0100 -nowarn:0003 -out:${sqlite-jdbc.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 ${basedir}\lib\${sqlite-jdbc.jar}.jar" />
</exec>
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0003 -nowarn:0100 -nowarn:0111 -nowarn:0105 -out:${junit.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 ${hamcrest.jar} ${junit.jar}" />
</exec>
<!-- Generate the original unmapped DLL -->
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0003 -out:${mpxj.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 -reference:${poi.dll} -reference:${rtfparserkit.dll} -reference:${sqlite-jdbc.dll} -reference:mscorlib.dll ${ikvm.working.dir}\mpxj.jar" />
</exec>
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0003 -out:${mpxj-test.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 -reference:${poi.dll} -reference:${rtfparserkit.dll} -reference:${sqlite-jdbc.dll} -reference:${mpxj.dll} -reference:${junit.dll} -reference:mscorlib.dll ${ikvm.working.dir}\mpxj-test.jar" />
</exec>
<!-- Generate a mapped DLL for VB, avoids name clashes due to VB's case insensitivity -->
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0003 -out:${mpxj-for-vb.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 -remap:${ikvm.working.dir}/ikvm-remap-vb.xml -reference:${poi.dll} -reference:${rtfparserkit.dll} -reference:${sqlite-jdbc.dll} -reference:mscorlib.dll ${ikvm.working.dir}\mpxj.jar" />
</exec>
<!-- Generate a mapped DLL for C# and other .Net languages -->
<exec executable="${ikvmc.exe}" dir="${basedir}">
<arg line="-nowarn:0003 -out:${mpxj-for-csharp.dll} -target:library -keyfile:${mpxj.snk} -version:${current.version}.0 -remap:${ikvm.working.dir}/ikvm-remap-csharp.xml -reference:${poi.dll} -reference:${rtfparserkit.dll} -reference:${sqlite-jdbc.dll} -reference:mscorlib.dll -reference:system.dll ${ikvm.working.dir}\mpxj.jar" />
</exec>
<!-- Export a Type Library (TLB) for each assembly. This step will fail if the assemblies are in the GAC! -->
<apply executable="${tlbexp.exe}" parallel="false" relative="true" dir="${lib.net.dir}" failifexecutionfails="true">
<arg value="/nologo"/>
<arg value="/silence:000017CE"/>
<arg value="/silence:001311D9"/>
<arg value="/silence:80131178"/>
<arg value="/silence:0013117F"/>
<arg value="/silence:8013117D"/>
<arg value="/silence:801311B0"/>
<arg value="/silence:80131172"/>
<srcfile />
<fileset dir="${lib.net.dir}">
<include name="**/*.dll" />
<exclude name="**/ikvm-native*.dll" />
</fileset>
</apply>
<!-- Generate a batch file which installs the assemblies in the GAC -->
<echo file="${lib.net.dir}\mpxj-gac-install.bat" message="@echo off${line.separator}echo This batch file installs the DLLs required to use MPXJ into the GAC${line.separator}pause${line.separator}"/>
<apply executable="cmd.exe" parallel="false" relative="true">
<arg value="/c" />
<srcfile prefix="echo gacutil /i " />
<arg value=">> ${lib.net.dir}\mpxj-gac-install.bat" />
<fileset dir="${lib.net.dir}">
<include name="*.dll" />
</fileset>
</apply>
<replace file="${lib.net.dir}\mpxj-gac-install.bat" token='" "' value="" />
<!-- Generate a batch file which removes the assemblies from the GAC -->
<echo file="${lib.net.dir}\mpxj-gac-uninstall.bat" message="@echo off${line.separator}echo This batch file uninstalls the DLLs required to use MPXJ from the GAC${line.separator}pause${line.separator}"/>
<apply executable="cmd.exe" parallel="false" relative="true" addsourcefile="false">
<arg value="/c" />
<targetfile prefix="echo gacutil /u " />
<arg value=">> ${lib.net.dir}\mpxj-gac-uninstall.bat" />
<fileset dir="${lib.net.dir}">
<include name="**/*.dll" />
</fileset>
<mapper type="glob" from="*.dll" to="*"/>
</apply>
<replace file="${lib.net.dir}\mpxj-gac-uninstall.bat" token='" "' value="" />
<!-- Generate a batch file to register the assemblies -->
<echo file="${lib.net.dir}\mpxj-register-assemblies.bat" message="@echo off${line.separator}echo This batch file registers the .Net assemblies used by MPXJ so that they can be called from COM${line.separator}pause${line.separator}"/>
<apply executable="cmd.exe" parallel="false" relative="true">
<arg value="/c" />
<srcfile prefix="echo regasm " />
<arg value=">> ${lib.net.dir}\mpxj-register-assemblies.bat" />
<fileset dir="${lib.net.dir}">
<include name="**/*.dll" />
</fileset>
</apply>
<replace file="${lib.net.dir}\mpxj-register-assemblies.bat" token='" "' value="" />
<!-- Generate a batch file to unregister the assemblies -->
<echo file="${lib.net.dir}\mpxj-unregister-assemblies.bat" message="@echo off${line.separator}echo This batch file deregisters the .Net assemblies used by MPXJ so that they are no longer available to be called from COM${line.separator}pause${line.separator}"/>
<apply executable="cmd.exe" parallel="false" relative="true">
<arg value="/c" />
<srcfile prefix="echo regasm /u " />
<arg value=">> ${lib.net.dir}\mpxj-unregister-assemblies.bat" />
<fileset dir="${lib.net.dir}">
<include name="**/*.dll" />
</fileset>
</apply>
<replace file="${lib.net.dir}\mpxj-unregister-assemblies.bat" token='" "' value="" />
<delete dir="${ikvm.working.dir}" />
</target>
<target name="vs-dll" depends="ikvm-dll" description="Build .Net DLLs using Visual Studio" if="msbuild.available">
<property name="vs.src.dir" value="${vs.working.dir}" />
<delete dir="${vs.working.dir}" />
<mkdir dir="${vs.src.dir}" />
<copy todir="${vs.src.dir}">
<fileset dir="${basedir}/src.net" includes="**" />
</copy>
<exec executable="${msbuild.exe}" dir="${basedir}">
<arg line="${vs.src.dir}/MpxjUtilities/MpxjUtilities.csproj /p:Configuration=Debug /target:'Clean;Rebuild'" />
</exec>
<copy file="${vs.src.dir}/bin/Debug/MpxjUtilities.dll" tofile="${mpxj-utilities.dll}"/>
<delete dir="${vs.working.dir}" />
</target>
<target name="archive" depends="package,ikvm-dll,vs-dll,changelog,releasenotes" description="Create library files"/>
<target name="distribute" depends="archive,clean-dot-net,nuget-package" description="Create distribution">
<zip zipfile="${distribution}">
<zipfileset dir="${basedir}" prefix="mpxj" excludes="target/**" />
</zip>
</target>
<target name="clean-temp" depends="init" description="Clean up temporary files">
<delete dir="${bak.dir}" />
<delete>
<fileset dir="${basedir}" includes="**/*~" defaultexcludes="no" />
</delete>
</target>
<target name="clean-dot-net" depends="init" description="Clean up .Net build files">
<delete includeemptydirs="true">
<fileset dir="${basedir}/src.net" defaultexcludes="false">
<include name="**/bin/**" />
<include name="**/obj/**" />
<include name="**/*.suo" />
<include name="**/*.user" />
</fileset>
</delete>
<delete dir="${ikvm.working.dir}" />
<delete dir="${vs.working.dir}" />
</target>
<target name="clean-ruby" depends="init" description="Clean up Ruby files">
<delete dir="${basedir}/src.ruby/mpxj/doc" />
<delete dir="${basedir}/src.ruby/mpxj/legal" />
<delete dir="${basedir}/src.ruby/mpxj/pkg" />
<delete dir="${basedir}/src.ruby/mpxj/Gemfile.lock" />
<delete includeemptydirs="true">
<fileset dir="${basedir}/src.ruby/mpxj" defaultexcludes="false">
<include name="**/*.jar" />
</fileset>
</delete>
</target>
<target name="clean" depends="init, clean-temp, clean-dot-net, clean-ruby, maven-clean" description="Clean up all files">
<delete dir="${doc.dir}" />
<delete file="${basedir}/mpxj.jar" />
<delete file="${basedir}/mpxj-test.jar" />
<delete file="${mpxj.dll}" />
<delete file="${mpxj-for-csharp.dll}" />
<delete file="${mpxj-for-vb.dll}" />
<delete file="${mpxj-test.dll}" />
<delete file="${junit.dll}" />
<delete file="${poi.dll}" />
<delete file="${commons-collections.dll}" />
<delete file="${rtfparserkit.dll}" />
<delete file="${sqlite-jdbc.dll}" />
<delete file="${mpxj-utilities.dll}" />
<delete>
<fileset dir="${lib.net.dir}">
<include name="*.tlb"/>
<include name="*.bat"/>
</fileset>
</delete>
<delete>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</delete>
</target>
<target name="coverage" depends="archive" description="Code coverage using Emma">
<property name="emma.dir" value="c:\java\emma-2.0.5312" />
<path id="emmarun.path">
<path refid="poi.path" />
<path refid="comons-collections.path" />
<path refid="rtfparserkit.path" />
<path refid="sqlite-jdbc.path" />
<path refid="junit.path" />
<pathelement location="${basedir}/mpxj.jar" />
</path>
<property name="emmarun.classpath" refid="emmarun.path" />
<property name="filter" value="-javax.*,-com.*,-org.*,-junit.*,-net.sf.mpxj.mspdi.schema.*" />
<exec executable="java" dir="${basedir}">
<arg line="-Xms64m -Xmx512m -Dmpxj.junit.datadir=${basedir}/junit/data -cp ${emma.dir}/lib/emma.jar emmarun -cp ${emmarun.classpath} -r html -sp ${basedir}/src -ix ${filter} junit.textui.TestRunner net.sf.mpxj.junit.MPXJTest" />
</exec>
</target>
<target name="maven-clean" depends="init" description="Cleans the maven directory">
<exec executable="${maven.dir}/bin/mvn.cmd" dir="${basedir}">
<arg line="clean" />
</exec>
</target>
<target name="maven-site-build" depends="init" description="Execute maven to produce the web site">
<delete dir="${docs.dir}" />
<mkdir dir="${docs.dir}" />
<echo file="${docs.dir}/CNAME" append="false">www.mpxj.org</echo>
<exec executable="${maven.dir}/bin/mvn.cmd" dir="${basedir}">
<arg line="post-site" />
</exec>
</target>
<target name="maven-test" depends="init" description="Execute maven and run tests">
<exec executable="${maven.dir}/bin/mvn.cmd" dir="${basedir}">
<arg line="-Dmpxj.junit.datadir=${basedir}/junit/data clean test" />
</exec>
</target>
<target name="maven-deploy" depends="init" description="Execute maven and deploy to OSSRH">
<exec executable="${maven.dir}/bin/mvn.cmd" dir="${basedir}">
<arg line="-DskipTests=true clean deploy" />
</exec>
</target>
<target name="github-deploy" depends="init" description="Deploy to GitHub">
<exec executable="hub">
<arg line="tag v${current.version}" />
</exec>
<exec executable="hub">
<arg line="push origin v${current.version}" />
</exec>
<exec executable="hub">
<arg line='release create v${current.version} -a ${distribution} -f ${basedir}/../github-release.md'/>
</exec>
</target>
<target name="nuget-package" depends="init" description="Create NuGet packages">
<exec executable="${nuget.dir}/nuget.exe">
<arg value="update"/>
<arg value="-self"/>
</exec>
<replace dir="nuget" token="0.0.0" value="${current.version}">
<include name="*.nuspec" />
</replace>
<antcall target="nuget-pack">
<param name="nuget.spec" value="mpxj-ikvm"/>
</antcall>
<antcall target="nuget-pack">
<param name="nuget.spec" value="mpxj-common"/>
</antcall>
<antcall target="nuget-pack">
<param name="nuget.spec" value="mpxj"/>
</antcall>
<antcall target="nuget-pack">
<param name="nuget.spec" value="mpxj-for-csharp"/>
</antcall>
<antcall target="nuget-pack">
<param name="nuget.spec" value="mpxj-for-vb"/>
</antcall>
<replace dir="nuget" token="${current.version}" value="0.0.0">
<include name="*.nuspec" />
</replace>
</target>
<target name="nuget-pack">
<exec executable="${nuget.dir}/nuget.exe">
<arg value="pack"/>
<arg value="nuget/${nuget.spec}.nuspec"/>
<arg value="-outputdirectory"/>
<arg value="${basedir}/.."/>
<arg value="-version"/>
<arg value="${current.version}"/>
<arg value="-verbosity"/>
<arg value="quiet"/>
<arg value="-nopackageanalysis"/>
</exec>
</target>
<target name="nuget-push">
<exec executable="${nuget.dir}/nuget.exe">
<arg value="push"/>
<arg value="-Source"/>
<arg value="https://www.nuget.org/api/v2/package"/>
<arg value="-Timeout"/>
<arg value="1200"/>
<arg value="-Verbosity"/>
<arg value="Detailed"/>
<arg value="${basedir}/../net.sf.${nuget.package}.${current.version}.nupkg"/>
</exec>
</target>
<target name="nuget-deploy" depends="init" description="Deploy NuGet packages">
<antcall target="nuget-push">
<param name="nuget.package" value="mpxj-ikvm"/>
</antcall>
<antcall target="nuget-push">
<param name="nuget.package" value="mpxj-common"/>
</antcall>
<antcall target="nuget-push">
<param name="nuget.package" value="mpxj"/>
</antcall>
<antcall target="nuget-push">
<param name="nuget.package" value="mpxj-for-csharp"/>
</antcall>
<antcall target="nuget-push">
<param name="nuget.package" value="mpxj-for-vb"/>
</antcall>
</target>
<!-- Experimental - work in progress -->
<target name="j2objc">
<property name="j2objc.dir" value="../j2objc-1.0.2"/>
<fileset
id="source.fileset"
dir="src"
includes="**/*.java"
excludes="net/sf/mpxj/explorer/**,net/sf/mpxj/mspdi/**,net/sf/mpxj/primavera/**,net/sf/mpxj/ikvm/**"
/>
<pathconvert property="source.files" refid="source.fileset" pathsep=" "/>
<java jar="${j2objc.dir}/lib/j2objc.jar" fork="true">
<arg line="-Xbootclasspath:${j2objc.dir}/lib/jre_emul.jar -d src.objc"/>
<arg line=" ${source.files}"/>
</java>
</target>
<!-- Run this after xjc to fix incorrectly escaped XML in javadoc comments -->
<target name="fix-jaxb-comments" depends="init" description="Fix JAXB generated comments">
<replaceregexp
match="( \*[ ]+&lt;.+)>"
replace="\1&gt;"
byline="true">
<fileset dir="${basedir}/src/main/java" includes="**/schema/*.java" />
</replaceregexp>
<replaceregexp
match='(base="&lt;.+)>'
replace="\1&gt;"
byline="true">
<fileset dir="${basedir}/src/main/java" includes="**/schema/*.java" />
</replaceregexp>
</target>
</project>