[17089] | 1 | <project name="compile-ant-tasks" default="compile">
|
---|
| 2 |
|
---|
| 3 | <condition property="libs.set">
|
---|
| 4 | <and>
|
---|
| 5 | <isset property="crypt.jar"/>
|
---|
| 6 | </and>
|
---|
| 7 | </condition>
|
---|
| 8 |
|
---|
| 9 | <target name="compile" depends="check-libs">
|
---|
| 10 |
|
---|
| 11 | <mkdir dir="classes"/>
|
---|
| 12 | <javac
|
---|
| 13 | srcdir="src/org/greenstone/anttasks"
|
---|
| 14 | destdir="classes"
|
---|
| 15 | classpath="${crypt.jar}"/>
|
---|
| 16 |
|
---|
| 17 | <mkdir dir="lib"/>
|
---|
| 18 | <jar
|
---|
| 19 | destfile="lib/anttasks.jar"
|
---|
| 20 | basedir="classes"/>
|
---|
| 21 |
|
---|
| 22 | </target>
|
---|
| 23 |
|
---|
[17295] | 24 | <target name="clean">
|
---|
| 25 | <delete dir="classes"/>
|
---|
| 26 | <delete dir="lib"/>
|
---|
| 27 | </target>
|
---|
| 28 |
|
---|
[17089] | 29 | <target name="check-libs" unless="libs.set">
|
---|
| 30 | <echo>Please set crypt.jar property to the path of the crypt.jar file</echo>
|
---|
| 31 | <echo>E.g., ant -Dcrypt.jar=/path/to/crypt.jar</echo>
|
---|
| 32 | <fail>paths to libs not set</fail>
|
---|
| 33 | </target>
|
---|
| 34 |
|
---|
[17349] | 35 | <target name="test-setup">
|
---|
| 36 | <path id="test.classpath">
|
---|
| 37 | <pathelement path="lib/anttasks.jar"/>
|
---|
| 38 | <pathelement path="${crypt.jar}"/>
|
---|
| 39 | </path>
|
---|
| 40 | <typedef name="dcff" classname="org.greenstone.anttasks.DeleteChunkFromFile" classpathref="test.classpath"/>
|
---|
| 41 | <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="test.classpath"/>
|
---|
| 42 | <mkdir dir="test"/>
|
---|
| 43 | </target>
|
---|
[17295] | 44 |
|
---|
[17349] | 45 | <target name="test" depends="test-setup">
|
---|
| 46 | <antcall target="test-rsr"/>
|
---|
[17554] | 47 | <antcall target="test-dcff"/>
|
---|
[17349] | 48 | </target>
|
---|
[17295] | 49 |
|
---|
[17349] | 50 | <target name="test-rsr" depends="test-setup">
|
---|
| 51 |
|
---|
[17554] | 52 | <!-- test 1 -->
|
---|
[17553] | 53 | <copy file="src/test/rsr.txt" tofile="test/rsr1.txt"/>
|
---|
[17349] | 54 | <rsr file="test/rsr1.txt" pattern="things" replacement="strings"/>
|
---|
| 55 |
|
---|
[17554] | 56 | <!-- test 2 -->
|
---|
| 57 | <copy file="src/test/rsr.txt" tofile="test/rsr2.txt"/>
|
---|
[17349] | 58 | <rsr file="test/rsr2.txt">
|
---|
| 59 | <job pattern="things" replacement="objects"/>
|
---|
| 60 | <job pattern="Or" replacement="And"/>
|
---|
| 61 | </rsr>
|
---|
| 62 |
|
---|
[17554] | 63 | <!-- test 3 -->
|
---|
| 64 | <copy file="src/test/rsr.txt" tofile="test/rsr3.txt"/>
|
---|
[17349] | 65 | <rsr file="test/rsr3.txt" pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
|
---|
| 66 | <rsr file="test/rsr3.txt" pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
|
---|
| 67 |
|
---|
[17554] | 68 | <!-- test 4 -->
|
---|
| 69 | <copy file="src/test/rsr.txt" tofile="test/rsr4.txt"/>
|
---|
[17349] | 70 | <rsr file="test/rsr4.txt">
|
---|
| 71 | <job pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
|
---|
| 72 | <job pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
|
---|
| 73 | </rsr>
|
---|
| 74 |
|
---|
| 75 | </target>
|
---|
| 76 |
|
---|
[17554] | 77 | <target name="test-dcff" depends="test-setup">
|
---|
| 78 |
|
---|
| 79 | <!-- test 1 -->
|
---|
| 80 | <copy file="src/test/dcff.txt" tofile="test/dcff1.txt"/>
|
---|
| 81 | <dcff file="test/dcff1.txt" startTag="The" endTag="brown" leaveTags="true"/>
|
---|
| 82 |
|
---|
| 83 | <!-- test 2 -->
|
---|
| 84 | <copy file="src/test/dcff.txt" tofile="test/dcff2.txt"/>
|
---|
| 85 | <dcff file="test/dcff2.txt" startTag="quick" endTag="brown"/>
|
---|
| 86 |
|
---|
| 87 | <!-- test 3 -->
|
---|
| 88 | <copy file="src/test/dcff.txt" tofile="test/dcff3.txt"/>
|
---|
| 89 | <dcff file="test/dcff3.txt" startTag="fox" leaveTags="true"/>
|
---|
| 90 |
|
---|
| 91 | </target>
|
---|
| 92 |
|
---|
| 93 |
|
---|
[17349] | 94 | <target name="test-clean">
|
---|
| 95 | <delete dir="test"/>
|
---|
| 96 | </target>
|
---|
| 97 |
|
---|
[17089] | 98 | </project>
|
---|