blob: 609d314ed3566f93d66081ef0925712e6cf3f469 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<project name="samples.war/build.xml" default="main" basedir="../..">
<property file="${basedir}/build.properties"/>
<property name="samples.war" value="${basedir}/apps/samples"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="src.dir" value="${samples.war}/WEB-INF/src"/>
<property name="classes.dir" value="${samples.war}/WEB-INF/classes"/>
<property name="context.root" value="samples" />
<path id="classpath">
<fileset dir="${samples.war}/WEB-INF/lib" includes="**/*.jar"/>
<pathelement location="${servlet.jar}"/>
<pathelement location="${jms.jar}"/>
</path>
<target name="main" depends="clean,samples"/>
<target name="samples" depends="prepare,copy-resources,compile"/>
<target name="prepare">
<mkdir dir="${samples.war}/WEB-INF/lib"/>
<mkdir dir="${samples.war}/WEB-INF/classes"/>
</target>
<target name="copy-resources">
<fail unless="local.sdk.lib.dir" message="must specify local.sdk.lib.dir in server/build.properties"/>
<fail unless="local.sdk.frameworks.dir" message="must specify local.sdk.frameworks.dir in build.properties"/>
<!-- copy to the lib directory -->
<copy todir="${samples.war}/WEB-INF/lib">
<fileset dir="${basedir}/lib" includes="${webapp.lib}" />
<fileset file="${hsqldb.jar}" />
</copy>
<!-- copy to sampledb directory -->
<copy todir="${basedir}/sampledb">
<fileset file="${hsqldb.jar}" />
</copy>
<!-- copy to the classes directory -->
<copy todir="${samples.war}/WEB-INF/classes">
<fileset dir="${samples.war}/WEB-INF/src">
<include name="**/*.xml"/>
</fileset>
<fileset dir="${basedir}/lib" includes="${webapp.classes}"/>
</copy>
<!-- create version.properties -->
<propertyfile file="${samples.war}/WEB-INF/flex/version.properties">
<entry key="build" value="${manifest.Implementation-Version}.${build.number}"/>
<entry key="minimumSDKVersion" value="${min.sdk.version}"/>
</propertyfile>
</target>
<target name="run-depend" if="src.depend">
<echo message="Removing class files that changed and dependent class files."/>
<depend cache="${classes.dir}" srcdir="${src.dir}" destdir="${classes.dir}"/>
</target>
<target name="compile" depends="prepare,run-depend,copy-resources" description="compile">
<javac source="1.4" debug="${src.debug}" destdir="${classes.dir}" srcdir="${src.dir}" classpathref="classpath"/>
</target>
<target name="compile-swfs">
<property name="samples.src.dir" value="${samples.war}/WEB-INF/flex-src" />
<ant antfile="${samples.src.dir}/dashboard/build.xml" />
<ant antfile="${samples.src.dir}/runtimeconfig-messaging/build.xml" />
<ant antfile="${samples.src.dir}/runtimeconfig-remoting/build.xml" />
<ant antfile="${samples.src.dir}/testdrive-101/build.xml" />
<ant antfile="${samples.src.dir}/testdrive-chat/build.xml" />
<ant antfile="${samples.src.dir}/testdrive-datapush/build.xml" />
<ant antfile="${samples.src.dir}/testdrive-httpservice/build.xml" />
<ant antfile="${samples.src.dir}/testdrive-remoteobject/build.xml" />
<ant antfile="${samples.src.dir}/testdrive-update/build.xml" />
<ant antfile="${samples.src.dir}/testdrive-webservice/build.xml" />
<ant antfile="${samples.src.dir}/traderdesktop/build.xml" />
<ant antfile="${samples.src.dir}/inventory/build.xml" />
</target>
<target name="package" depends="compile-swfs" description=" Creates distribution war file">
<mkdir dir="${dist.dir}"/>
<!--
we don't want flex source naked in WEB-INF as that would lead to overlapping eclipse projects
instead, zip it up and then put it in the war
-->
<zip destfile="${samples.war}/WEB-INF/flex-src/flex-src.zip"
comment="${manifest.Implementation-Title} ${manifest.Implementation-Version}.${label} Samples Flex Source Code">
<fileset dir="${samples.war}/WEB-INF/flex-src"
excludes="**/build*.xml,flex-src.zip"/>
</zip>
<war file="${dist.dir}/samples.war"
webxml="${samples.war}/WEB-INF/web.xml">
<manifest>
<attribute name="Sealed" value="${manifest.sealed}"/>
<attribute name="Implementation-Title" value="${manifest.Implementation-Title} - Samples Application"/>
<attribute name="Implementation-Version" value="${manifest.Implementation-Version}.${build.number}"/>
<attribute name="Implementation-Vendor" value="${manifest.Implementation-Vendor}"/>
</manifest>
<fileset dir="${samples.war}" >
<exclude name="**/**/build*.xml" />
<exclude name="**/generated/**/*"/>
<exclude name="WEB-INF/jsp/**/*" />
<exclude name="WEB-INF/sessions/**/*" />
<exclude name="WEB-INF/flex-src/**/*" />
<!-- This is included in the war task already -->
<exclude name="WEB-INF/web.xml" />
</fileset>
<fileset dir="${samples.war}" includes="WEB-INF/flex-src/flex-src.zip" />
</war>
<copy todir="${dist.dir}/sampledb">
<fileset dir="${basedir}/sampledb" />
<fileset file="${hsqldb.jar}" />
</copy>
</target>
<target name="clean" description="--> Removes jars and classes">
<delete quiet="true" includeEmptyDirs="true">
<fileset dir="${samples.war}/WEB-INF/lib" includes="${webapp.lib},${webtier.lib},${hsqldb.jar}"/>
<fileset dir="${samples.war}/WEB-INF/flex/jars" includes="**/*"/>
<fileset dir="${samples.war}/WEB-INF/flex/locale" includes="**/*"/>
<fileset dir="${samples.war}/WEB-INF/flex/libs" includes="**/*"/>
<fileset dir="${samples.war}/WEB-INF/flex" includes="version.properties"/>
<fileset dir="${classes.dir}" includes="**/*.class"/>
<fileset dir="${basedir}/sampledb" includes="${hsqldb.jar}"/>
<fileset file="${dist.dir}/samples.war"/>
<fileset file="${samples.war}/WEB-INF/flex-src/flex-src.zip"/>
<fileset dir="${samples.war}/sqladmin"/>
<fileset dir="${classes.dir}"/>
</delete>
</target>
<target name="generated-clean">
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${samples.war}" includes="**/generated/*" />
</delete>
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${samples.war}" includes="**/generated" />
</delete>
</target>
</project>