<?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.
-->

<!-- $Id$ -->

<project name="lenya-export">

  <description>
    Export Targets
  </description>

<!-- Export the webapp -->
<target name="export" depends="webapp" description="Exports a publication to static HTML. As a parameter one should specify a publication, e.g. -Dpublication=default">
  <property name="publication" value=""/>
  <property name="publication.dir" value="${build.webapp}/lenya/pubs/${publication}"/>
  <property name="build.export" value="${build.dir}/export"/>
  <property name="build.work" value="${build.dir}/work"/>
    
  <property name="project.debuglevel" value="DEBUG"/>
      
  <!-- Copying source files from authoring to live -->
  <copy todir="${publication.dir}/content/live">
    <fileset dir="${publication.dir}/content/authoring"/>
  </copy>

  <java classname="org.apache.cocoon.Main"
    fork="true"
    maxmemory="128m"
    dir="."
    failonerror="true">
    
  <classpath>
    <pathelement location="${build.webapp}/WEB-INF/classes"/>
    <fileset dir="${build.webapp}/WEB-INF/lib" includes="*.jar"/>
    <fileset dir="tools/jetty/lib">
      <include name="servlet-*.jar"/>
    </fileset>
  </classpath>
  
    <jvmarg value="-Djava.endorsed.dirs=${build.webapp}/WEB-INF/lib/endorsed${path.separator}${java.endorsed.dirs}"/>
    <jvmarg value="-ea"/>
    
    <arg value="-c${build.webapp}"/>   <!-- input to the process -->
    <arg value="-d${build.export}"/>   <!-- output to be put -->
    <arg value="-w${build.work}"/>   <!-- temp dir to use for e.g. cache -->
    <arg value="-u${project.debuglevel}"/> <!-- threshold for log messages -->
    <arg value="-C${build.webapp}/WEB-INF/cocoon.xconf"/> <!-- cocoon.xconf file to use -->
    <arg value="-b${build.export}/brokenlinks.txt"/>  <!-- output list of broken links -->
    <arg value="-k${build.webapp}/WEB-INF/logkit.xconf"/>  <!-- logkit configuration -->
    <arg value="/${publication}/live/index.html"/>  <!-- starting page -->
    <arg value="-efalse"/> <!-- don't confirm extensions -->
    <arg value="-V" />  <!-- be verbose -->
  </java>
  
</target>
</project>
