| <?xml version="1.0"?> |
| <!-- |
| Copyright 2002-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. |
| --> |
| |
| <!-- |
| FORREST SITE BUILDER |
| |
| - The runtime part of Forrest |
| - Contains actions Forrest can peform on any Forrest-using project. |
| - This is typically called by forrest.bat or forrest |
| --> |
| |
| |
| <project default="site" basedir="." name="forrest"> |
| |
| <property name="version" value="0.6-dev"/> |
| |
| <property name="forrest.root-dir" location="${forrest.home}/../.."/> |
| |
| <property name="forrest.lib-dir" location="${forrest.root-dir}/lib"/> |
| <property name="forrest.core.lib-dir" location="${forrest.lib-dir}/core"/> |
| <property name="forrest.endorsed.lib-dir" location="${forrest.lib-dir}/endorsed"/> |
| <property name="forrest.optional.lib-dir" location="${forrest.lib-dir}/optional"/> |
| |
| <property name="forrest.tools-dir" location="${forrest.root-dir}/tools"/> |
| <property name="forrest.ant.tools-dir" location="${forrest.tools-dir}/ant"/> |
| <property name="forrest.ant.lib-dir" location="${forrest.ant.tools-dir}/lib"/> |
| <property name="forrest.jetty.lib-dir" location="${forrest.tools-dir}/jetty"/> |
| |
| <property name="forrest.build.lib-dir" location="${forrest.root-dir}/build"/> |
| |
| <import file="targets/validate.xml"/> |
| <import file="targets/webapp.xml"/> |
| <import file="targets/site.xml"/> |
| <import file="targets/skins.xml"/> |
| <import file="targets/context.xml"/> |
| |
| <description> |
| *=======================================================* |
| | Forrest Site Builder | |
| | 0.6-dev | |
| | $Date: 2004/02/14 12:26:18 $ | |
| *=======================================================* |
| |
| Call this through the 'forrest' command |
| </description> |
| |
| <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"> |
| <classpath> |
| <fileset dir="${forrest.core.lib-dir}" includes="jing*.jar" /> |
| </classpath> |
| </taskdef> |
| <taskdef resource="net/sf/antcontrib/antcontrib.properties"> |
| <classpath> |
| <fileset dir="${forrest.ant.lib-dir}" includes="ant-contrib-*.jar" /> |
| </classpath> |
| </taskdef> |
| |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ** COMMON SETTINGS ** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| |
| <!-- =============================================================== |
| Loads user defined settings for local deployment. |
| Steps back to defaults when they are not set. |
| Echo's the settings if requested. |
| =============================================================== --> |
| <target name="init-props"> |
| |
| <!-- setting defaults for parameters --> |
| <!-- people should use -D switch, or <ant><property>s to override these --> |
| |
| <property name="project.home" location="." /> |
| <property name="/" value="${file.separator}"/> |
| <echo message="Loading project specific properties from ${project.home}${/}forrest.properties" /> |
| <property file="${project.home}/forrest.properties" /> |
| <echo message="Loading user specific properties from ${user.home}${/}forrest.properties" /> |
| <property file="${user.home}/forrest.properties" /> |
| <echo message="Loading default properties from ${forrest.home}${/}context${/}default-forrest.properties" /> |
| <property file="${forrest.home}/context/default-forrest.properties" /> |
| |
| <!-- people should use forrest.properties to override following defaults --> |
| <property name="forrest.home" location="." /> |
| <property name="forrest.skins-dir" location="${forrest.home}/context/skins"/> |
| <property name="project.build-dir" location="${project.home}/build" /> |
| <property name="project.site-dir" location="${project.build-dir}/site" /> |
| <property name="project.war" location="${project.build-dir}/${project.name}.war" /> |
| <property name="project.webapp" location="${project.build-dir}/webapp" /> |
| <property name="project.index-dir" location="${project.webapp}/lucene-index" /> |
| |
| <property name="project.temp-dir" location="${project.build-dir}/tmp" /> |
| <property name="project.cocoon-work-dir" location="${project.temp-dir}/cocoon-work" /> |
| |
| <property name="project.brokenlinkfile" location="${project.build-dir}/brokenlinks.xml"/> |
| <property name="project.configfile" value="${forrest.home}/context/WEB-INF/cli.xconf" /> |
| <property name="project.logkitfile" value="${forrest.home}/context/WEB-INF/logkit.xconf" /> |
| <property name="project.logger" value="debug" /> |
| |
| <property name="status" location="${project.home}/${project.status}" /> |
| |
| <!-- FIXME: rename project.content-dir to project.documentation-dir --> |
| <property name="content-dir" location="${project.home}/${project.content-dir}" /> |
| <property name="raw-content-dir" location="${project.home}/${project.content-dir}/content" /> |
| <property name="sitemap-dir" location="${project.home}/${project.sitemap-dir}" /> |
| <property name="xdocs-dir" location="${project.home}/${project.xdocs-dir}" /> |
| <property name="catalog" location="${project.home}/${project.catalog}" /> |
| <property name="skins-dir" location="${project.home}/${project.skins-dir}" /> |
| <property name="skinconf" location="${project.home}/${project.skinconf}" /> |
| <property name="conf-dir" location="${project.home}/${project.conf-dir}" /> |
| <property name="lib-dir" location="${project.home}/${project.lib-dir}" /> |
| <property name="classes-dir" location="${project.home}/${project.classes-dir}" /> |
| <property name="translations-dir" location="${project.home}/${project.translations-dir}" /> |
| |
| <!-- checks for presence of tools.jar --> |
| <property name="tools.jar" location="${java.home}/../lib/tools.jar"/> |
| <available file="${tools.jar}" property="tools.jar.present"/> |
| |
| <!-- Define filters for project.* properties --> |
| <mkdir dir="${project.temp-dir}"/> |
| <property name="projfilters" value="${project.temp-dir}/projfilters.properties"/> |
| <echoproperties prefix="project" destfile="${projfilters}"/> |
| <filter filtersfile="${projfilters}"/> |
| <filter token="forrest.home" value="${forrest.home}"/> |
| <filter token="project.home" value="${project.home}"/> |
| |
| <!-- These are used by Forrest to resolve all other values --> |
| <property name="forrest.basic.jvmargs" value="-Dproject.home="${project.home}" -Dforrest.home="${forrest.home}""/> |
| <echo>forrest.basic.jvmargs:${forrest.basic.jvmargs}</echo> |
| |
| <!-- echo settings in -Dforrest.echo=true mode --> |
| <antcall target="echo-settings" /> |
| </target> |
| |
| <target name="examine-proj" depends="init-props"> |
| <available property="conf.present" file="${conf-dir}" type="dir"/> |
| <available property="raw-content.present" file="${raw-content-dir}" type="dir"/> |
| <available property="sitemap.present" file="${sitemap-dir}" type="dir"/> |
| <available property="xdocs.present" file="${xdocs-dir}" type="dir"/> |
| <available property="images.present" file="${images-dir}" type="dir"/> |
| <available property="grammars.present" file="${grammars-dir}" type="dir"/> |
| <available property="schema.present" file="${schema-dir}" type="dir"/> |
| <available property="stylesheets.present" file="${stylesheets-dir}" type="dir"/> |
| <available property="lib.present" file="${lib-dir}" type="dir"/> |
| <available property="classes.present" file="${classes-dir}" type="dir"/> |
| <available property="skins.present" file="${skins-dir}" type="dir"/> |
| <available property="skinconf.present" file="${skinconf}"/> |
| <available property="status.present" file="${status}"/> |
| </target> |
| |
| |
| |
| <!-- Load properties from user's skinconf.xml, if it is defined --> |
| <target name="load-project-props" depends="validation-props, prepare-context" if="skinconf.present"> |
| <xmlproperty file="${project.webapp}/skinconf.xml" collapseattributes="true"/> |
| </target> |
| |
| <!-- Load properties from Forrest's default skinconf.xml, unless a user's is defined --> |
| <target name="load-forrest-props" unless="skinconf.present"> |
| <xmlproperty file="${forrest.home}/context/skinconf.xml" collapseattributes="true" /> |
| <!-- Forrest skinconf should have been previously validated in buld.xml --> |
| </target> |
| |
| <!-- Define filters equating to elements in the skinconf.xml file. Skins can |
| include tokens corresponding to skinconf.xml elements, and have them replaced |
| at runtime.--> |
| <target name="init-skinprops" depends="load-project-props, load-forrest-props"> |
| <mkdir dir="${project.temp-dir}"/> |
| <property name="skinfilters" value="${project.temp-dir}/skinfilters.properties"/> |
| <echoproperties prefix="skinconfig" destfile="${skinfilters}"/> |
| <filter filtersfile="${skinfilters}"/> |
| </target> |
| |
| <!-- Sets up properties and filters --> |
| <target name="init" depends="init-props, init-skins"> |
| <available property="xml-forrest.jar.exists" file="${forrest.build.lib-dir}/xml-forrest.jar"/> |
| <fail unless="xml-forrest.jar.exists">You must build forrest before you can run it. In ${forrest.root-dir} run './build.sh' (linux) or 'build' (windows)</fail> |
| </target> |
| |
| <!-- =============================================================== |
| Echo's the settings if requested. [-Dforrest.echo=true] |
| =============================================================== --> |
| <target name="echo-settings" if="forrest.echo"> |
| <loadfile property="echo-settings-message" srcFile="${forrest.home}/var/echo-settings-message.txt"> |
| <filterchain><expandproperties/></filterchain> |
| </loadfile> |
| <echo>${echo-settings-message}</echo> |
| </target> |
| |
| |
| <!-- =============================================================== |
| Set class-path. |
| =============================================================== --> |
| <target name="prepare-classpath" depends="prepare-context, -prepare-classpath"/> |
| <target name="-prepare-classpath"> |
| <path id="forrest.cp"> |
| <pathelement path="${env.CLASSPATH}" /> |
| <pathelement location="${forrest.home}/context/WEB-INF/classes"/> |
| <pathelement location="${forrest.build.lib-dir}/xml-forrest.jar"/> |
| <fileset dir="${forrest.jetty.lib-dir}"> |
| <include name="*.jar"/> |
| <include name="*.JAR"/> |
| <include name="*.zip"/> |
| <include name="*.ZIP"/> |
| </fileset> |
| <fileset dir="${forrest.endorsed.lib-dir}"> |
| <include name="*.jar"/> |
| <include name="*.JAR"/> |
| <include name="*.zip"/> |
| <include name="*.ZIP"/> |
| </fileset> |
| <fileset dir="${forrest.core.lib-dir}"> |
| <include name="*.jar"/> |
| <include name="*.JAR"/> |
| <include name="*.zip"/> |
| <include name="*.ZIP"/> |
| </fileset> |
| <fileset dir="${forrest.optional.lib-dir}"> |
| <include name="*.jar"/> |
| <include name="*.JAR"/> |
| <include name="*.zip"/> |
| <include name="*.ZIP"/> |
| </fileset> |
| <pathelement location="${tools.jar}"/> |
| </path> |
| </target> |
| |
| |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ** SITE BUILDING ACTIONS ** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| |
| |
| <!-- =============================================================== |
| Cleans the site. (typically before generating the new version) |
| param: location to clean ${project.site-dir} |
| param: location to clean ${project.temp-dir} |
| param: location to clean ${project.webapp} |
| param: file to clean ${project.brokenlinkfile} |
| =============================================================== --> |
| <target name="clean" depends="init-props" description="Clean all directories and files generated during the build"> |
| <delete failonerror="false" dir="${project.site-dir}"/> |
| <delete failonerror="false" dir="${project.temp-dir}"/> |
| <delete failonerror="false" dir="${project.webapp}"/> |
| <delete failonerror="false" file="${project.brokenlinkfile}"/> |
| </target> |
| <target name="clean-site" depends="clean"/> |
| |
| |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ** PROJECT-TEMPLATE BUILDING ACTIONS ** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| |
| |
| |
| <!-- =============================================================== |
| Copies a template structure over to your project dir. |
| =============================================================== --> |
| <target name="seed" depends="ensure-nocontent" |
| description="Seeds a directory with a template project doc structure"> |
| <copy todir="${project.home}" overwrite="false"> |
| <fileset dir="${forrest.home}/fresh-site"/> |
| </copy> |
| <loadfile property="template-project-created-message" srcFile="${forrest.home}/var/template-project-created-message.txt"> |
| <filterchain><expandproperties/></filterchain> |
| </loadfile> |
| <echo>${template-project-created-message}</echo> |
| </target> |
| |
| |
| |
| |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ** LOCAL SERVER RUN ACTION ** --> |
| <!-- ** ** --> |
| <!-- ** ** --> |
| <!-- ***************************************************************** --> |
| <!-- ***************************************************************** --> |
| |
| |
| <target name="run" |
| depends="init, run_custom_jetty, run_default_jetty"/> |
| |
| <target name="run_custom_jetty" |
| if="custom_jetty_config" |
| description="Run Jetty with configuration file found in the project"> |
| <java classname="org.mortbay.jetty.Server" |
| dir="${project.webapp}" |
| fork="yes" |
| maxmemory="${forrest.maxmemory}" |
| failonerror="yes"> |
| <classpath> |
| <path refid="forrest.cp"/> |
| </classpath> |
| <jvmarg line="${forrest.jvmargs}"/> |
| <jvmarg line="${forrest.basic.jvmargs}"/> |
| <jvmarg |
| value="-Djava.endorsed.dirs=${java.endorsed.dirs}${path.separator}${forrest.endorsed.lib-dir}"/> |
| <arg line="${content-dir}/jettyconf.xml" /> |
| </java> |
| </target> |
| |
| <target name="run_default_jetty" |
| description="Run Jetty with configuration file found in Forrest"> |
| <java classname="org.mortbay.jetty.Server" |
| dir="${forrest.home}/context" |
| fork="yes" |
| maxmemory="${forrest.maxmemory}" |
| failonerror="yes"> |
| <classpath> |
| <path refid="forrest.cp"/> |
| </classpath> |
| <jvmarg line="${forrest.jvmargs}"/> |
| <jvmarg line="${forrest.basic.jvmargs}"/> |
| <jvmarg |
| value="-Djava.endorsed.dirs=${java.endorsed.dirs}${path.separator}${forrest.endorsed.lib-dir}"/> |
| <arg line="${forrest.home}/context/jettyconf.xml" /> |
| </java> |
| </target> |
| |
| |
| </project> |