cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r151334 - in cocoon/trunk/tools/external-project-build: ./ generic-build.xml
Date Fri, 04 Feb 2005 09:19:25 GMT
Author: reinhard
Date: Fri Feb  4 01:19:24 2005
New Revision: 151334

URL: http://svn.apache.org/viewcvs?view=rev&rev=151334
Log:
generic Ant task to build projects that are based on Cocoon
(documentation will follow)

Added:
    cocoon/trunk/tools/external-project-build/
    cocoon/trunk/tools/external-project-build/generic-build.xml

Added: cocoon/trunk/tools/external-project-build/generic-build.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/tools/external-project-build/generic-build.xml?view=auto&rev=151334
==============================================================================
--- cocoon/trunk/tools/external-project-build/generic-build.xml (added)
+++ cocoon/trunk/tools/external-project-build/generic-build.xml Fri Feb  4 01:19:24 2005
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  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.
+-->
+<project name="Cocoon build system" default="init">
+
+    <target name="setProperties">
+        <property name="server" value="localhost"/>
+        <property file="${server}.build.properties"/>
+        <property file="project.properties"/>
+
+        <property name="container.use" value="false"/>
+        <property name="classesToJAR" value="false"/>
+        <condition property="cond.container.use">
+          <istrue value="${container.use}"/>
+        </condition>
+        <condition property="cond.classesToJAR">
+          <istrue value="${classesToJAR}"/>
+        </condition>
+
+        <property name="rep.cocoon.dir" value="${rep}/cocoon/${cocoon.version}"/>
+        <property name="rep.cocoon.webapp.dir" value="${rep.cocoon.dir}/webapp"/>
+        <property name="rep.cocoon.lib.dir" value="${rep.cocoon.dir}/webapp/WEB-INF/lib"/>
+        <property name="rep.cocoon.classes.dir" value="${rep.cocoon.dir}/webapp/WEB-INF/classes"/>
+        <property name="rep.cocoon.db.dir" value="${rep.cocoon.webapp.dir}/WEB-INF/db"/>
+        <property name="rep.container.dir" value="${rep}/container/${container.version}"/>
+
+        <property name="build.dir" value="build"/>
+        <property name="build.webapp.war.dir" value="${build.dir}/${server}_webapp"/>
+        <property name="build.webapp.dir" value="${build.dir}/${server}_webapp/ROOT"/>
+        <property name="build.container.dir" value="${build.dir}/${server}_container"/>
+
+        <property name="local.webapp.dir" value="webapp"/>
+        <property name="local.src.dir" value="java"/>
+        <property name="local.lib.dir" value="lib"/>
+        <property name="local.conf.dir" value="conf"/>
+
+        <property name="compiler" value="modern"/>
+        <property name="compiler.debug" value="on"/>
+        <property name="compiler.optimize" value="on"/>
+        <property name="compiler.deprecation" value="off"/>
+        <property name="compiler.nowarn" value="on"/>
+        <property name="source.vm" value="1.3"/>
+        <property name="target.vm" value="1.3"/>
+    </target>
+
+    <target name="init" depends="beforeSetProperties, setProperties, afterSetProperties,
setFilters">
+        <!-- global filters -->
+        <filter token="filter.webapp.path" value="${webapp.path}"/>
+    </target>
+
+    <target name="webapp" depends="init, before-webapp" description="create the web application">
+        <mkdir dir="${build.webapp.dir}"/>
+
+        <!-- copy Cocoon -->
+        <copy todir="${build.webapp.dir}">
+            <fileset dir="${rep.cocoon.webapp.dir}">
+                <exclude name="sitemap*"/>
+                <exclude name="welcome*"/>
+                <!--include name="WEB-INF/**"/-->
+            </fileset>
+        </copy>
+
+        <!-- copy local resources -->
+        <copy todir="${build.webapp.dir}" filtering="off">
+            <fileset dir="${local.webapp.dir}">
+                <exclude name="sitemap.xmap"/>
+            </fileset>
+        </copy>
+
+        <copy todir="${build.webapp.dir}" filtering="on">
+            <fileset dir="${local.webapp.dir}">
+                <include name="sitemap.xmap"/>
+            </fileset>
+        </copy>
+
+        <!-- customize Cocoon -->
+        <copy todir="${build.webapp.dir}/WEB-INF/xconf" filtering="on" overwrite="true">
+            <fileset dir="${local.conf.dir}">
+                <include name="*.xconf"/>
+            </fileset>
+        </copy>
+
+        <!-- add own Java classes -->
+        <antcall target="compile"/>
+        <antcall target="classesToJAR"/>
+
+        <!-- copy local libraries -->
+        <copy todir="${build.webapp.dir}/WEB-INF/lib" filtering="off">
+            <fileset dir="${local.lib.dir}"/>
+        </copy>
+
+        <antcall  target="after-webapp"/>
+
+    </target>
+
+    <target name="classesToJAR" if="cond.classesToJAR">
+        <zip destfile="${build.webapp.dir}/WEB-INF/lib/_project.jar">
+            <fileset dir="${build.webapp.dir}/WEB-INF/classes"/>
+        </zip>
+        <delete dir="${build.webapp.dir}/WEB-INF/classes"/>
+    </target>
+
+    <target name="war" depends="webapp" description="create a web archive (WAR)">
+        <zip destfile="${build.webapp.war.dir}/ROOT.war">
+            <fileset dir="${build.webapp.dir}"/>
+        </zip>
+    </target>
+
+    <target name="container" depends="init" if="cond.container.use" description="screate
a container (uses the property ">
+        <ant antfile="${rep.container.dir}/container-build.xml"
+            target="create-${container.version}" inheritall="true"/>
+    </target>
+
+    <target name="run" depends="init, before-run" description="run the container (only
works on windows)">
+        <!-- TODO support *nix here -->
+        <property file="${rep.container.dir}/build-conf/server.properties"/>
+        <exec executable="${build.container.dir}/${server.start.win}" spawn="true">
+          <env key="CATALINA_HOME" value="${build.container.dir}"/>
+          <arg value="start"/>
+        </exec>
+        <antcall target="after-run"/>
+    </target>
+
+    <target name="stop" depends="init, before-stop" description="run the container (only
works on windows)">
+        <!-- TODO support *nix here -->
+        <property file="${rep.container.dir}/build-conf/server.properties"/>
+        <exec executable="${build.container.dir}/${server.stop.win}" spawn="true">
+          <env key="CATALINA_HOME" value="${build.container.dir}"/>
+          <arg value="start"/>
+        </exec>
+        <antcall target="after-stop"/>
+    </target>
+
+    <target description="Compile" name="compile" depends="init, before-compile">
+        <!-- TODO support more than one directory with Java classes -->
+        <path id="classpath">
+            <fileset dir="${rep.cocoon.lib.dir}">
+                <include name="*.jar" />
+            </fileset>
+            <fileset dir="${local.lib.dir}">
+                <include name="*.jar" />
+            </fileset>
+            <dirset dir="${rep.cocoon.classes.dir}" />
+        </path>
+        <mkdir dir="${build.webapp.dir}/WEB-INF/classes"/>
+        <copy todir="${build.webapp.dir}/WEB-INF/classes" filtering="on">
+            <fileset dir="${local.src.dir}">
+                <exclude name="**/*.java"/>
+            </fileset>
+        </copy>
+        <javac classpathref="classpath"
+               compiler="${compiler}"
+               nowarn="${compiler.nowarn}"
+               source="${source.vm}"
+               target="${target.vm}"
+               deprecation="${compiler.deprecation}"
+               optimize="${compiler.optimize}"
+               debug="${compiler.debug}"
+               destdir="${build.webapp.dir}/WEB-INF/classes"
+               srcdir="${local.src.dir}" />
+        <antcall target="after-compile"/>
+    </target>
+
+    <target name="clean" description="clean webapps and container" depends="init, before-clean">
+        <delete includeEmptyDirs="true">
+          <fileset dir="${build.dir}">
+              <include name="*_container/**"/>
+              <include name="*_webapp/**"/>
+          </fileset>
+        </delete>
+        <antcall target="after-clean"/>
+    </target>
+
+    <target name="clean-all" description="clean *everything* in the build dir" depends="init">
+        <delete dir="${build.dir}"/>
+    </target>
+
+    <!-- interception targets -->
+    <target name="beforeSetProperties"/>
+    <target name="afterSetProperties"/>
+    <target name="before-webapp"/>
+    <target name="after-webapp"/>
+    <target name="before-run"/>
+    <target name="after-run"/>
+    <target name="before-stop"/>
+    <target name="afeter-stop"/>
+    <target name="before-compile"/>
+    <target name="after-compile"/>
+    <target name="before-clean"/>
+    <target name="after-clean"/>
+
+    <!-- empty targets to be overriden -->
+    <target name="setFilters"/>
+    <target name="complete-ant"/>
+
+</project>



Mime
View raw message