[14627] | 1 | <?xml version="1.0"?>
|
---|
| 2 |
|
---|
| 3 | <project name="jar-test" basedir="." default="test1">
|
---|
| 4 |
|
---|
| 5 | <property name="tmp.jar" location="tmp.jar"/>
|
---|
| 6 | <property name="tmp.dir" location="jartmp"/>
|
---|
| 7 | <property name="tmp.zip" location="tmp.zip"/>
|
---|
| 8 | <property name="tmp1.dir" location="jartmp1"/>
|
---|
| 9 | <property name="tmp2.dir" location="jartmp2"/>
|
---|
| 10 |
|
---|
| 11 | <target name="test1">
|
---|
| 12 | <jar/>
|
---|
| 13 | </target>
|
---|
| 14 |
|
---|
| 15 | <target name="test2">
|
---|
| 16 | <jar
|
---|
| 17 | jarfile="jar.tmp"
|
---|
| 18 | manifest="none"
|
---|
| 19 | />
|
---|
| 20 | </target>
|
---|
| 21 |
|
---|
| 22 | <target name="test3">
|
---|
| 23 | <jar
|
---|
| 24 | destfile="jar.tmp"
|
---|
| 25 | whenempty="format C: /y"
|
---|
| 26 | />
|
---|
| 27 | </target>
|
---|
| 28 |
|
---|
| 29 | <target name="test4">
|
---|
| 30 | <jar
|
---|
| 31 | destfile="${tmp.jar}"
|
---|
| 32 | basedir="."
|
---|
| 33 | includes="jar.xml"
|
---|
| 34 | />
|
---|
| 35 | </target>
|
---|
| 36 |
|
---|
| 37 | <target name="testNoRecreateWithUpdate">
|
---|
| 38 | <jar
|
---|
| 39 | destfile="${tmp.jar}"
|
---|
| 40 | basedir="."
|
---|
| 41 | includes="jar.xml"
|
---|
| 42 | update="true"
|
---|
| 43 | />
|
---|
| 44 | </target>
|
---|
| 45 |
|
---|
| 46 | <target name="testRecreateNewerFileSetup" depends="test4">
|
---|
| 47 | <touch file="jar.xml"/>
|
---|
| 48 | </target>
|
---|
| 49 |
|
---|
| 50 | <target name="testRecreateWithoutUpdateAdditionalFiles">
|
---|
| 51 | <jar
|
---|
| 52 | destfile="${tmp.jar}"
|
---|
| 53 | includes="*.xml"
|
---|
| 54 | basedir="."
|
---|
| 55 | />
|
---|
| 56 | </target>
|
---|
| 57 |
|
---|
| 58 | <target name="testRecreateWithUpdateAdditionalFiles">
|
---|
| 59 | <jar
|
---|
| 60 | destfile="${tmp.jar}"
|
---|
| 61 | basedir="."
|
---|
| 62 | includes="*.xml"
|
---|
| 63 | update="true"
|
---|
| 64 | />
|
---|
| 65 | </target>
|
---|
| 66 |
|
---|
| 67 | <target name="testRecreateWithoutUpdateNewerFile">
|
---|
| 68 | <jar
|
---|
| 69 | destfile="${tmp.jar}"
|
---|
| 70 | basedir="."
|
---|
| 71 | includes="jar.xml"
|
---|
| 72 | />
|
---|
| 73 | </target>
|
---|
| 74 |
|
---|
| 75 | <target name="testRecreateWithUpdateNewerFile">
|
---|
| 76 | <jar
|
---|
| 77 | destfile="${tmp.jar}"
|
---|
| 78 | basedir="."
|
---|
| 79 | includes="jar.xml"
|
---|
| 80 | update="true"
|
---|
| 81 | />
|
---|
| 82 | </target>
|
---|
| 83 |
|
---|
| 84 | <target name="testManifestStaysIntact">
|
---|
| 85 | <mkdir dir="${tmp.dir}"/>
|
---|
| 86 | <manifest file="${tmp.dir}/manifest">
|
---|
| 87 | <attribute name="Foo" value="bar"/>
|
---|
| 88 | </manifest>
|
---|
| 89 | <jar destfile="${tmp.jar}" basedir="." includes="jar.xml"
|
---|
| 90 | manifest="${tmp.dir}/manifest"/>
|
---|
| 91 | <sleep seconds="3"/>
|
---|
| 92 | <touch file="jar.xml"/>
|
---|
| 93 | <jar destfile="${tmp.jar}" basedir="." includes="jar.xml"
|
---|
| 94 | update="true"/>
|
---|
| 95 | <unjar src="${tmp.jar}" dest="${tmp.dir}"/>
|
---|
| 96 | </target>
|
---|
| 97 |
|
---|
| 98 | <target name="testNoRecreateBasedirExcludesWithUpdate">
|
---|
| 99 | <jar
|
---|
| 100 | destfile="${tmp.jar}"
|
---|
| 101 | basedir="."
|
---|
| 102 | includes="j*.xml"
|
---|
| 103 | excludes="java.xml"
|
---|
| 104 | update="true"
|
---|
| 105 | />
|
---|
| 106 | </target>
|
---|
| 107 |
|
---|
| 108 | <target name="testNoRecreateBasedirExcludesWithoutUpdate">
|
---|
| 109 | <jar
|
---|
| 110 | destfile="${tmp.jar}"
|
---|
| 111 | basedir="."
|
---|
| 112 | includes="j*.xml"
|
---|
| 113 | excludes="java.xml"
|
---|
| 114 | />
|
---|
| 115 | </target>
|
---|
| 116 |
|
---|
| 117 | <target name="makezip">
|
---|
| 118 | <zip destfile="${tmp.zip}"
|
---|
| 119 | basedir="." includes="j*.xml"/>
|
---|
| 120 | </target>
|
---|
| 121 |
|
---|
| 122 | <target name="testNoRecreateZipfilesetExcludesWithUpdate"
|
---|
| 123 | depends="makezip">
|
---|
| 124 | <jar destfile="${tmp.jar}"
|
---|
| 125 | update="true">
|
---|
| 126 | <zipfileset src="${tmp.zip}" excludes="java.xml"/>
|
---|
| 127 | </jar>
|
---|
| 128 | </target>
|
---|
| 129 |
|
---|
| 130 | <target name="testNoRecreateZipfilesetExcludesWithoutUpdate"
|
---|
| 131 | depends="makezip">
|
---|
| 132 | <jar destfile="${tmp.jar}">
|
---|
| 133 | <zipfileset src="${tmp.zip}" excludes="java.xml"/>
|
---|
| 134 | </jar>
|
---|
| 135 | </target>
|
---|
| 136 |
|
---|
| 137 | <target name="testRecreateZipfilesetWithoutUpdateAdditionalFiles"
|
---|
| 138 | depends="makezip">
|
---|
| 139 | <jar destfile="${tmp.jar}">
|
---|
| 140 | <zipfileset src="${tmp.zip}"/>
|
---|
| 141 | </jar>
|
---|
| 142 | </target>
|
---|
| 143 |
|
---|
| 144 | <target name="testRecreateZipfilesetWithUpdateAdditionalFiles"
|
---|
| 145 | depends="makezip">
|
---|
| 146 | <jar destfile="${tmp.jar}"
|
---|
| 147 | update="true">
|
---|
| 148 | <zipfileset src="${tmp.zip}"/>
|
---|
| 149 | </jar>
|
---|
| 150 | </target>
|
---|
| 151 |
|
---|
| 152 | <target name="testRecreateZipfilesetWithoutUpdateNewerFile"
|
---|
| 153 | depends="makezip">
|
---|
| 154 | <jar destfile="${tmp.jar}">
|
---|
| 155 | <zipfileset src="${tmp.zip}" includes="jar.xml"/>
|
---|
| 156 | </jar>
|
---|
| 157 | </target>
|
---|
| 158 |
|
---|
| 159 | <target name="testRecreateZipfilesetWithUpdateNewerFile"
|
---|
| 160 | depends="makezip">
|
---|
| 161 | <jar destfile="${tmp.jar}"
|
---|
| 162 | update="true">
|
---|
| 163 | <zipfileset src="${tmp.zip}" includes="jar.xml"/>
|
---|
| 164 | </jar>
|
---|
| 165 | </target>
|
---|
| 166 |
|
---|
| 167 | <target name="cleanup">
|
---|
| 168 | <delete file="${tmp.jar}" />
|
---|
| 169 | <delete dir="${tmp.dir}"/>
|
---|
| 170 | <delete file="${tmp.zip}" />
|
---|
| 171 | <delete dir="${tmp1.dir}"/>
|
---|
| 172 | <delete dir="${tmp2.dir}"/>
|
---|
| 173 | </target>
|
---|
| 174 |
|
---|
| 175 | <target name="testCreateWithEmptyFilesetSetUp">
|
---|
| 176 | <mkdir dir="${tmp1.dir}"/>
|
---|
| 177 | <mkdir dir="${tmp2.dir}"/>
|
---|
| 178 | <echo file="${tmp2.dir}/foo.txt" message="foo"/>
|
---|
| 179 | </target>
|
---|
| 180 |
|
---|
| 181 | <target name="testCreateWithEmptyFileset">
|
---|
| 182 | <jar destfile="${tmp.jar}">
|
---|
| 183 | <fileset dir="${tmp1.dir}">
|
---|
| 184 | <include name="**/*.doesNotExist"/>
|
---|
| 185 | </fileset>
|
---|
| 186 | <fileset dir="${tmp2.dir}">
|
---|
| 187 | <include name="**/foo.txt"/>
|
---|
| 188 | </fileset>
|
---|
| 189 | </jar>
|
---|
| 190 | </target>
|
---|
| 191 |
|
---|
| 192 | <!-- bug 17780 -->
|
---|
| 193 | <target name="testUpdateIfOnlyManifestHasChanged"
|
---|
| 194 | depends="test4">
|
---|
| 195 | <jar destfile="${tmp.jar}" update="true">
|
---|
| 196 | <manifest>
|
---|
| 197 | <attribute name="Foo" value="bar"/>
|
---|
| 198 | </manifest>
|
---|
| 199 | </jar>
|
---|
| 200 | <mkdir dir="${tmp.dir}"/>
|
---|
| 201 | <unzip src="${tmp.jar}" dest="${tmp.dir}"/>
|
---|
| 202 | </target>
|
---|
| 203 |
|
---|
| 204 | <!-- bugs 10262 and 16972 -->
|
---|
| 205 | <target name="testIndexTests">
|
---|
| 206 | <mkdir dir="${tmp.dir}/META-INF"/>
|
---|
| 207 | <touch file="${tmp.dir}/META-INF/INDEX.LIST"/>
|
---|
| 208 | <touch file="${tmp.dir}/foo"/>
|
---|
| 209 | <mkdir dir="${tmp.dir}/sub"/>
|
---|
| 210 | <touch file="${tmp.dir}/sub/foo"/>
|
---|
| 211 | <jar destfile="${tmp.jar}" index="yes" basedir="${tmp.dir}"/>
|
---|
| 212 | </target>
|
---|
| 213 | <!-- bug 32802 -->
|
---|
| 214 | <target name="testManifestOnlyJar">
|
---|
| 215 | <mkdir dir="${tmp.dir}"/>
|
---|
| 216 | <jar destfile="${tmp.jar}" duplicate="preserve">
|
---|
| 217 | <manifest>
|
---|
| 218 | <attribute name="Foo" value="bar"/>
|
---|
| 219 | </manifest>
|
---|
| 220 | </jar>
|
---|
| 221 | <mkdir dir="${tmp.dir}"/>
|
---|
| 222 | <unzip src="${tmp.jar}" dest="${tmp.dir}"/>
|
---|
| 223 |
|
---|
| 224 | </target>
|
---|
| 225 | </project>
|
---|