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

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

Include crypt.jar to simplify compiling

File size: 5.3 KB
Line 
1<project name="compile-ant-tasks" default="compile">
2
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
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
31 destfile="anttasks.jar"
32 basedir="classes"/>
33
34 </target>
35
36 <target name="clean">
37 <delete dir="classes"/>
38 <delete file="anttasks.jar"/>
39 </target>
40
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
47 <target name="test-setup">
48 <path id="test.classpath">
49 <pathelement path="anttasks.jar"/>
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"/>
54 <typedef name="gpv" classname="org.greenstone.anttasks.GetPropertyValue" classpathref="test.classpath"/>
55 <mkdir dir="test"/>
56 </target>
57
58 <target name="test" depends="test-setup">
59 <antcall target="test-rsr"/>
60 <antcall target="test-dcff"/>
61 <antcall target="test-gpv"/>
62 </target>
63
64 <target name="test-rsr" depends="test-setup">
65
66 <!-- test 1 -->
67 <copy file="src/test/rsr.txt" tofile="test/rsr1.txt"/>
68 <rsr file="test/rsr1.txt" pattern="things" replacement="strings"/>
69
70 <!-- test 2 -->
71 <copy file="src/test/rsr.txt" tofile="test/rsr2.txt"/>
72 <rsr file="test/rsr2.txt">
73 <job pattern="things" replacement="objects"/>
74 <job pattern="Or" replacement="And"/>
75 </rsr>
76
77 <!-- test 3 -->
78 <copy file="src/test/rsr.txt" tofile="test/rsr3.txt"/>
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
82 <!-- test 4 -->
83 <copy file="src/test/rsr.txt" tofile="test/rsr4.txt"/>
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
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
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-"/>
107
108 </target>
109
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
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;"/>
127
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
133 </target>
134
135 <target name="test-gpv" depends="test-setup">
136
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
147 <target name="test-win-sevenzip" depends="test-setup">
148
149 <!-- test 1 -->
150 <copy file="src/test/sevenzip.lzma" tofile="test/sevenzip1.lzma"/>
151 <sevenzip task="decode" input="test/sevenzip1.lzma" output="test/sevenzip1.comp"/>
152
153 </target>
154
155 <target name="test-clean">
156 <delete dir="test"/>
157 </target>
158
159</project>
Note: See TracBrowser for help on using the repository browser.