| 1 | <?xml version="1.0"?> |
|---|
| 2 | |
|---|
| 3 | <!-- |
|---|
| 4 | |
|---|
| 5 | Requires |
|---|
| 6 | * JDK 1.5 |
|---|
| 7 | * IT Mill Toolkit 5 JAR in WEB-INF/lib directory |
|---|
| 8 | |
|---|
| 9 | --> |
|---|
| 10 | <project name="IT Mill Testing Tools" basedir="../" default="package"> |
|---|
| 11 | |
|---|
| 12 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 13 | Initialization |
|---|
| 14 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 15 | <target name="init"> |
|---|
| 16 | <property file="build/VERSION" /> |
|---|
| 17 | <property file="build/html-style.properties" /> |
|---|
| 18 | <property name="product-file" value="itmill-testingtools" /> |
|---|
| 19 | <property name="product-name" value="IT Mill Testing Tools" /> |
|---|
| 20 | <property name="testingtools-package" value="com/itmill/testingtools" /> |
|---|
| 21 | <property name="WebContent-dir" value="build/result/WebContent-dir" /> |
|---|
| 22 | <property name="src-working-dir" value="build/result/src-working-dir" /> |
|---|
| 23 | <property name="output-dir" value="build/result/${product-file}-${version}" /> |
|---|
| 24 | |
|---|
| 25 | <property name="jre-windows-zip" value="build/package/windows/jre-windows.zip" /> |
|---|
| 26 | <property name="package-windows-filename" value="build/result/itmill-testingtools-${version}-windows.zip" /> |
|---|
| 27 | <property name="package-linux-filename" value="build/result/itmill-testingtools-${version}-linux.zip" /> |
|---|
| 28 | <property name="package-mac-filename" value="build/result/itmill-testingtools-${version}-mac.zip" /> |
|---|
| 29 | <property name="package-host-windows-filename" value="build/result/itmill-testingtools-host-${version}-windows.zip" /> |
|---|
| 30 | <property name="package-host-linux-filename" value="build/result/itmill-testingtools-host-${version}-linux.zip" /> |
|---|
| 31 | <property name="package-host-mac-filename" value="build/result/itmill-testingtools-host-${version}-mac.zip" /> |
|---|
| 32 | <property name="package-toolkit-automatedtests-filename" value="build/result/itmill-toolkit-automatedtests-${version}.zip" /> |
|---|
| 33 | <property name="package-plugin-jar" value="itmill-testingtools-plugin-api.jar" /> |
|---|
| 34 | |
|---|
| 35 | <echo message="Prepared to build ${product-file} version ${version} packages" /> |
|---|
| 36 | |
|---|
| 37 | <mkdir dir="build/result" /> |
|---|
| 38 | <mkdir dir="${output-dir}" /> |
|---|
| 39 | </target> |
|---|
| 40 | |
|---|
| 41 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 42 | Build release package |
|---|
| 43 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 44 | <target name="package" depends="init, clean-all, package-windows, package-linux, package-mac" description="Build public release"> |
|---|
| 45 | <!-- delete temporary files --> |
|---|
| 46 | <!-- |
|---|
| 47 | <delete dir="${WebContent-dir}" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false" /> |
|---|
| 48 | --> |
|---|
| 49 | <!-- Note: deploy only WebContent-dir folder to your Testing Host if you are doing development on a remote machine --> |
|---|
| 50 | <delete dir="${src-working-dir}" followsymlinks="false" defaultexcludes="false" includeemptydirs="true" failonerror="false" /> |
|---|
| 51 | </target> |
|---|
| 52 | |
|---|
| 53 | <target name="package-windows" depends="compile-java"> |
|---|
| 54 | <zip destfile="${package-windows-filename}"> |
|---|
| 55 | <!-- include TT Server --> |
|---|
| 56 | <zipfileset prefix="itmill-testingtools-${version}/application/WebContent" dir="build/result/WebContent-dir"> |
|---|
| 57 | <include name="*/**" /> |
|---|
| 58 | </zipfileset> |
|---|
| 59 | <!-- include platform specific files --> |
|---|
| 60 | <zipfileset prefix="itmill-testingtools-${version}" dir="build/package/windows"> |
|---|
| 61 | <include name="*Server.bat" /> |
|---|
| 62 | <include name="*.txt" /> |
|---|
| 63 | </zipfileset> |
|---|
| 64 | <zipfileset prefix="itmill-testingtools-${version}" dir=""> |
|---|
| 65 | <include name="readme.txt" /> |
|---|
| 66 | <include name="*.pdf" /> |
|---|
| 67 | </zipfileset> |
|---|
| 68 | <zipfileset prefix="itmill-testingtools-${version}/doc/plugin/src/com/itmill/testingtools/plugin" dir="src/com/itmill/testingtools/plugin"> |
|---|
| 69 | <include name="**/*.java" /> |
|---|
| 70 | </zipfileset> |
|---|
| 71 | <zipfileset prefix="itmill-testingtools-${version}/doc/plugin" dir=""> |
|---|
| 72 | <include name="testscript*.txt" /> |
|---|
| 73 | </zipfileset> |
|---|
| 74 | <zipfileset prefix="itmill-testingtools-${version}" dir="${output-dir}"> |
|---|
| 75 | <include name="release-notes.html" /> |
|---|
| 76 | </zipfileset> |
|---|
| 77 | <!-- include JRE --> |
|---|
| 78 | <zipfileset prefix="itmill-testingtools-${version}/application" src="${jre-windows-zip}" /> |
|---|
| 79 | </zip> |
|---|
| 80 | <zip destfile="${package-host-windows-filename}"> |
|---|
| 81 | <!-- include TT Worker --> |
|---|
| 82 | <zipfileset prefix="itmill-testingtools-host-${version}/application/WebContent" dir="build/result/WebContent-dir"> |
|---|
| 83 | <include name="WEB-INF/classes/**" /> |
|---|
| 84 | <exclude name="WEB-INF/classes/com/itmill/testingtools/ui/Target**" /> |
|---|
| 85 | <exclude name="WEB-INF/classes/com/itmill/testingtools/plugin/**" /> |
|---|
| 86 | <include name="WEB-INF/lib/**" /> |
|---|
| 87 | </zipfileset> |
|---|
| 88 | <!-- include platform specific files --> |
|---|
| 89 | <zipfileset prefix="itmill-testingtools-host-${version}" dir="build/package/windows"> |
|---|
| 90 | <include name="*Host.bat" /> |
|---|
| 91 | </zipfileset> |
|---|
| 92 | <!-- include JRE --> |
|---|
| 93 | <zipfileset prefix="itmill-testingtools-host-${version}/application" src="${jre-windows-zip}" /> |
|---|
| 94 | </zip> |
|---|
| 95 | </target> |
|---|
| 96 | |
|---|
| 97 | <target name="package-linux" depends="compile-java"> |
|---|
| 98 | <zip destfile="${package-linux-filename}"> |
|---|
| 99 | <!-- include TT Server --> |
|---|
| 100 | <zipfileset prefix="itmill-testingtools-${version}/application/WebContent" dir="build/result/WebContent-dir"> |
|---|
| 101 | <include name="*/**" /> |
|---|
| 102 | </zipfileset> |
|---|
| 103 | <!-- include platform specific files --> |
|---|
| 104 | <zipfileset prefix="itmill-testingtools-${version}" dir="build/package/unix"> |
|---|
| 105 | <include name="StartTestingServer.sh" /> |
|---|
| 106 | <include name="*.txt" /> |
|---|
| 107 | </zipfileset> |
|---|
| 108 | <zipfileset prefix="itmill-testingtools-${version}" dir=""> |
|---|
| 109 | <include name="readme.txt" /> |
|---|
| 110 | <include name="*.pdf" /> |
|---|
| 111 | </zipfileset> |
|---|
| 112 | <zipfileset prefix="itmill-testingtools-${version}/doc/plugin/src/com/itmill/testingtools/plugin" dir="src/com/itmill/testingtools/plugin"> |
|---|
| 113 | <include name="**/*.java" /> |
|---|
| 114 | </zipfileset> |
|---|
| 115 | <zipfileset prefix="itmill-testingtools-${version}" dir="${output-dir}"> |
|---|
| 116 | <include name="release-notes.html" /> |
|---|
| 117 | </zipfileset> |
|---|
| 118 | </zip> |
|---|
| 119 | <zip destfile="${package-host-linux-filename}"> |
|---|
| 120 | <!-- include TT Worker --> |
|---|
| 121 | <zipfileset prefix="itmill-testingtools-host-${version}/application/WebContent" dir="build/result/WebContent-dir"> |
|---|
| 122 | <include name="WEB-INF/classes/**" /> |
|---|
| 123 | <exclude name="WEB-INF/classes/com/itmill/testingtools/ui/Target**" /> |
|---|
| 124 | <exclude name="WEB-INF/classes/com/itmill/testingtools/plugin/**" /> |
|---|
| 125 | <include name="WEB-INF/lib/**" /> |
|---|
| 126 | </zipfileset> |
|---|
| 127 | <!-- include platform specific files --> |
|---|
| 128 | <zipfileset prefix="itmill-testingtools-host-${version}" dir="build/package/unix"> |
|---|
| 129 | <include name="StartTestingHost.sh" /> |
|---|
| 130 | </zipfileset> |
|---|
| 131 | </zip> |
|---|
| 132 | </target> |
|---|
| 133 | |
|---|
| 134 | <target name="package-mac" depends="compile-java"> |
|---|
| 135 | <zip destfile="${package-mac-filename}"> |
|---|
| 136 | <!-- include TT Server --> |
|---|
| 137 | <zipfileset prefix="itmill-testingtools-${version}/application/WebContent" dir="build/result/WebContent-dir"> |
|---|
| 138 | <include name="*/**" /> |
|---|
| 139 | </zipfileset> |
|---|
| 140 | <!-- include platform specific files --> |
|---|
| 141 | <zipfileset prefix="itmill-testingtools-${version}" dir="build/package/unix"> |
|---|
| 142 | <include name="StartTestingServer.sh" /> |
|---|
| 143 | <include name="*.txt" /> |
|---|
| 144 | </zipfileset> |
|---|
| 145 | <zipfileset prefix="itmill-testingtools-${version}" dir=""> |
|---|
| 146 | <include name="readme.txt" /> |
|---|
| 147 | <include name="*.pdf" /> |
|---|
| 148 | </zipfileset> |
|---|
| 149 | <zipfileset prefix="itmill-testingtools-${version}/doc/plugin/src/com/itmill/testingtools/plugin" dir="src/com/itmill/testingtools/plugin"> |
|---|
| 150 | <include name="**/*.java" /> |
|---|
| 151 | </zipfileset> |
|---|
| 152 | <zipfileset prefix="itmill-testingtools-${version}/doc/plugin" dir=""> |
|---|
| 153 | <include name="testscript*.txt" /> |
|---|
| 154 | </zipfileset> |
|---|
| 155 | <zipfileset prefix="itmill-testingtools-${version}" dir="${output-dir}"> |
|---|
| 156 | <include name="release-notes.html" /> |
|---|
| 157 | </zipfileset> |
|---|
| 158 | </zip> |
|---|
| 159 | <zip destfile="${package-host-mac-filename}"> |
|---|
| 160 | <!-- include TT Worker --> |
|---|
| 161 | <zipfileset prefix="itmill-testingtools-host-${version}/application/WebContent" dir="build/result/WebContent-dir"> |
|---|
| 162 | <include name="WEB-INF/classes/**" /> |
|---|
| 163 | <exclude name="WEB-INF/classes/com/itmill/testingtools/ui/Target**" /> |
|---|
| 164 | <exclude name="WEB-INF/classes/com/itmill/testingtools/plugin/**" /> |
|---|
| 165 | <include name="WEB-INF/lib/**" /> |
|---|
| 166 | </zipfileset> |
|---|
| 167 | <!-- include platform specific files --> |
|---|
| 168 | <zipfileset prefix="itmill-testingtools-host-${version}" dir="build/package/unix"> |
|---|
| 169 | <include name="StartTestingHost.sh" /> |
|---|
| 170 | </zipfileset> |
|---|
| 171 | </zip> |
|---|
| 172 | </target> |
|---|
| 173 | |
|---|
| 174 | <target name="package-dev" depends="init, clean-all, compile-java" description="Build development release"> |
|---|
| 175 | </target> |
|---|
| 176 | |
|---|
| 177 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 178 | Clean results |
|---|
| 179 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 180 | <target name="clean-all" depends=""> |
|---|
| 181 | <delete dir="build/result" /> |
|---|
| 182 | </target> |
|---|
| 183 | |
|---|
| 184 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 185 | Copy root content |
|---|
| 186 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 187 | <target name="copy-root-content" depends="init"> |
|---|
| 188 | <copy todir="${output-dir}"> |
|---|
| 189 | <fileset dir="."> |
|---|
| 190 | <exclude name="**/.svn" /> |
|---|
| 191 | <exclude name="**/.#*" /> |
|---|
| 192 | <include name="*.pdf" /> |
|---|
| 193 | </fileset> |
|---|
| 194 | </copy> |
|---|
| 195 | <!-- Copy and parameterize Release Notes. --> |
|---|
| 196 | <copy todir="${output-dir}"> |
|---|
| 197 | <filterchain> |
|---|
| 198 | <expandproperties /> |
|---|
| 199 | <replacetokens begintoken="<" endtoken=">"> |
|---|
| 200 | <token key="version" value="${version}" /> |
|---|
| 201 | <token key="/version" value="" /> |
|---|
| 202 | </replacetokens> |
|---|
| 203 | <replacetokens begintoken="<" endtoken=">"> |
|---|
| 204 | <token key="platform" value="${package-platform}" /> |
|---|
| 205 | <token key="/platform" value="" /> |
|---|
| 206 | </replacetokens> |
|---|
| 207 | </filterchain> |
|---|
| 208 | <fileset dir="."> |
|---|
| 209 | <include name="release-notes.html" /> |
|---|
| 210 | </fileset> |
|---|
| 211 | </copy> |
|---|
| 212 | </target> |
|---|
| 213 | |
|---|
| 214 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 215 | Copy WebContent |
|---|
| 216 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 217 | <target name="copy-webcontent-content" depends="init"> |
|---|
| 218 | <copy todir="${WebContent-dir}"> |
|---|
| 219 | <fileset dir="WebContent"> |
|---|
| 220 | <exclude name="doc/original-drawings/**" /> |
|---|
| 221 | <exclude name="doc/*.txt" /> |
|---|
| 222 | <exclude name="doc/Makefile" /> |
|---|
| 223 | <exclude name="doc/*.odt" /> |
|---|
| 224 | <exclude name="**/.svn" /> |
|---|
| 225 | <exclude name="**/.#*" /> |
|---|
| 226 | <exclude name="WEB-INF/classes/**" /> |
|---|
| 227 | </fileset> |
|---|
| 228 | </copy> |
|---|
| 229 | |
|---|
| 230 | <!-- fix dos/unix crlf mixups --> |
|---|
| 231 | <fixcrlf srcdir="${WebContent-dir}/ext" includes="**/*.js **/*.css" eol="lf" eof="remove"> |
|---|
| 232 | </fixcrlf> |
|---|
| 233 | |
|---|
| 234 | <!-- optimize and obfuscate javascript --> |
|---|
| 235 | <for param="file"> |
|---|
| 236 | <path> |
|---|
| 237 | <fileset dir="${WebContent-dir}/ext"> |
|---|
| 238 | <include name="**/*.js" /> |
|---|
| 239 | </fileset> |
|---|
| 240 | </path> |
|---|
| 241 | <sequential> |
|---|
| 242 | <echo>Obfuscating: @{file}</echo> |
|---|
| 243 | <java dir="${WebContent-dir}/ext" jar="build/lib/custom_rhino.jar" fork="true" failonerror="true" maxmemory="128m" output="@{file}"> |
|---|
| 244 | <arg value="-c" /> |
|---|
| 245 | <arg value="@{file}" /> |
|---|
| 246 | </java> |
|---|
| 247 | </sequential> |
|---|
| 248 | </for> |
|---|
| 249 | </target> |
|---|
| 250 | |
|---|
| 251 | <!-- Copy and preprocess sources for packaging |
|---|
| 252 | NOTE: Replaces <version></version> tags with build version tag for some "textual" files |
|---|
| 253 | --> |
|---|
| 254 | <target name="preprocess-src" depends="init"> |
|---|
| 255 | <mkdir dir="${src-working-dir}" /> |
|---|
| 256 | <echo>Copying src directory and processing copied files.</echo> |
|---|
| 257 | <echo>Replacing <version> tag with build version for java/html/css/xml files.</echo> |
|---|
| 258 | <copy todir="${src-working-dir}"> |
|---|
| 259 | <filterset> |
|---|
| 260 | <filter token="VERSION" value="${version}" /> |
|---|
| 261 | </filterset> |
|---|
| 262 | <fileset dir="src"> |
|---|
| 263 | <patternset> |
|---|
| 264 | <include name="**/*.java" /> |
|---|
| 265 | <include name="**/*.html" /> |
|---|
| 266 | <include name="**/*.css" /> |
|---|
| 267 | <include name="**/*.xml" /> |
|---|
| 268 | </patternset> |
|---|
| 269 | </fileset> |
|---|
| 270 | </copy> |
|---|
| 271 | |
|---|
| 272 | <!-- Unify mix usage of mac/Linux/Win characters --> |
|---|
| 273 | <echo>Unifying mix usage of Mac/Linux/Win linefeeds for java/html/css/xml files.</echo> |
|---|
| 274 | <fixcrlf srcdir="${src-working-dir}" eol="crlf" tablength="4" tab="asis" includes="**/*.java **/*.html **/*.css **/*.xml" /> |
|---|
| 275 | |
|---|
| 276 | </target> |
|---|
| 277 | |
|---|
| 278 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 279 | Process WebContent/WEB-INF/classes (compile from java source) |
|---|
| 280 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 281 | <target name="compile-java" depends="preprocess-src, copy-webcontent-content, copy-root-content"> |
|---|
| 282 | <mkdir dir="${WebContent-dir}/WEB-INF/classes" /> |
|---|
| 283 | <javac encoding="UTF-8" source="1.5" target="1.5" srcdir="${src-working-dir}" destdir="${WebContent-dir}/WEB-INF/classes" includes="${testingtools-package}/**" debug="true"> |
|---|
| 284 | <classpath> |
|---|
| 285 | <fileset dir="${WebContent-dir}/WEB-INF/lib" includes="**/*.jar" /> |
|---|
| 286 | </classpath> |
|---|
| 287 | </javac> |
|---|
| 288 | </target> |
|---|
| 289 | |
|---|
| 290 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 291 | Create JAR package |
|---|
| 292 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 293 | <target name="package-plugin-jar" depends="compile-java"> |
|---|
| 294 | <jar jarfile="${output-dir}/${package-plugin-jar}"> |
|---|
| 295 | <manifest> |
|---|
| 296 | <attribute name="Built-By" value="IT Mill Ltd." /> |
|---|
| 297 | <section name="common"> |
|---|
| 298 | <attribute name="Specification-Title" value="IT Mill Testing Tools" /> |
|---|
| 299 | <attribute name="Specification-Version" value="${version}" /> |
|---|
| 300 | <attribute name="Specification-Vendor" value="IT Mill Ltd." /> |
|---|
| 301 | <attribute name="Implementation-Title" value="IT Mill Testing Tools" /> |
|---|
| 302 | <attribute name="Implementation-Version" value="${version}" /> |
|---|
| 303 | <attribute name="Implementation-Vendor" value="IT Mill Ltd." /> |
|---|
| 304 | </section> |
|---|
| 305 | </manifest> |
|---|
| 306 | <fileset dir="${WebContent-dir}/WEB-INF/classes"> |
|---|
| 307 | <patternset> |
|---|
| 308 | <include name="**/*.class" /> |
|---|
| 309 | </patternset> |
|---|
| 310 | </fileset> |
|---|
| 311 | </jar> |
|---|
| 312 | </target> |
|---|
| 313 | |
|---|
| 314 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 315 | Create war package |
|---|
| 316 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 317 | <!-- |
|---|
| 318 | <target name="package-war" depends="ext, compile-java"> |
|---|
| 319 | <war warfile="${output-dir}/${package-war-filename}" webxml="${WebContent-dir}/WEB-INF/web.xml"> |
|---|
| 320 | <fileset dir="${WebContent-dir}"> |
|---|
| 321 | <exclude name="WEB-INF/web.xml" /> |
|---|
| 322 | </fileset> |
|---|
| 323 | </war> |
|---|
| 324 | </target> |
|---|
| 325 | --> |
|---|
| 326 | |
|---|
| 327 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 328 | Ant extensions |
|---|
| 329 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
|---|
| 330 | |
|---|
| 331 | <!-- ant contrib required for flow control (for loop) --> |
|---|
| 332 | <taskdef resource="net/sf/antcontrib/antlib.xml"> |
|---|
| 333 | <classpath> |
|---|
| 334 | <pathelement location="build/lib/ant-contrib-1.0b3.jar" /> |
|---|
| 335 | </classpath> |
|---|
| 336 | </taskdef> |
|---|
| 337 | |
|---|
| 338 | <!-- java2html converter --> |
|---|
| 339 | <taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask" classpath="build/lib/java2html.jar" /> |
|---|
| 340 | |
|---|
| 341 | |
|---|
| 342 | </project> |
|---|