blob: 8bc2ae9dbd57ec40316eff97552ea3eb8c96735a [file] [log] [blame]
<?xml version="1.0"?>
<!--
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="ide">
<description>
IDE targets
</description>
<!-- Build the Eclipse projects files -->
<target name="eclipse-project" depends="prepare" description="Generate the Eclipse project files">
<echo message="Building Eclipse Project Files"/>
<!-- prepare the various paths that will form the project -->
<path id="srcs">
<!-- main source dir -->
<pathelement path="${src.java.dir}"/>
<!-- test source dir -->
<pathelement path="${src.test.dir}"/>
</path>
<path id="libs">
<!-- Cocoon libs -->
<fileset dir="${cocoon.dir}/${lib.dir}">
<include name="core/*.jar"/>
<!-- Currently, we have no JVM dependent libraries
<include name="core/jvm${target.vm}/*.jar"/>
-->
<include name="optional/*.jar"/>
<include name="local/*.jar"/>
<include name="endorsed/*.jar"/>
</fileset>
<!-- Cocoon blocks lib -->
<fileset dir="${cocoon.dir}/src/blocks">
<include name="**/*.jar"/>
</fileset>
<!-- Cocoon tools libs -->
<fileset dir="${cocoon.dir}/tools/lib">
<include name="*.jar"/>
<exclude name="xalan*.jar"/>
<exclude name="xml-api*.jar"/>
<exclude name="xerces*.jar"/>
</fileset>
<!-- main libs -->
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="endorsed/*.jar"/>
</fileset>
</path>
<!-- convert paths to properties -->
<property name="srcs" refid="srcs"/>
<property name="libs" refid="libs"/>
<!-- expand properties in the template file -->
<copy file="src/resources/dev/eclipse/classpath-tmpl.xml"
tofile="${build.temp}/classpath-temp.xml"
filtering="yes"
overwrite="yes">
<filterset>
<filter token="SRC_DIRS" value="${srcs}"/>
<filter token="LIBS" value="${libs}"/>
<filter token="OUTPUT_DIR" value="${ide.eclipse.outputdir}"/>
</filterset>
</copy>
<!-- split the path in 'item' XML elements -->
<replace file="${build.temp}/classpath-temp.xml"
token="${path.separator}" value="&lt;/item&gt;&#xA; &lt;item&gt;"/>
<!-- relativize file names by removing the current directory -->
<replace file="${build.temp}/classpath-temp.xml"
token="${user}${file.separator}" value=""/>
<!-- and in case that fails, remove the base directory -->
<replace file="${build.temp}/classpath-temp.xml"
token="${basedir}${file.separator}" value=""/>
<!-- replace platform-dependent path separator by '/' -->
<replace file="${build.temp}/classpath-temp.xml"
token="${file.separator}" value="/"/>
<!-- now build the .classpath file -->
<xslt in="${build.temp}/classpath-temp.xml" out="${basedir}/.classpath"
processor="trax"
style="src/resources/dev/eclipse/make-classpath.xsl">
<param name="exportlib" expression="${ide.eclipse.export.libs}"/>
</xslt>
<!-- copy the project file (expand version) -->
<copy file="src/resources/dev/eclipse/project"
tofile="${basedir}/.project"
overwrite="yes">
</copy>
</target>
<!-- Prepares the webapp to make it directly usable with the eclipse project -->
<target name="eclipse-webapp-prepare" depends="eclipse-webapp-delete-jars, eclipse-webapp-restore-roles"
description="Prepares the webapp directory to make it usable within Eclipse"/>
<target name="eclipse-webapp-restore-roles" depends="prepare">
<copy file="${build.dest}/org/apache/cocoon/cocoon.roles"
tofile="${build.webapp}/WEB-INF/classes/org/apache/cocoon/cocoon.roles"
overwrite="yes"/>
</target>
<target name="eclipse-webapp-delete-jars" depends="prepare">
<!-- delete all jars and class files, they are already included in the project -->
<delete>
<fileset dir="${build.webapp}/WEB-INF">
<include name="lib/*.jar" />
<include name="classes/**/*.class" />
</fileset>
</delete>
</target>
</project>