1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
|
<!--
jabsorb - a Java to JavaScript Advanced Object Request Broker
http://jabsorb.org
Copyright 2007-2008 The jabsorb team
based on original code from
JSON-RPC-Java - a JSON-RPC to Java Bridge with dynamic invocation
Copyright Metaparadigm Pte. Ltd. 2004.
Michael Clark <michael@metaparadigm.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Ant build script for Apache Ant version 1.6.5 or 1.7
-->
<project name="jabsorb" default="dist" basedir=".">
<!-- necessary to be called for every other target, even clean! -->
<target name="init">
<tstamp />
<property file="build.properties" />
<path id="default-classpath" description="This is used for building the jar">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib-ext}">
<include name="*.jar"/>
</fileset>
</path>
<path id="jarClasspath" description="This is used for targets that use the jar">
<path refid="default-classpath" />
<pathelement path="${app-jar}" />
</path>
</target>
<target name="init-build">
<mkdir dir="${build}" />
</target>
<target name="compile" depends="init,init-build" description="Compiles the source into the build directory">
<mkdir dir="${build.classes}"/>
<javac debug="true" source="1.4" srcdir="${src}" destdir="${build.classes}">
<classpath refid="default-classpath" />
</javac>
</target>
<target name="dist" depends="compile,compress-web-content,init-build" description="Puts the compiled source into a jar">
<jar destfile="${app-jar}" basedir="${build.classes}" excludes="*~" />
</target>
<target name="test.init" depends="init" description="Makes directories needed for the test jsps">
<tstamp />
<mkdir dir="${test.lib}" />
<mkdir dir="${test.classes}" />
<path id="test-classpath">
<fileset dir="${lib-test}">
<include name="*.jar"/>
</fileset>
</path>
</target>
<target name="setup-dependencies">
</target>
<target name="check-dependencies" depends="init"
description="Check if the dependencies present in ${lib-ext}">
<!-- In order to re-generate the ${lib-ext} directory, delete the {lib-ext}/dependencies file -->
<available file="${lib-ext}/dependencies" type="file" property="dependencies.present"/>
</target>
<target name="copy-dependencies" depends="init,setup-dependencies,check-dependencies"
unless="dependencies.present"
description="Download and copy test dependencies to the ${lib-ext} directory (only once)">
</target>
<!-- this target does not currently work on JDK 1.4 right now due to maven dependancy/repository issues -->
<target name="compile.test" depends="test.init, dist, init" description="Compiles the testing classes">
<javac debug="true" source="1.4" srcdir="${test.src}" destdir="${test.classes}">
<classpath>
<path refid="jarClasspath" />
<path refid="test-classpath" />
</classpath>
</javac>
</target>
<target name="test.junit" depends="compile, compile.test">
<property name="test.reports" value="${build}/testreports"/>
<mkdir dir="${test.reports}"/>
<junit printsummary="withOutAndErr" showoutput="true" haltonfailure="yes">
<classpath >
<path refid="default-classpath"/>
<pathelement location="${build.classes}"/>
<pathelement location="${test.classes}"/>
<path refid="test-classpath" />
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${test.classes}">
<include name="**/*TestCase.class"/>
<exclude name="**/*Suite.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test.dist" depends="compile.test,dist,init" description="Creates a war with the test files">
<copy file="${app-jar}" tofile="${webinf}/lib/${app-jar-name}" />
<copy file="${test.src}/org/jabsorb/test/Hello.java" tofile="${webapp}/Hello.java.txt" />
<copy file="${webapp}/hello.jsp" tofile="${webapp}/hello.jsp.txt" />
<copy file="${webapp}/hello.js" tofile="${webapp}/hello.js.txt" />
<copy file="${test.src}/org/jabsorb/test/Test.java" tofile="${webapp}/Test.java.txt" />
<copy file="${webapp}/test.jsp" tofile="${webapp}/test.jsp.txt" />
<copy file="${webapp}/test.js" tofile="${webapp}/test.js.txt" />
<copy file="${webapp}/jsonrpc.js" tofile="${webapp}/jsonrpc.js.txt" />
<copy file="${webinf}/web.xml" tofile="${webinf}/web.xml.out" />
<copy todir="${test.lib}">
<fileset dir="./lib">
<include name="**/*.jar" />
</fileset>
</copy>
<!-- include Apache Derby .jar file used by the ext/project metrics demo -->
<copy todir="${test.lib}">
<fileset dir="./${lib-ext}">
<include name="**/derby*.jar" />
</fileset>
</copy>
<!-- build the embedded apache derby database for the ext/projectmetrics demo -->
<java classname="org.jabsorb.ext.ProjectMetricsDatabase"
fork="true" failonerror="true">
<!-- path to files to load into DB -->
<arg value="${test.rsrc}/projectmetrics"/>
<classpath >
<path refid="default-classpath"/>
<pathelement location="${build.classes}"/>
<pathelement location="${test.classes}"/>
<path refid="test-classpath" />
</classpath>
</java>
<jar destfile="${test.lib}/rsrc.jar" basedir="${test.rsrc}" excludes="*~" />
<war destfile="${app-war}" basedir="${webapp}" excludes="**/*~,WEB-INF/web.xml*" webxml="${webapp}/WEB-INF/web.xml" />
</target>
<target name="docs" depends="init" description="Creates the javadoc api documentation">
<echo message="Making docs to ${webapp}/docs" />
<javadoc source="1.4" sourcepath="${src}"
destdir="${webapp}/docs"
public="true"
nodeprecated="true"
windowtitle="${app} ${version} API"
Header="<b><a href="http://jabsorb.org">${app} ${version}</a></b>">
<classpath>
<path refid="default-classpath" />
<pathelement path="${app-jar}" />
</classpath>
<package name="org.jabsorb.*" />
<package name="org.json.*" />
<!-- note that the jdk source code is referenced here so that javadoc will be generated from
interface class methods when none is specified in the implementation -->
<sourcepath path="/j2sdk1.4.2_13/src"/>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
<link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
<link href="http://www.slf4j.org/api/"/>
<!-- link href="http://java.sun.com/j2se/1.4.2/docs/api/" / -->
<!-- link href="http://java.sun.com/products/servlet/2.2/javadoc/" / -->
<doctitle><![CDATA[<h1>${app} ${version} API Documentation</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2007 The jabsorb team.</i>]]></bottom>
</javadoc>
</target>
<target name="installpath.check" depends="init" description="Checks that the webapp installpath is present">
<available file="${installpath}" type="dir" property="installpath.present"/>
<fail message="Please set installpath in build.properties to your web container's webapp directory" unless="installpath.present"/>
</target>
<target name="install" depends="test.dist, installpath.check, init" description="Installs the war to the webapp container directory">
<copy file="${app-war}" todir="${installpath}" />
</target>
<target name="uninstall" depends="init, installpath.check" description="Uninstalls the war from the webapp container directory">
<delete file="${installpath}/${app-war}" />
<delete dir="${installpath}/${app-prefix}/" />
</target>
<target name="clean" depends="init,cleanrelease,release-prep-clean" description="Cleans all files produced by ant">
<delete file="${app-war}" />
<delete file="${app-jar}" />
<delete file="${webapp}/WEB-INF/web.xml.out" />
<delete file="${webapp}/WEB-INF/web.xml.generated" />
<delete file="${webapp}/Test.java.txt" />
<delete file="${webapp}/test.jsp.txt" />
<delete file="${webapp}/test.js.txt" />
<delete file="${webapp}/Hello.java.txt" />
<delete file="${webapp}/hello.jsp.txt" />
<delete file="${webapp}/hello.js.txt" />
<delete file="${webapp}/jsonrpc.js.txt" />
<delete file="${webapp}/jsonrpc.js.gz" />
<delete file="${webapp}/jsonrpc-min.js" />
<delete file="${webapp}/jsonrpc-min.js.gz" />
<delete>
<fileset dir="." defaultexcludes="no">
<include name="**/*~" />
</fileset>
</delete>
<delete includeEmptyDirs="true" quiet="false" failonerror="false">
<fileset dir="${build}" />
<fileset dir="${webapp}/docs" />
<fileset dir="${test.lib}" />
<fileset dir="${test.classes}" />
<fileset dir="${lib-ext}" />
</delete>
<echo message="Done with clean!" />
</target>
<!-- targets to make building of release distribution files easier -->
<!-- like clean, but only deletes files not essential for a release bundle -->
<target name="release-prep-clean" depends="init" description="Cleans all files (not needed in a release) produced by ant">
<!--
<delete file="${app-war}" />
<delete file="${app-jar}" />
-->
<delete file="${webapp}/WEB-INF/web.xml.out" />
<delete file="${webapp}/WEB-INF/web.xml.generated" />
<delete file="${webapp}/Test.java.txt" />
<delete file="${webapp}/test.jsp.txt" />
<delete file="${webapp}/test.js.txt" />
<delete file="${webapp}/Hello.java.txt" />
<delete file="${webapp}/hello.jsp.txt" />
<delete file="${webapp}/hello.js.txt" />
<delete file="${webapp}/jsonrpc.js.txt" />
<!--
<delete file="${webapp}/jsonrpc.js.gz" />
<delete file="${webapp}/jsonrpc-min.js" />
<delete file="${webapp}/jsonrpc-min.js.gz" />
-->
<delete>
<fileset dir="." defaultexcludes="no">
<include name="**/*~" />
</fileset>
</delete>
<delete includeEmptyDirs="true" quiet="false" failonerror="false">
<fileset dir="${build}" />
<!-- <fileset dir="${webapp}/docs" /> -->
<fileset dir="${test.lib}" />
<fileset dir="${test.classes}" />
<fileset dir="${lib-ext}" />
</delete>
<echo message="Done with release-prep-clean!" />
</target>
<!-- create minified and gzipped versions of jsonrpc.js -->
<target name="compress-web-content" depends="init">
<!-- create .gz versions - some web/app servers (such as jetty) can
automatically scan for gzipped static content with
a .gz extensions -->
<gzip destfile="${webapp}/jsonrpc.js.gz" src="${webapp}/jsonrpc.js"/>
<gzip destfile="${webapp}/jsonrpc-min.js.gz" src="${webapp}/jsonrpc-min.js"/>
</target>
<target name="cleanrelease" depends="init" description="clean up release build files">
<delete file="${release}/${app-prefix}-src.zip"/>
<delete file="${release}/${app-prefix}-src.tar.gz"/>
<delete file="${release}/${app-prefix}-full.zip"/>
<delete file="${release}/${app-prefix}-full.tar.gz"/>
<delete file="${release}/${app-prefix}-minimal.zip"/>
<delete file="${release}/${app-prefix}-minimal.tar.gz"/>
<delete file="${release}/${app-prefix}-javadoc.zip"/>
<delete file="${release}/${app-prefix}-javadoc.tar.gz"/>
</target>
<target name="release" depends="init,cleanrelease,clean,release-src,docs,dist,test.dist,release-prep-clean"
description="make complete release distributions for unix and windows">
<!-- build FULL release which contains the completely built javadoc, war and .jar
along with the source code -->
<zip destfile="${release}/${app-prefix}-full.zip">
<zipfileset dir="." prefix="${app-prefix}"
excludes="*.zip,*.tar.gz,*.iml,*.ipr,*.iws,**/.svn/**"/>
</zip>
<tar destfile="${release}/${app-prefix}-full.tar">
<tarfileset dir="." prefix="${app-prefix}"
excludes="*.zip,*.tar.gz,*.iml,*.ipr,*.iws,**/.svn/**"/>
</tar>
<gzip destfile="${release}/${app-prefix}-full.tar.gz" src="${release}/${app-prefix}-full.tar"/>
<delete file="${release}/${app-prefix}-full.tar"/>
<!-- build the minimal release which just has the .jar and the .js needed -->
<echo>${app-jar}</echo>
<zip destfile="${release}/${app-prefix}-minimal.zip">
<zipfileset dir="${build}" prefix="${app-prefix}">
<include name="${app-jar-name}"/>
</zipfileset>
<zipfileset dir="${webapp}" prefix="${app-prefix}">
<include name="jsonrpc*.js*"/>
<exclude name="jsonrpc.js.txt" />
</zipfileset>
</zip>
<tar destfile="${release}/${app-prefix}-minimal.tar">
<tarfileset dir="${build}" prefix="${app-prefix}">
<include name="${app-jar-name}"/>
</tarfileset>
<tarfileset dir="${webapp}" prefix="${app-prefix}">
<include name="jsonrpc*.js*"/>
</tarfileset>
</tar>
<gzip destfile="${release}/${app-prefix}-minimal.tar.gz" src="${release}/${app-prefix}-minimal.tar"/>
<delete file="${release}/${app-prefix}-minimal.tar"/>
<!-- build a javadoc only download -->
<zip destfile="${release}/${app-prefix}-javadoc.zip">
<zipfileset dir="${webapp}/docs" prefix="javadoc/${app-prefix}"/>
</zip>
<tar destfile="${release}/${app-prefix}-javadoc.tar">
<tarfileset dir="${webapp}/docs" prefix="javadoc/${app-prefix}"/>
</tar>
<gzip destfile="${release}/${app-prefix}-javadoc.tar.gz" src="${release}/${app-prefix}-javadoc.tar"/>
<delete file="${release}/${app-prefix}-javadoc.tar"/>
</target>
<!-- create src release -->
<target name="release-src">
<zip destfile="${release}/${app-prefix}-src.zip">
<zipfileset dir="." prefix="${app-prefix}"
excludes="${lib-ext}/*,*.zip,*.tar.gz,*.iml,*.ipr,*.iws,**/.svn/**"/>
</zip>
<tar destfile="${release}/${app-prefix}-src.tar">
<tarfileset dir="." prefix="${app-prefix}"
excludes="${lib-ext}/*,*.zip,*.tar.gz,*.iml,*.ipr,*.iws,**/.svn/**"/>
</tar>
<gzip destfile="${release}/${app-prefix}-src.tar.gz" src="${release}/${app-prefix}-src.tar"/>
<delete file="${release}/${app-prefix}-src.tar"/>
</target>
<target name="install-locally" depends="dist" description="Install artifacts into local repository">
</target>
<target name="run" depends="copy-dependencies,compile.test" description="Runs the jabsorb webapp using jetty">
<java classname="org.jabsorb.test.JabsorbTestServer"
fork="true"
failonerror="true"
>
<arg value="${port-number}"/>
<jvmarg value="-Djava.util.logging.config.file=testlogging.properties"/>
<classpath >
<path refid="jarClasspath" />
<path refid="test-classpath" />
<path refid="test-classpath" />
<pathelement location="${test.classes}"/>
</classpath>
</java>
</target>
</project>
|