Source code file content
mercurial-code-repository / build.xml
Size: 17549 bytes, 1 line
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
* Wembed, an embedded servlet container web application launcher.
* Copyright (C) 2008 Universidad de las Islas Baleares(UIB),
* Cra. Valldemossa, km 7.5
* 07071 Palma de Mallorca(Illes Balears)
* Espaņa
* This software is the confidential intellectual property of
* the UIB; it is copyrighted and licensed, not sold.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<project name="Wembed" default="deploy" basedir=".">
<!-- Load Version properties -->
<property file="doc/${ant.project.name}-version.properties" />
<!-- Global properties file -->
<property name="properties.file" value="app.properties" />
<property file="${properties.file}" />
<property file="app.default.properties" />
<!-- Source files directory -->
<property name="src" value="src" />
<property name="classes" value="${src}/classes" />
<property name="classes-jetty" value="${src}/jetty/classes" />
<property name="classes-tomcat" value="${src}/tomcat/classes" />
<property name="classes-resin" value="${src}/resin/classes" />
<!-- -->
<property name="src-test" value="test" />
<property name="classes-test" value="${src-test}/classes" />
<property name="www-test" value="${src-test}/web" />
<!-- Define library paths, where Ivy will put the appropriate jars for each phase -->
<property name="jar.lib.build-common" value="${ivy.lib.dir}/build-common" />
<property name="jar.lib.build-jetty" value="${ivy.lib.dir}/build-jetty" />
<property name="jar.lib.build-tomcat" value="${ivy.lib.dir}/build-tomcat" />
<property name="jar.lib.build-resin" value="${ivy.lib.dir}/build-resin" />
<property name="jar.lib.build-tst" value="${ivy.lib.dir}/build-tst" />
<property name="jar.lib.build-tst-www" value="${ivy.lib.dir}/build-tst-www" />
<property name="jar.lib.installer" value="${ivy.lib.dir}/installer" />
<!-- Define staggering area -->
<property name="project-deploy" value="${deploy}/${ant.project.name}" />
<property name="compiled-classes" value="${project-deploy}/build/main" />
<property name="compiled-classes-jetty"
value="${project-deploy}/build/jetty"
/>
<property name="compiled-classes-tomcat"
value="${project-deploy}/build/tomcat"
/>
<property name="compiled-classes-resin"
value="${project-deploy}/build/resin"
/>
<property name="compiled-classes-test" value="${project-deploy}/build/test" />
<!-- -->
<property name="deployed-binary-dir" value="${project-deploy}/bin" />
<property name="deployed-libs-main" value="${deployed-binary-dir}/lib" />
<property name="deployed-libs-jetty"
value="${deployed-binary-dir}/lib-jetty"
/>
<property name="deployed-libs-tomcat"
value="${deployed-binary-dir}/lib-tomcat"
/>
<property name="deployed-libs-resin"
value="${deployed-binary-dir}/lib-resin"
/>
<!-- -->
<property name="project-jar-file"
value="${deployed-binary-dir}/${ant.project.name}-server.jar"
/>
<!-- -->
<property name="deployed-demo-war" value="${project-deploy}/demo.war" />
<property name="deployed-demo-www" value="${project-deploy}/web" />
<property name="deployed-demo-www-lib"
value="${deployed-demo-www}/WEB-INF/lib"
/>
<!-- -->
<property name="release-dir" value="${project-deploy}/release" />
<property name="release-preffix" value="${release-dir}/wembed-" />
<property name="release-install-preffix"
value="${release-dir}/install-wembed-"
/>
<target name="-init" depends="resolve">
<echo message="Building ${ant.project.name} version: ${Version}" />
<tstamp>
<format property="TODAY" pattern="dd-MMM-yyyy" />
<format property="TODAY_SHORT" pattern="yyyyMMdd" />
</tstamp>
<mkdir dir="${project-deploy}" />
<mkdir dir="${deployed-binary-dir}" />
<mkdir dir="${deployed-libs-main}" />
<mkdir dir="${deployed-libs-jetty}" />
<mkdir dir="${deployed-libs-tomcat}" />
<mkdir dir="${deployed-libs-resin}" />
<mkdir dir="${compiled-classes}" />
<mkdir dir="${compiled-classes-jetty}" />
<mkdir dir="${compiled-classes-tomcat}" />
<mkdir dir="${compiled-classes-resin}" />
<mkdir dir="${compiled-classes-test}" />
<mkdir dir="${deployed-demo-www-lib}" />
<mkdir dir="${release-dir}" />
<!-- Define the standalone application (Server launcher) compile/runtime classpath -->
<path id="deploy-app.class.path">
<fileset dir="${jar.lib.build-common}">
<include name="*.jar" />
</fileset>
</path>
<!-- Define the standalone application (Server launcher) compile/runtime classpath -->
<path id="deploy-jetty.class.path">
<pathelement path="${compiled-classes}" />
<fileset dir="${jar.lib.build-jetty}">
<include name="*.jar" />
</fileset>
</path>
<!-- Define the standalone application (Server launcher) compile/runtime classpath -->
<path id="deploy-tomcat.class.path">
<pathelement path="${compiled-classes}" />
<fileset dir="${jar.lib.build-tomcat}">
<include name="*.jar" />
</fileset>
</path>
<!-- Define the standalone application (Server launcher) compile/runtime classpath -->
<path id="deploy-resin.class.path">
<pathelement path="${compiled-classes}" />
<fileset dir="${jar.lib.build-resin}">
<include name="*.jar" />
</fileset>
</path>
<!-- Define the test compile classpath -->
<path id="test-compile.class.path">
<pathelement path="${compiled-classes}" />
<fileset dir="${jar.lib.build-tst}">
<include name="*.jar" />
</fileset>
</path>
</target>
<target name="-compile" depends="-init">
<!-- Compile the application classes -->
<javac srcdir="${classes}"
destdir="${compiled-classes}"
deprecation="true"
debug="true"
>
<classpath>
<path refid="deploy-app.class.path" />
</classpath>
</javac>
<copy todir="${compiled-classes}">
<fileset dir="${classes}">
<include name="META-INF/**/*" />
</fileset>
</copy>
<!-- Compile the Jetty implementation classes -->
<javac srcdir="${classes-jetty}"
destdir="${compiled-classes-jetty}"
deprecation="true"
debug="true"
>
<classpath>
<path refid="deploy-jetty.class.path" />
</classpath>
</javac>
<copy todir="${compiled-classes-jetty}">
<fileset dir="${classes-jetty}">
<include name="META-INF/**/*" />
</fileset>
</copy>
<!-- Compile the Tomcat implementation classes -->
<javac srcdir="${classes-tomcat}"
destdir="${compiled-classes-tomcat}"
deprecation="true"
debug="true"
>
<classpath>
<path refid="deploy-tomcat.class.path" />
</classpath>
</javac>
<copy todir="${compiled-classes-tomcat}">
<fileset dir="${classes-tomcat}">
<include name="META-INF/**/*" />
</fileset>
</copy>
<copy todir="${deployed-binary-dir}">
<fileset dir="${src}">
<include name="tomcat/conf/web.xml" />
</fileset>
</copy>
<!-- Compile the Resin implementation classes -->
<javac srcdir="${classes-resin}"
destdir="${compiled-classes-resin}"
deprecation="true"
debug="true"
>
<classpath>
<path refid="deploy-resin.class.path" />
</classpath>
</javac>
<copy todir="${compiled-classes-resin}">
<fileset dir="${classes-resin}">
<include name="META-INF/**/*" />
</fileset>
</copy>
<!-- Compile the tests classes -->
<javac srcdir="${classes-test}"
destdir="${compiled-classes-test}"
deprecation="true"
debug="true"
>
<classpath>
<path refid="test-compile.class.path" />
</classpath>
</javac>
</target>
<target name="deploy" depends="-compile, -define-manifestclasspath">
<!-- Copy the test web application -->
<copy todir="${deployed-demo-www}">
<fileset dir="${www-test}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${deployed-demo-www-lib}">
<fileset dir="${jar.lib.build-tst-www}">
<include name="*.jar" />
</fileset>
</copy>
<!-- War the test web application, to test the .war deployment -->
<war destfile="${deployed-demo-war}" webxml="${deployed-demo-www}/WEB-INF/web.xml">
<fileset dir="${deployed-demo-www}">
<include name="**/*" />
</fileset>
</war>
<!-- Copy the resources for the server app -->
<copy todir="${compiled-classes}">
<fileset dir="${classes}">
<include name="*.gif" />
</fileset>
</copy>
<!-- Copy the property file for the server app -->
<copy todir="${deployed-binary-dir}">
<fileset dir="${classes}">
<include name="*.properties" />
</fileset>
</copy>
<!-- create the jar for the jetty implementation -->
<jar destfile="${jar.lib.build-jetty}/wembed-jetty-impl.jar"
basedir="${compiled-classes-jetty}"
includes="**/*.class, META-INF/**/*"
/>
<!-- Copy the libraries for the jetty implementation -->
<copy todir="${deployed-libs-jetty}">
<fileset dir="${jar.lib.build-jetty}">
<include name="*.jar" />
</fileset>
</copy>
<!-- create the jar for the tomcat implementation -->
<jar destfile="${jar.lib.build-tomcat}/wembed-tomcat-impl.jar"
basedir="${compiled-classes-tomcat}"
includes="**/*.class, META-INF/**/*"
/>
<!-- Copy the libraries for the tomcat implementation -->
<copy todir="${deployed-libs-tomcat}">
<fileset dir="${jar.lib.build-tomcat}">
<include name="*.jar" />
</fileset>
</copy>
<!-- create the jar for the resin implementation -->
<jar destfile="${jar.lib.build-resin}/wembed-resin-impl.jar"
basedir="${compiled-classes-resin}"
includes="**/*.class, META-INF/**/*"
/>
<!-- Copy the libraries for the resin implementation -->
<copy todir="${deployed-libs-resin}">
<fileset dir="${jar.lib.build-resin}">
<include name="*.jar" />
</fileset>
</copy>
<!-- Create the jar file that can be used to "auto-launch" the server app. -->
<jar destfile="${project-jar-file}"
basedir="${compiled-classes}"
includes="**/*.class, *.gif, META-INF/**/*"
>
<manifest>
<attribute name="Main-Class" value="org.wembed.ServerLauncher" />
<attribute name="Class-Path" value="${jar.classpath}" />
<attribute name="SplashScreen-Image" value="loader.gif" />
</manifest>
</jar>
</target>
<target name="-define-manifestclasspath" unless="jar.classpath">
<!-- Copy the libraries for the server app -->
<copy todir="${deployed-libs-main}">
<fileset dir="${jar.lib.build-common}">
<include name="*.jar" />
</fileset>
</copy>
<!-- Define the .jar classpath -->
<path id="jar.class.path">
<fileset dir="${deployed-libs-main}">
<include name="*.jar" />
</fileset>
</path>
<!-- Define the manifest -->
<manifestclasspath property="jar.classpath" jarfile="${project-jar-file}">
<classpath>
<path refid="jar.class.path" />
<pathelement location="${deployed-binary-dir}" />
</classpath>
</manifestclasspath>
</target>
<target name="test-war" description="Run all tests" depends="deploy, -decide-implementation">
<antcall target="test-container">
<param name="base" value="${deployed-demo-war}" />
</antcall>
</target>
<target name="release"
description="Creates a packaged version and installer from the current codebase"
depends="re-do"
>
<echo message="Packaging a release for ${ant.project.name} version: ${Version}"
/>
<!-- Ask for the name -->
<input defaultvalue="${Version}-${TODAY_SHORT}"
addproperty="version-suffix"
>
Enter suffix for current version (default is today's snapshot). Cancel to abort.
</input>
<zip destfile="${release-preffix}${version-suffix}.zip">
<zipfileset dir="${project-deploy}" includes="bin/**/*, web/**/*" excludes="bin/lib-resin/**/*" />
<zipfileset dir="." includes="doc/*.txt, doc/*.html"/>
<zipfileset dir="." includes="build/_tests.xml"/>
<zipfileset dir="." includes="README.txt"/>
</zip>
<taskdef name="izpack"
classpath="${jar.lib.installer}/izpack-standalone-compiler.jar"
classname="com.izforge.izpack.ant.IzPackTask"
/>
<izpack output="${release-install-preffix}${version-suffix}.jar"
basedir="${project-deploy}"
>
<config>
<![CDATA[
<installation version="1.0" xmlns:xi="http://www.izforge.com/izpack/include">
<info>
<appname>@{ant.project.name}</appname>
<appversion>@{version-suffix}</appversion>
<appsubpath>@{ant.project.name}</appsubpath>
<url>http://kenai.com/projects/wembed/</url>
<authors>
<author
name="Daniel Lopez"
email="greeneyed@dev.java.net" />
</authors>
<javaversion>1.6</javaversion>
</info>
<resources>
<res id="HTMLLicencePanel.licence" src="@{basedir}/install/Install-License.html" />
<res id="TargetPanel.dir.windows" src="@{basedir}/install/TargetPathWin.txt" />
<res id="userInputSpec.xml" src="@{basedir}/install/userInputSpec.xml" />
<res id="userInputLang.xml_eng" src="@{basedir}/install/userInputLang_eng.xml" />
<res id="userInputLang.xml_spa" src="@{basedir}/install/userInputLang_spa.xml" />
</resources>
<xinclude href="install/installation-script.xml" />
</installation>
]]></config>
</izpack>
</target>
<!-- =================================
CLEANING TASKS
================================= -->
<!-- =================================
Cleans the deployed application completely. Ivy installation is untouched
even though the directories Ivy created for this application are also cleaned
================================= -->
<target name="clean" description="Cleans everything">
<delete dir="${project-deploy}" />
</target>
<!-- =================================
Simply cleans the compiled artifacts and libraries, leaving the rest untouched, to start a clean compilation
================================= -->
<target name="clean-binaries"
description="Cleans compiled artifacts and libraries"
>
<delete dir="${compiled-classes}" />
<delete dir="${deployed-libs-main}" />
<delete dir="${deployed-libs-jetty}" />
<delete dir="${deployed-libs-tomcat}" />
<delete dir="${deployed-libs-resin}" />
<delete file="${project-jar-file}" />
<delete dir="${deployed-demo-www-lib}" />
<delete dir="${compiled-classes-test}" />
<antcall target="clean-ivy-libs" />
</target>
<!-- =================================
TASKS RELATED TO INSTALLING THE REQUIRED LIBRARIES THROUGH IVY
================================= -->
<property name="ivy.home" value="${ivy.home}" />
<property name="ivy.lib.dir" value="${ivy.lib.dir}" />
<property name="report-dir" value="${project-deploy}" />
<import file="build/_ivy.xml" />
<!-- ========================================
TASKS RELATED TO RUNNING THE JUnit TESTS
======================================= -->
<property name="wembed-home" value="${project-deploy}" />
<property name="classes-tests" value="${compiled-classes-test}" />
<property name="lib-tests" value="${jar.lib.build-tst}" />
<import file="build/_tests.xml" />
<!-- =================================
SHORTCUT TASKS TO CLEAN AND REDO
================================= -->
<target name="re-do"
description="Clean the binaries and recompile all the source code"
depends="clean, deploy"
/>
<target name="re-test"
description="Clean everything and run the HtmlUnit tests"
depends="re-do, test-container"
/>
</project>





