[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 | <jar
|
---|
[18962] | 18 | destfile="anttasks.jar"
|
---|
[17089] | 19 | basedir="classes"/>
|
---|
| 20 |
|
---|
| 21 | </target>
|
---|
| 22 |
|
---|
[17295] | 23 | <target name="clean">
|
---|
| 24 | <delete dir="classes"/>
|
---|
[18963] | 25 | <delete file="anttasks.jar"/>
|
---|
[17295] | 26 | </target>
|
---|
| 27 |
|
---|
[17089] | 28 | <target name="check-libs" unless="libs.set">
|
---|
| 29 | <echo>Please set crypt.jar property to the path of the crypt.jar file</echo>
|
---|
| 30 | <echo>E.g., ant -Dcrypt.jar=/path/to/crypt.jar</echo>
|
---|
| 31 | <fail>paths to libs not set</fail>
|
---|
| 32 | </target>
|
---|
| 33 |
|
---|
[17349] | 34 | <target name="test-setup">
|
---|
| 35 | <path id="test.classpath">
|
---|
[18962] | 36 | <pathelement path="anttasks.jar"/>
|
---|
[17349] | 37 | <pathelement path="${crypt.jar}"/>
|
---|
| 38 | </path>
|
---|
| 39 | <typedef name="dcff" classname="org.greenstone.anttasks.DeleteChunkFromFile" classpathref="test.classpath"/>
|
---|
| 40 | <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="test.classpath"/>
|
---|
[17836] | 41 | <typedef name="gpv" classname="org.greenstone.anttasks.GetPropertyValue" classpathref="test.classpath"/>
|
---|
[17349] | 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"/>
|
---|
[17836] | 48 | <antcall target="test-gpv"/>
|
---|
[17349] | 49 | </target>
|
---|
[17295] | 50 |
|
---|
[17349] | 51 | <target name="test-rsr" depends="test-setup">
|
---|
| 52 |
|
---|
[17554] | 53 | <!-- test 1 -->
|
---|
[17553] | 54 | <copy file="src/test/rsr.txt" tofile="test/rsr1.txt"/>
|
---|
[17349] | 55 | <rsr file="test/rsr1.txt" pattern="things" replacement="strings"/>
|
---|
| 56 |
|
---|
[17554] | 57 | <!-- test 2 -->
|
---|
| 58 | <copy file="src/test/rsr.txt" tofile="test/rsr2.txt"/>
|
---|
[17349] | 59 | <rsr file="test/rsr2.txt">
|
---|
| 60 | <job pattern="things" replacement="objects"/>
|
---|
| 61 | <job pattern="Or" replacement="And"/>
|
---|
| 62 | </rsr>
|
---|
| 63 |
|
---|
[17554] | 64 | <!-- test 3 -->
|
---|
| 65 | <copy file="src/test/rsr.txt" tofile="test/rsr3.txt"/>
|
---|
[17349] | 66 | <rsr file="test/rsr3.txt" pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
|
---|
| 67 | <rsr file="test/rsr3.txt" pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
|
---|
| 68 |
|
---|
[17554] | 69 | <!-- test 4 -->
|
---|
| 70 | <copy file="src/test/rsr.txt" tofile="test/rsr4.txt"/>
|
---|
[17349] | 71 | <rsr file="test/rsr4.txt">
|
---|
| 72 | <job pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
|
---|
| 73 | <job pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
|
---|
| 74 | </rsr>
|
---|
| 75 |
|
---|
[17902] | 76 | <!-- test 5 -->
|
---|
| 77 | <copy file="src/test/rsr.txt" tofile="test/rsr5-1.txt"/>
|
---|
| 78 | <copy file="src/test/rsr.txt" tofile="test/rsr5-2.txt"/>
|
---|
| 79 | <rsr>
|
---|
| 80 | <fileset dir="test" includes="rsr5-*"/>
|
---|
| 81 | <job pattern="@path@" replacement="C:\Program Files\Greenstone 2.80"/>
|
---|
| 82 | <job pattern="@path-with-winpath@" replacement="C:\Program Files\Greenstone 2.80" winPath="true"/>
|
---|
| 83 | </rsr>
|
---|
| 84 |
|
---|
[18960] | 85 | <!-- test 6 -->
|
---|
| 86 | <copy file="src/test/rsr.txt" tofile="test/rsr6-1.txt"/>
|
---|
| 87 | <copy file="src/test/rsr.txt" tofile="test/rsr6-2.txt"/>
|
---|
| 88 | <copy file="src/test/rsr.txt" tofile="test/rsr6-3.txt"/>
|
---|
| 89 | <copy file="src/test/rsr.txt" tofile="test/rsr6-4.txt"/>
|
---|
| 90 | <rsr file="test/rsr6-1.txt" pattern="e" replacement="*" lines="8"/>
|
---|
| 91 | <rsr file="test/rsr6-2.txt" pattern="e" replacement="*" lines="4-9"/>
|
---|
| 92 | <rsr file="test/rsr6-3.txt" pattern="e" replacement="*" lines="-8"/>
|
---|
| 93 | <rsr file="test/rsr6-4.txt" pattern="e" replacement="*" lines="4-"/>
|
---|
[17902] | 94 |
|
---|
[17349] | 95 | </target>
|
---|
| 96 |
|
---|
[17554] | 97 | <target name="test-dcff" depends="test-setup">
|
---|
| 98 |
|
---|
| 99 | <!-- test 1 -->
|
---|
| 100 | <copy file="src/test/dcff.txt" tofile="test/dcff1.txt"/>
|
---|
| 101 | <dcff file="test/dcff1.txt" startTag="The" endTag="brown" leaveTags="true"/>
|
---|
| 102 |
|
---|
| 103 | <!-- test 2 -->
|
---|
| 104 | <copy file="src/test/dcff.txt" tofile="test/dcff2.txt"/>
|
---|
| 105 | <dcff file="test/dcff2.txt" startTag="quick" endTag="brown"/>
|
---|
| 106 |
|
---|
| 107 | <!-- test 3 -->
|
---|
| 108 | <copy file="src/test/dcff.txt" tofile="test/dcff3.txt"/>
|
---|
| 109 | <dcff file="test/dcff3.txt" startTag="fox" leaveTags="true"/>
|
---|
| 110 |
|
---|
[20047] | 111 | <!-- test 4 -->
|
---|
| 112 | <copy file="src/test/dcff.txt" tofile="test/dcff4.txt"/>
|
---|
| 113 | <dcff file="test/dcff4.txt" startTag="<!--start-->" endTag="<!--end-->"/>
|
---|
[17554] | 114 |
|
---|
[20204] | 115 | <!-- test 5 -->
|
---|
| 116 | <copy file="src/test/dcff.txt" tofile="test/dcff5.txt"/>
|
---|
| 117 | <dcff file="test/dcff5.txt" startTag="<!--\s*if\s*(?!.*linux)[^ ]+\s*-->" endTag="<!--\s*/if\s*-->" />
|
---|
| 118 |
|
---|
| 119 |
|
---|
[20047] | 120 | </target>
|
---|
| 121 |
|
---|
[17836] | 122 | <target name="test-gpv" depends="test-setup">
|
---|
[17554] | 123 |
|
---|
[17836] | 124 | <!-- test 1 -->
|
---|
| 125 | <gpv propertiesFile="src/test/gpv.txt" propertyName="startmenu.path" outputProperty="gpv.startmenu.path"/>
|
---|
| 126 | <echo>startmenu.path = '${gpv.startmenu.path}'</echo>
|
---|
| 127 |
|
---|
| 128 | <gpv propertiesFile="src/test/gpv.txt" propertyName="my.second.property" outputProperty="gpv.my.second.property"/>
|
---|
| 129 | <echo>my.second.property = '${gpv.my.second.property}'</echo>
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 | </target>
|
---|
| 133 |
|
---|
[20038] | 134 | <target name="test-win-sevenzip" depends="test-setup">
|
---|
| 135 |
|
---|
| 136 | <!-- test 1 -->
|
---|
| 137 | <copy file="src/test/sevenzip.lzma" tofile="test/sevenzip1.lzma"/>
|
---|
[20041] | 138 | <sevenzip task="decode" input="test/sevenzip1.lzma" output="test/sevenzip1.comp"/>
|
---|
[20038] | 139 |
|
---|
| 140 | </target>
|
---|
| 141 |
|
---|
[17349] | 142 | <target name="test-clean">
|
---|
| 143 | <delete dir="test"/>
|
---|
| 144 | </target>
|
---|
| 145 |
|
---|
[17089] | 146 | </project>
|
---|