source: main/trunk/ant-tasks/build.xml@ 28135

Last change on this file since 28135 was 28135, checked in by davidb, 11 years ago

Include crypt.jar to simplify compiling

File size: 5.3 KB
RevLine 
[17089]1<project name="compile-ant-tasks" default="compile">
2
[28135]3 <!-- This file originally required the user to specify where to
4 find a version 'crypt.jar' on the command-line through a '-D'
5 argument. To simplify things, the 'lib' folder has now been
6 added, and a version of 'crypt.jar' stored there. So now we
7 can set the property directly in this build.xml.
8
9 Leaving the more complicated testing targets in for now in case
10 it turns out there is a good reason why it was done this way in
11 the first place
12 -->
13
14 <property name="crypt.jar" value="lib/crypt.jar"/>
15
[17089]16 <condition property="libs.set">
17 <and>
18 <isset property="crypt.jar"/>
19 </and>
20 </condition>
21
22 <target name="compile" depends="check-libs">
23
24 <mkdir dir="classes"/>
25 <javac
26 srcdir="src/org/greenstone/anttasks"
27 destdir="classes"
28 classpath="${crypt.jar}"/>
29
30 <jar
[18962]31 destfile="anttasks.jar"
[17089]32 basedir="classes"/>
33
34 </target>
35
[17295]36 <target name="clean">
37 <delete dir="classes"/>
[18963]38 <delete file="anttasks.jar"/>
[17295]39 </target>
40
[17089]41 <target name="check-libs" unless="libs.set">
42 <echo>Please set crypt.jar property to the path of the crypt.jar file</echo>
43 <echo>E.g., ant -Dcrypt.jar=/path/to/crypt.jar</echo>
44 <fail>paths to libs not set</fail>
45 </target>
46
[17349]47 <target name="test-setup">
48 <path id="test.classpath">
[18962]49 <pathelement path="anttasks.jar"/>
[17349]50 <pathelement path="${crypt.jar}"/>
51 </path>
52 <typedef name="dcff" classname="org.greenstone.anttasks.DeleteChunkFromFile" classpathref="test.classpath"/>
53 <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="test.classpath"/>
[17836]54 <typedef name="gpv" classname="org.greenstone.anttasks.GetPropertyValue" classpathref="test.classpath"/>
[17349]55 <mkdir dir="test"/>
56 </target>
[17295]57
[17349]58 <target name="test" depends="test-setup">
59 <antcall target="test-rsr"/>
[17554]60 <antcall target="test-dcff"/>
[17836]61 <antcall target="test-gpv"/>
[17349]62 </target>
[17295]63
[17349]64 <target name="test-rsr" depends="test-setup">
65
[17554]66 <!-- test 1 -->
[17553]67 <copy file="src/test/rsr.txt" tofile="test/rsr1.txt"/>
[17349]68 <rsr file="test/rsr1.txt" pattern="things" replacement="strings"/>
69
[17554]70 <!-- test 2 -->
71 <copy file="src/test/rsr.txt" tofile="test/rsr2.txt"/>
[17349]72 <rsr file="test/rsr2.txt">
73 <job pattern="things" replacement="objects"/>
74 <job pattern="Or" replacement="And"/>
75 </rsr>
76
[17554]77 <!-- test 3 -->
78 <copy file="src/test/rsr.txt" tofile="test/rsr3.txt"/>
[17349]79 <rsr file="test/rsr3.txt" pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
80 <rsr file="test/rsr3.txt" pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
81
[17554]82 <!-- test 4 -->
83 <copy file="src/test/rsr.txt" tofile="test/rsr4.txt"/>
[17349]84 <rsr file="test/rsr4.txt">
85 <job pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
86 <job pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
87 </rsr>
88
[17902]89 <!-- test 5 -->
90 <copy file="src/test/rsr.txt" tofile="test/rsr5-1.txt"/>
91 <copy file="src/test/rsr.txt" tofile="test/rsr5-2.txt"/>
92 <rsr>
93 <fileset dir="test" includes="rsr5-*"/>
94 <job pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
95 <job pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
96 </rsr>
97
[18960]98 <!-- test 6 -->
99 <copy file="src/test/rsr.txt" tofile="test/rsr6-1.txt"/>
100 <copy file="src/test/rsr.txt" tofile="test/rsr6-2.txt"/>
101 <copy file="src/test/rsr.txt" tofile="test/rsr6-3.txt"/>
102 <copy file="src/test/rsr.txt" tofile="test/rsr6-4.txt"/>
103 <rsr file="test/rsr6-1.txt" pattern="e" replacement="*" lines="8"/>
104 <rsr file="test/rsr6-2.txt" pattern="e" replacement="*" lines="4-9"/>
105 <rsr file="test/rsr6-3.txt" pattern="e" replacement="*" lines="-8"/>
106 <rsr file="test/rsr6-4.txt" pattern="e" replacement="*" lines="4-"/>
[17902]107
[17349]108 </target>
109
[17554]110 <target name="test-dcff" depends="test-setup">
111
112 <!-- test 1 -->
113 <copy file="src/test/dcff.txt" tofile="test/dcff1.txt"/>
114 <dcff file="test/dcff1.txt" startTag="The" endTag="brown" leaveTags="true"/>
115
116 <!-- test 2 -->
117 <copy file="src/test/dcff.txt" tofile="test/dcff2.txt"/>
118 <dcff file="test/dcff2.txt" startTag="quick" endTag="brown"/>
119
120 <!-- test 3 -->
121 <copy file="src/test/dcff.txt" tofile="test/dcff3.txt"/>
122 <dcff file="test/dcff3.txt" startTag="fox" leaveTags="true"/>
123
[20047]124 <!-- test 4 -->
125 <copy file="src/test/dcff.txt" tofile="test/dcff4.txt"/>
126 <dcff file="test/dcff4.txt" startTag="&lt;!--start--&gt;" endTag="&lt;!--end--&gt;"/>
[17554]127
[20204]128 <!-- test 5 -->
129 <copy file="src/test/dcff.txt" tofile="test/dcff5.txt"/>
130 <dcff file="test/dcff5.txt" startTag="&lt;!--\s*if\s*(?!.*linux)[^ ]+\s*--&gt;" endTag="&lt;!--\s*/if\s*--&gt;" />
131
132
[20047]133 </target>
134
[17836]135 <target name="test-gpv" depends="test-setup">
[17554]136
[17836]137 <!-- test 1 -->
138 <gpv propertiesFile="src/test/gpv.txt" propertyName="startmenu.path" outputProperty="gpv.startmenu.path"/>
139 <echo>startmenu.path = '${gpv.startmenu.path}'</echo>
140
141 <gpv propertiesFile="src/test/gpv.txt" propertyName="my.second.property" outputProperty="gpv.my.second.property"/>
142 <echo>my.second.property = '${gpv.my.second.property}'</echo>
143
144
145 </target>
146
[20038]147 <target name="test-win-sevenzip" depends="test-setup">
148
149 <!-- test 1 -->
150 <copy file="src/test/sevenzip.lzma" tofile="test/sevenzip1.lzma"/>
[20041]151 <sevenzip task="decode" input="test/sevenzip1.lzma" output="test/sevenzip1.comp"/>
[20038]152
153 </target>
154
[17349]155 <target name="test-clean">
156 <delete dir="test"/>
157 </target>
158
[17089]159</project>
Note: See TracBrowser for help on using the repository browser.