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
|
<project name="infocard-op" default="dist" basedir=".">
<property file="local.properties"/>
<property file="project.properties"/>
<target name="local_config" >
<condition property="local.config.properties"
value="../conf/${local.config}">
<and>
<isset property="local.config"/>
<not>
<equals arg1="" arg2="${local.config}"/>
</not>
</and>
</condition>
</target>
<target name="echo_local_config" depends="local_config" if="local.config.properties">
<echo message="Using local config: ${local.config.properties}" />
</target>
<target name="init" depends="local_config, echo_local_config">
<echo message="Building openid4java library..."/>
<ant antfile="build.xml" dir="${openid4java.dir}" target="jar" inheritall="false">
<property file="${openid4java.dir}/project.properties"/>
</ant>
<path id="classpath">
<fileset dir="lib" includes="*.jar"/>
<filelist dir="${openid4java.dir}/build">
<file name="openid4java.jar"/>
</filelist>
<filelist dir="${openid4java.lib.dir}">
<file name="commons-codec-1.3.jar"/>
<file name="httpclient-4.0.jar"/>
<file name="httpcore-4.0.1.jar"/>
<file name="commons-logging-1.03.jar"/>
<file name="nekohtml-1.9.7.jar"/>
<file name="xercesImpl-2.8.1.jar"/>
</filelist>
<filelist dir="${openid4java.lib.dir}/extra">
<file name="servlet-api-2.4.jar"/>
<file name="svnant-1.0.0.jar"/>
<file name="svnClientAdapter-1.0.0.jar"/>
<file name="svnjavahl-1.0.0.jar"/>
</filelist>
<fileset dir="${openid4java.lib.dir}/optional" includes="*jar"/>
<fileset dir="${openid4java.lib.dir}/xri" includes="*jar"/>
</path>
<path id="classpath.test">
<path refid="classpath"/>
<pathelement location="build/classes"/>
</path>
</target>
<target name="echo"
depends="init"
description="echo properties set by 'init'; useful for debugging">
<echoproperties/>
</target>
<target name="launch_browser" if="browser.cmd">
<fail unless=".html.file.to.browse"/>
<exec command="${browser.cmd} ${.html.file.to.browse}" spawn="yes"/>
</target>
<target name="compile" depends="init" description="Compile the source code.">
<mkdir dir="build/classes"/>
<javac
srcdir="src"
destdir="build/classes"
classpathref="classpath"
debug="${compile.debug}"
debuglevel="${compile.debuglevel}"
optimize="${compile.optimize}"
deprecation="${compile.deprecation}"
target="${compile.target}"
source="${compile.source}"
/>
</target>
<target name="compile_test" depends="compile">
<mkdir dir="build/test/classes"/>
<javac
srcdir="test/unit/src"
destdir="build/test/classes"
classpathref="classpath.test"
debug="${compile.debug}"
debuglevel="${compile.debuglevel}"
optimize="${compile.optimize}"
deprecation="${compile.deprecation}"
target="${compile.target}"
source="${compile.source}"
/>
<javac
srcdir="test/functional/src"
destdir="build/test/classes"
classpathref="classpath.test"
debug="${compile.debug}"
debuglevel="${compile.debuglevel}"
optimize="${compile.optimize}"
deprecation="${compile.deprecation}"
target="${compile.target}"
source="${compile.source}"
/>
</target>
<target name="jar" depends="compile"
description="Package the binary code into a jar file.">
<jar basedir="build/classes" destfile="build/${component.name}.jar"/>
</target>
<target name="war_folder" depends="jar">
<delete dir="build/war"/>
<mkdir dir="build/war"/>
<copy todir="build/war">
<fileset dir="www">
<exclude name="WEB-INF/web.xml"/>
</fileset>
</copy>
<copy todir="build/war/WEB-INF/lib">
<fileset dir="lib" includes="*.jar"/>
<fileset dir="build" includes="${component.name}.jar"/>
</copy>
<taskdef resource="svntask.properties" classpathref="classpath"/>
<svn javahl="false">
<status path="." lastchangedrevisionproperty="svn.rev.local"/>
</svn>
<echo>Last Changed Rev (local): : ${svn.rev.local}</echo>
<propertyfile file="build/war/VERSION">
<entry key="Version" value="${svn.rev.local}"/>
</propertyfile>
<svn javahl="false" >
<diff outFile="local.diff"/>
</svn>
<condition property="local.changes">
<length file="local.diff" when="greater" length="0"/>
</condition>
<delete file="local.diff"/>
<svn javahl="false">
<diff oldTargetRevision="${svn.rev.local}" newTargetRevision="HEAD" outFile="head.diff"/>
</svn>
<condition property="head.changes">
<length file="head.diff" when="greater" length="0"/>
</condition>
<delete file="head.diff"/>
</target>
<target name="copy_local_config" if="local.config.properties">
<copy tofile="build/war/WEB-INF/classes/config.properties"
overwrite="yes"
file="${local.config.properties}" />
</target>
<target name="war" depends="war_folder, copy_local_config"
description="Package the whole application as a war file.">
<war destfile="build/${component.name}.war" webxml="www/WEB-INF/web.xml"
duplicate="fail">
<fileset dir="build/war"/>
</war>
</target>
<target name="dist" depends="war"
description="Create distributable artifacts.">
<mkdir dir="dist"/>
<copy file="build/${component.name}.war" todir="dist"/>
</target>
<target name="release" depends="dist"
description="Copies WAR file to release folder.">
<fail if="local.config.properties"
message="Local configuration enabled; can't build release target."/>
<fail if="local.changes"
message="Local changes exist; can't build release target."/>
<fail if="head.changes"
message="Changes exist between BASE and HEAD; try 'svn up' or 'ant old_release'."/>
<copy tofile="../../webapps/op.war" file="dist/${component.name}.war" />
</target>
<target name="old_release" depends="dist"
description="Copies WAR file to release folder; no svn HEAD check.">
<fail if="local.config.properties"
message="Local configuration enabled; can't build release target."/>
<fail if="local.changes"
message="Local changes exist; can't build release target."/>
<copy tofile="../../webapps/op.war" file="dist/${component.name}.war" />
</target>
<target name="test" depends="compile_test" description="Run test code.">
<delete dir="build/test/xml"/>
<mkdir dir="build/test/xml"/>
<junit printsummary="on" fork="yes" dir="www"
failureproperty="test.junit.failed">
<classpath>
<path refid="classpath.test"/>
<path location="build/test/classes"/>
<path location="www/WEB-INF/classes"/>
</classpath>
<formatter type="xml"/>
<batchtest todir="build/test/xml">
<fileset dir="test/unit/src">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<delete dir="build/test/html"/>
<mkdir dir="build/test/html"/>
<junitreport todir="build/test/html">
<fileset dir="build/test/xml">
<include name="*.xml"/>
</fileset>
<report todir="build/test/html"/>
</junitreport>
<antcall target="launch_browser">
<param name=".html.file.to.browse" value="build/test/html/index.html"/>
</antcall>
<fail if="test.junit.failed" message="Unit Tests Failed"/>
</target>
<target name="javadoc" depends="compile"
description="Create JavaDoc documentation">
<mkdir dir="build/apidoc"/>
<javadoc
sourcepath="src"
destdir="build/apidoc"
classpathref="classpath"
packagenames="*"
access="private"
version="yes"
use="yes"
author="yes"
windowtitle="Infocard OpenID Provider"
doctitle="Infocard OpenID Provider"
source="${compile.source}">
<bottom>
<![CDATA[<i>Copyright © 2006-2008 Sxip Identity Corp. All Rights Reserved.</i>]]></bottom>
<link href="../common/build/apidoc" resolvelink="yes"/>
<link href="http://bldbsf01.sxip.com/javadoc/jdk/1.5/"/>
<link href="http://bldbsf01.sxip.com/javadoc/spring/2.0/"/>
<link href="http://bldbsf01.sxip.com/javadoc/jug/2.0.0/"/>
<link href="http://bldbsf01.sxip.com/javadoc/servlet/2.4/"/>
</javadoc>
<antcall target="launch_browser">
<param name=".html.file.to.browse" value="build/apidoc/index.html"/>
</antcall>
</target>
<target name="tomcat_set_home_from_env" if="env.CATALINA_HOME"
unless="tomcat.home.dir">
<property name="tomcat.home.dir" value="${env.CATALINA_HOME}"/>
</target>
<target name="check_tomcat" depends="tomcat_set_home_from_env">
<echo level="info">Tomcat home directory: ${tomcat.home.dir}</echo>
<fail unless="tomcat.home.dir"
message="Tomcat home directory not set! Set either the CATALINA_HOME environment variable or the tomcat.home.dir property"/>
<available file="${tomcat.home.dir}" type="dir"
property="tomcat.home.dir.exists"/>
<fail unless="tomcat.home.dir.exists"
message="The Tomcat home directory does not exist!"/>
<path id="classpath.tomcat">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="${tomcat.home.dir}/bin">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home.dir}/server/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home.dir}/common/lib">
<include name="*.jar"/>
</fileset>
</path>
</target>
<target name="define_tomcat" depends="check_tomcat">
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
classpathref="classpath.tomcat"/>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask"
classpathref="classpath.tomcat"/>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"
classpathref="classpath.tomcat"/>
<taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"
classpathref="classpath.tomcat"/>
<taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"
classpathref="classpath.tomcat"/>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask"
classpathref="classpath.tomcat"/>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask"
classpathref="classpath.tomcat"/>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"
classpathref="classpath.tomcat"/>
</target>
<target name="deploy" depends="define_tomcat, dist"
description="Deploy to local Tomcat">
<deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/op" war="dist/${component.name}.war"/>
</target>
<target name="reload" depends="define_tomcat"
description="Reload on local Tomcat">
<reload url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/op"/>
</target>
<target name="undeploy" depends="define_tomcat"
description="Undeploy from local Tomcat">
<undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/op"/>
</target>
<target name="redeploy" depends="undeploy, deploy"
description="Redeploy on local Tomcat."/>
<target name="list" depends="define_tomcat"
description="List installed Tomcat applications">
<list url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}"/>
</target>
<target name="clean" description="Remove all generated files">
<delete dir="build"/>
<delete dir="dist"/>
</target>
<target name="all" depends="clean, test, javadoc, dist"
description="Run all targets."/>
</project>
|