[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"/>
|
---|
[17836] | 42 | <typedef name="gpv" classname="org.greenstone.anttasks.GetPropertyValue" classpathref="test.classpath"/>
|
---|
[17349] | 43 | <mkdir dir="test"/>
|
---|
| 44 | </target>
|
---|
[17295] | 45 |
|
---|
[17349] | 46 | <target name="test" depends="test-setup">
|
---|
| 47 | <antcall target="test-rsr"/>
|
---|
[17554] | 48 | <antcall target="test-dcff"/>
|
---|
[17836] | 49 | <antcall target="test-gpv"/>
|
---|
[17349] | 50 | </target>
|
---|
[17295] | 51 |
|
---|
[17349] | 52 | <target name="test-rsr" depends="test-setup">
|
---|
| 53 |
|
---|
[17554] | 54 | <!-- test 1 -->
|
---|
[17553] | 55 | <copy file="src/test/rsr.txt" tofile="test/rsr1.txt"/>
|
---|
[17349] | 56 | <rsr file="test/rsr1.txt" pattern="things" replacement="strings"/>
|
---|
| 57 |
|
---|
[17554] | 58 | <!-- test 2 -->
|
---|
| 59 | <copy file="src/test/rsr.txt" tofile="test/rsr2.txt"/>
|
---|
[17349] | 60 | <rsr file="test/rsr2.txt">
|
---|
| 61 | <job pattern="things" replacement="objects"/>
|
---|
| 62 | <job pattern="Or" replacement="And"/>
|
---|
| 63 | </rsr>
|
---|
| 64 |
|
---|
[17554] | 65 | <!-- test 3 -->
|
---|
| 66 | <copy file="src/test/rsr.txt" tofile="test/rsr3.txt"/>
|
---|
[17349] | 67 | <rsr file="test/rsr3.txt" pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
|
---|
| 68 | <rsr file="test/rsr3.txt" pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
|
---|
| 69 |
|
---|
[17554] | 70 | <!-- test 4 -->
|
---|
| 71 | <copy file="src/test/rsr.txt" tofile="test/rsr4.txt"/>
|
---|
[17349] | 72 | <rsr file="test/rsr4.txt">
|
---|
| 73 | <job pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
|
---|
| 74 | <job pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
|
---|
| 75 | </rsr>
|
---|
| 76 |
|
---|
| 77 | </target>
|
---|
| 78 |
|
---|
[17554] | 79 | <target name="test-dcff" depends="test-setup">
|
---|
| 80 |
|
---|
| 81 | <!-- test 1 -->
|
---|
| 82 | <copy file="src/test/dcff.txt" tofile="test/dcff1.txt"/>
|
---|
| 83 | <dcff file="test/dcff1.txt" startTag="The" endTag="brown" leaveTags="true"/>
|
---|
| 84 |
|
---|
| 85 | <!-- test 2 -->
|
---|
| 86 | <copy file="src/test/dcff.txt" tofile="test/dcff2.txt"/>
|
---|
| 87 | <dcff file="test/dcff2.txt" startTag="quick" endTag="brown"/>
|
---|
| 88 |
|
---|
| 89 | <!-- test 3 -->
|
---|
| 90 | <copy file="src/test/dcff.txt" tofile="test/dcff3.txt"/>
|
---|
| 91 | <dcff file="test/dcff3.txt" startTag="fox" leaveTags="true"/>
|
---|
| 92 |
|
---|
| 93 | </target>
|
---|
| 94 |
|
---|
[17836] | 95 | <target name="test-gpv" depends="test-setup">
|
---|
[17554] | 96 |
|
---|
[17836] | 97 | <!-- test 1 -->
|
---|
| 98 | <gpv propertiesFile="src/test/gpv.txt" propertyName="startmenu.path" outputProperty="gpv.startmenu.path"/>
|
---|
| 99 | <echo>startmenu.path = '${gpv.startmenu.path}'</echo>
|
---|
| 100 |
|
---|
| 101 | <gpv propertiesFile="src/test/gpv.txt" propertyName="my.second.property" outputProperty="gpv.my.second.property"/>
|
---|
| 102 | <echo>my.second.property = '${gpv.my.second.property}'</echo>
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | </target>
|
---|
| 106 |
|
---|
[17349] | 107 | <target name="test-clean">
|
---|
| 108 | <delete dir="test"/>
|
---|
| 109 | </target>
|
---|
| 110 |
|
---|
[17089] | 111 | </project>
|
---|