You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by lg...@apache.org on 2004/12/01 12:23:25 UTC
svn commit: r109325 - in cocoon/trunk: . tools/ide/eclipse tools/targets
Author: lgawron
Date: Wed Dec 1 03:23:24 2004
New Revision: 109325
URL: http://svn.apache.org/viewcvs?view=rev&rev=109325
Log:
port eclipse-customized-project target from 2.1.x
small other synchronizations (mainly whitespaces)
Added:
cocoon/trunk/tools/ide/eclipse/blocks-classpath.xsl
Modified:
cocoon/trunk/blocks.properties
cocoon/trunk/tools/ide/eclipse/make-classpath.xsl
cocoon/trunk/tools/targets/compile-build.xml
cocoon/trunk/tools/targets/ide-build.xml
cocoon/trunk/tools/targets/init-build.xml
cocoon/trunk/tools/targets/validate-build.xml
cocoon/trunk/tools/targets/webapp-build.xml
Modified: cocoon/trunk/blocks.properties
Url: http://svn.apache.org/viewcvs/cocoon/trunk/blocks.properties?view=diff&rev=109325&p1=cocoon/trunk/blocks.properties&r1=109324&p2=cocoon/trunk/blocks.properties&r2=109325
==============================================================================
--- cocoon/trunk/blocks.properties (original)
+++ cocoon/trunk/blocks.properties Wed Dec 1 03:23:24 2004
@@ -82,9 +82,9 @@
#-----[dependency]: "session-fw" depends on "xsp".
#-----[dependency]: "session-fw" is needed by "authentication-fw", "portal", "portal-fw".
#include.block.session-fw=false
-#include.block.web3=false
#-----[dependency]: "velocity" is needed by "petstore", "scratchpad".
#include.block.velocity=false
+#include.block.web3=false
#-----[dependency]: "xmldb" depends on "databases".
#include.block.xmldb=false
#-----[dependency]: "xsp" is needed by "chaperon", "databases", "eventcache", "forms", "lucene", "python", "scratchpad", "session-fw", "woody".
Added: cocoon/trunk/tools/ide/eclipse/blocks-classpath.xsl
Url: http://svn.apache.org/viewcvs/cocoon/trunk/tools/ide/eclipse/blocks-classpath.xsl?view=auto&rev=109325
==============================================================================
--- (empty file)
+++ cocoon/trunk/tools/ide/eclipse/blocks-classpath.xsl Wed Dec 1 03:23:24 2004
@@ -0,0 +1,236 @@
+<?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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <project default="generate-customized-eclipse-project" basedir="." name="blocks-eclipse">
+ <description>Autogenerated Ant build file that builds customized eclipse project for selected blocks.</description>
+ <xsl:apply-templates select="module"/>
+ </project>
+ </xsl:template>
+
+ <xsl:template match="module">
+ <xsl:variable name="cocoon-blocks" select="project[starts-with(@name, 'cocoon-block-')]"/>
+
+ <!-- Define wich blocks will be included -->
+ <target name="init">
+ <xsl:for-each select="$cocoon-blocks">
+ <xsl:variable name="block-name" select="substring-after(@name,'cocoon-block-')"/>
+ <condition property="include.block.{$block-name}">
+ <not>
+ <istrue value="${{exclude.block.{$block-name}}}"/>
+ </not>
+ </condition>
+ <condition property="internal.exclude.block.{$block-name}">
+ <isfalse value="${{include.block.{$block-name}}}"/>
+ </condition>
+ </xsl:for-each>
+
+ <!-- prepare the various paths that will form the project -->
+ <path id="srcs">
+ <!-- main source dir -->
+ <pathelement path="${{src.core}}"/>
+ <pathelement path="${{java}}"/>
+ <!-- samples source dir -->
+ <!-- FIXME: Load based on local.build.properties -->
+ <pathelement path="${{src}}/samples"/>
+ <!-- deprecated source dir -->
+ <!-- FIXME: Load based on local.build.properties -->
+ <pathelement path="${{src}}/deprecated/java"/>
+ <!-- test source dir -->
+ <pathelement path="${{src.core.test}}"/>
+ <pathelement path="${{src}}/test"/>
+ </path>
+ <!--core mocks -->
+ <path id="mockss">
+ <dirset dir="${{src}}">
+ <include name="mocks"/>
+ </dirset>
+ </path>
+
+ <path id="libs">
+ <!-- main libs -->
+ <fileset dir="${{lib}}">
+ <include name="core/*.jar"/>
+ <include name="local/*.jar"/>
+ <include name="endorsed/*.jar"/>
+ </fileset>
+ <!-- tools libs -->
+ <fileset dir="${{tools}}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <!-- convert paths to properties -->
+ <property name="srcs" refid="srcs"/>
+ <property name="mockss" refid="mockss"/>
+ <property name="libs" refid="libs"/>
+
+ <!-- start to expand properties in the template file -->
+ <copy file="${{tools}}/ide/eclipse/classpath-tmpl.xml"
+ tofile="${{build.temp}}/classpath-temp.xml"
+ filtering="yes"
+ overwrite="yes">
+ <filterset>
+ <filter token="SRC_DIRS" value="${{srcs}}${{path.separator}}@eclipse-src@"/>
+ <filter token="LIBS" value="${{libs}}${{path.separator}}@eclipse-libs@"/>
+ <filter token="MOCKS_DIRS" value="${{mockss}}${{path.separator}}@eclipse-mocks@"/>
+ <filter token="OUTPUT_DIR" value="${{ide.eclipse.outputdir}}"/>
+ </filterset>
+ </copy>
+ </target>
+
+ <target name="generate-customized-eclipse-project">
+ <xsl:attribute name="depends">
+ <xsl:text>init</xsl:text>
+ <xsl:for-each select="$cocoon-blocks">
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="concat(@name, '-eclipseclasspath')"/>
+ </xsl:for-each>
+ </xsl:attribute>
+
+ <!-- clean up src, libs and mocks -->
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="${{path.separator}}@eclipse-src@" value=""/>
+
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="${{path.separator}}@eclipse-libs@" value=""/>
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="@eclipse-libs@" value=""/>
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="${{path.separator}}@eclipse-mocks@" value=""/>
+
+ <!-- split the path in 'item' XML elements -->
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="${{path.separator}}" value="</item>
 <item>"/>
+ <!-- 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 -->
+ <echo>Generate classpath</echo>
+ <xslt in="${{build.temp}}/classpath-temp.xml" out="${{basedir}}/.classpath"
+ processor="trax"
+ style="${{tools}}/ide/eclipse/make-classpath.xsl">
+ <param name="exportlib" expression="${{ide.eclipse.export.libs}}"/>
+ </xslt>
+
+ <!-- copy the project file (expand version) -->
+ <copy file="${{tools}}/ide/eclipse/project"
+ tofile="${{basedir}}/.project"
+ overwrite="yes">
+ <filterset>
+ <filter token="VERSION" value="${{version}}"/>
+ </filterset>
+ </copy>
+ </target>
+
+ <xsl:apply-templates select="$cocoon-blocks"/>
+ </xsl:template>
+
+ <!-- For each project in gump.xml -->
+ <xsl:template match="project">
+ <xsl:variable name="block-name" select="substring-after(@name,'cocoon-block-')"/>
+ <xsl:variable name="cocoon-block-dependencies" select="depend[starts-with(@project,'cocoon-block-')]"/>
+
+ <target name="{@name}-eclipseclasspath" unless="internal.exclude.block.{$block-name}">
+ <!-- block src and test directory -->
+ <if>
+ <available file="${{blocks}}/{$block-name}/java" type="dir"/>
+ <then>
+ <path id="src-{$block-name}">
+ <dirset dir="${{blocks}}/{$block-name}">
+ <include name="java"/>
+ <include name="test"/>
+ </dirset>
+ </path>
+ <property name="src-{$block-name}" refid="src-{$block-name}"/>
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="@eclipse-src@" value="${{src-{$block-name}}}${{path.separator}}@eclipse-src@"/>
+ </then>
+ </if>
+ <!-- block mocks directory -->
+ <if>
+ <available file="${{blocks}}/{$block-name}/mocks" type="dir"/>
+ <then>
+ <path id="mocks-{$block-name}">
+ <dirset dir="${{blocks}}/{$block-name}">
+ <include name="**/mocks"/>
+ </dirset>
+ </path>
+ <property name="mocks-{$block-name}" refid="mocks-{$block-name}"/>
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="@eclipse-mocks@" value="${{mocks-{$block-name}}}${{path.separator}}@eclipse-mocks@"/>
+ </then>
+ </if>
+
+ <!-- block lib directory (deprecated) -->
+ <if>
+ <available file="${{blocks}}/{$block-name}/lib" type="dir"/>
+ <then>
+ <path id="lib-{$block-name}">
+ <fileset dir="${{blocks}}/{$block-name}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+ <property name="lib-{$block-name}" refid="lib-{$block-name}"/>
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="@eclipse-libs@" value="${{lib-{$block-name}}}${{path.separator}}@eclipse-libs@"/>
+ </then>
+ </if>
+ <!-- Add optional libraries used by this block -->
+ <xsl:if test="library[not(@bundle='false')]">
+ <xsl:for-each select="library[not(@bundle='false')]">
+ <if>
+ <not>
+ <istrue value="${{eclipse-optional-lib-{@name}}}"/>
+ </not>
+ <then>
+ <property name="eclipse-optional-lib-{@name}" value="true"/>
+ <path id="eclipse-optional-lib-{$block-name}-{@name}">
+ <fileset dir="${{lib.optional}}">
+ <include name="{@name}*.jar"/>
+ </fileset>
+ </path>
+ <property name="eclipse-optional-lib-{$block-name}-{@name}" refid="eclipse-optional-lib-{$block-name}-{@name}"/>
+ <!-- The new lib cannot be empty -->
+ <if>
+ <not>
+ <equals arg1="${{eclipse-optional-lib-{$block-name}-{@name}}}" arg2=""/>
+ </not>
+ <then>
+ <replace file="${{build.temp}}/classpath-temp.xml"
+ token="@eclipse-libs@" value="${{eclipse-optional-lib-{$block-name}-{@name}}}${{path.separator}}@eclipse-libs@"/>
+ </then>
+ </if>
+ </then>
+ </if>
+ </xsl:for-each>
+ </xsl:if>
+ </target>
+ </xsl:template>
+</xsl:stylesheet>
Modified: cocoon/trunk/tools/ide/eclipse/make-classpath.xsl
Url: http://svn.apache.org/viewcvs/cocoon/trunk/tools/ide/eclipse/make-classpath.xsl?view=diff&rev=109325&p1=cocoon/trunk/tools/ide/eclipse/make-classpath.xsl&r1=109324&p2=cocoon/trunk/tools/ide/eclipse/make-classpath.xsl&r2=109325
==============================================================================
--- cocoon/trunk/tools/ide/eclipse/make-classpath.xsl (original)
+++ cocoon/trunk/tools/ide/eclipse/make-classpath.xsl Wed Dec 1 03:23:24 2004
@@ -17,16 +17,16 @@
<!--
Build the Eclipse .classpath file from a list of path items
(see "eclipse-project" target in build.xml)
-
+
@author Sylvain Wallez
- @version CVS $Id: make-classpath.xsl,v 1.3 2004/03/08 06:07:15 antonio Exp $
+ @version CVS $Id$
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:param name="exportlib"/>
-
+
<xsl:strip-space elements="*"/>
<xsl:template match="/data">
@@ -38,7 +38,7 @@
<xsl:sort select="."/>
<classpathentry kind="src" path="{.}"/>
</xsl:for-each>
-
+
<!-- 2. libraries -->
<xsl:for-each select="libs/item">
<!-- alphabetical sorting, only file name -->
@@ -50,12 +50,15 @@
<xsl:sort select="concat(substring-after(substring-after(substring-after(substring-after(., '/'), '/'), '/'), '/'),
substring-after(substring-after(substring-after(., '/'), '/'), '/'),
substring-after(substring-after(., '/'), '/'))"/>
- <classpathentry exported="{$exportlib}" kind="lib" path="{.}"/>
+ <!-- Remove duplicated library entries (diferent blocks can refer the same lib -->
+ <xsl:if test="not(node()) or not(preceding-sibling::node()[.=string(current())])">
+ <classpathentry exported="{$exportlib}" kind="lib" path="{.}"/>
+ </xsl:if>
</xsl:for-each>
<!-- 3. JRE runtime -->
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
-
+
<!-- 4. output directory
Build in a separate dir since Eclipse is confused
by classes compiled externally by Sun's Javac -->
Modified: cocoon/trunk/tools/targets/compile-build.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/tools/targets/compile-build.xml?view=diff&rev=109325&p1=cocoon/trunk/tools/targets/compile-build.xml&r1=109324&p2=cocoon/trunk/tools/targets/compile-build.xml&r2=109325
==============================================================================
--- cocoon/trunk/tools/targets/compile-build.xml (original)
+++ cocoon/trunk/tools/targets/compile-build.xml Wed Dec 1 03:23:24 2004
@@ -251,9 +251,9 @@
</target>
<target name="call-block-target" depends="prepare">
- <ant antfile="${build.temp}/blocks-build.xml"
- inheritAll="true"
- inheritRefs="false"
+ <ant antfile="${build.temp}/blocks-build.xml"
+ inheritAll="true"
+ inheritRefs="false"
target="cocoon-block-${block.name}-${target.name}" />
</target>
</project>
Modified: cocoon/trunk/tools/targets/ide-build.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/tools/targets/ide-build.xml?view=diff&rev=109325&p1=cocoon/trunk/tools/targets/ide-build.xml&r1=109324&p2=cocoon/trunk/tools/targets/ide-build.xml&r2=109325
==============================================================================
--- cocoon/trunk/tools/targets/ide-build.xml (original)
+++ cocoon/trunk/tools/targets/ide-build.xml Wed Dec 1 03:23:24 2004
@@ -15,11 +15,24 @@
limitations under the License.
-->
<project name="ide">
-
+
<description>
IDE targets
</description>
+ <!-- Build the Eclipse customized project's files -->
+ <target name="eclipse-customized-project" depends="prepare" description="Generate the Eclipse customized project files (using local.block.properties)">
+ <echo message="Building Eclipse Customized Project Files"/>
+ <xslt in="${gump.descriptor}"
+ out="${build.temp}/blocks-eclipse.xml"
+ style="${tools}/ide/eclipse/blocks-classpath.xsl"/>
+
+ <ant antfile="${build.temp}/blocks-eclipse.xml"
+ inheritAll="true"
+ inheritRefs="false"
+ target="generate-customized-eclipse-project"/>
+ </target>
+
<!-- Generate the Emacs JDE project file -->
<target name="emacs-project" depends="prepare" description="Generate the Emacs project files">
<path id="jar.files">
@@ -73,7 +86,7 @@
<!-- main libs -->
<fileset dir="${lib}">
<include name="core/*.jar"/>
- <!-- Currently, we have no JVM dependent libraries
+ <!-- Currently, we have no JVM dependent libraries
<include name="core/jvm${target.vm}/*.jar"/>
-->
<include name="optional/*.jar"/>
@@ -87,7 +100,7 @@
<!-- tools libs -->
<fileset dir="${tools}/lib">
<include name="*.jar"/>
- </fileset>
+ </fileset>
</path>
<!-- convert paths to properties -->
@@ -148,7 +161,7 @@
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>
Modified: cocoon/trunk/tools/targets/init-build.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/tools/targets/init-build.xml?view=diff&rev=109325&p1=cocoon/trunk/tools/targets/init-build.xml&r1=109324&p2=cocoon/trunk/tools/targets/init-build.xml&r2=109325
==============================================================================
--- cocoon/trunk/tools/targets/init-build.xml (original)
+++ cocoon/trunk/tools/targets/init-build.xml Wed Dec 1 03:23:24 2004
@@ -105,7 +105,7 @@
<!-- Alias for the loglevel -->
<property name="loglevel" value="${build.webapp.loglevel}"/>
-
+
<!-- Set classpath -->
<path id="classpath">
<fileset dir="${lib.local}">
@@ -120,7 +120,7 @@
<fileset dir="${lib.core}">
<include name="*.jar"/>
</fileset>
- <!-- Currently, we have no JVM dependent libraries
+ <!-- Currently, we have no JVM dependent libraries
<fileset dir="${lib.core}/jvm${target.vm}">
<include name="*.jar"/>
</fileset>
@@ -135,7 +135,6 @@
</target>
<target name="init-tasks" depends="init">
-
<!-- Set classpath for building ant tasks -->
<path id="tasks.classpath">
<path refid="classpath"/>
@@ -162,7 +161,7 @@
classpath="${tools.tasks.dest}"/>
<!-- A task for sitemap components -->
- <taskdef name="sitemap-components"
+ <taskdef name="sitemap-components"
classname="SitemapTask"
classpathref="tasks.classpath"/>
Modified: cocoon/trunk/tools/targets/validate-build.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/tools/targets/validate-build.xml?view=diff&rev=109325&p1=cocoon/trunk/tools/targets/validate-build.xml&r1=109324&p2=cocoon/trunk/tools/targets/validate-build.xml&r2=109325
==============================================================================
--- cocoon/trunk/tools/targets/validate-build.xml (original)
+++ cocoon/trunk/tools/targets/validate-build.xml Wed Dec 1 03:23:24 2004
@@ -32,8 +32,8 @@
</path>
<property name="all.jars" refid="all.jars"/>
- <copy file="${tools.src}/jars.xml.tmpl"
- tofile="${build.temp}/current-jars.xml"
+ <copy file="${tools.src}/jars.xml.tmpl"
+ tofile="${build.temp}/current-jars.xml"
filtering="yes" overwrite="yes">
<filterset>
<filter token="JARS" value="${all.jars}"/>
@@ -42,28 +42,28 @@
<!-- split the path in 'jar' XML elements -->
<replace file="${build.temp}/current-jars.xml"
- token="${path.separator}"
+ token="${path.separator}"
value="</jar>
 <jar>"/>
<!-- relativize file names by removing the current directory -->
- <replace file="${build.temp}/current-jars.xml"
- token="${user}${file.separator}lib${file.separator}"
+ <replace file="${build.temp}/current-jars.xml"
+ token="${user}${file.separator}lib${file.separator}"
value=""/>
- <replace file="${build.temp}/current-jars.xml"
- token="${user}${file.separator}${blocks}${file.separator}"
+ <replace file="${build.temp}/current-jars.xml"
+ token="${user}${file.separator}${blocks}${file.separator}"
value=""/>
<!-- and incase that fails, remove the base directory -->
- <replace file="${build.temp}/current-jars.xml"
- token="${basedir}${file.separator}lib${file.separator}"
+ <replace file="${build.temp}/current-jars.xml"
+ token="${basedir}${file.separator}lib${file.separator}"
value=""/>
- <replace file="${build.temp}/current-jars.xml"
- token="${basedir}${file.separator}${blocks}${file.separator}"
+ <replace file="${build.temp}/current-jars.xml"
+ token="${basedir}${file.separator}${blocks}${file.separator}"
value=""/>
<!-- replace platform-dependent path separator by '/' -->
- <replace file="${build.temp}/current-jars.xml"
- token="${file.separator}"
+ <replace file="${build.temp}/current-jars.xml"
+ token="${file.separator}"
value="/"/>
<xslt in="${lib}/jars.xml" out="${build.temp}/jars.xml"
@@ -96,7 +96,7 @@
<echo message="Not conducting validation of core XML documentation."/>
<echo message="Use 'forrest validate-xdocs' instead."/>
-<!-- FIXME:
+<!-- FIXME:
<echo message="Validating all **/book.xml instances using RELAX NG ..."/>
<jing rngfile="${webapp}/WEB-INF/entities/book-v01.rng">
<fileset dir="${build.context}" includes="**/book.xml"/>
Modified: cocoon/trunk/tools/targets/webapp-build.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/tools/targets/webapp-build.xml?view=diff&rev=109325&p1=cocoon/trunk/tools/targets/webapp-build.xml&r1=109324&p2=cocoon/trunk/tools/targets/webapp-build.xml&r2=109325
==============================================================================
--- cocoon/trunk/tools/targets/webapp-build.xml (original)
+++ cocoon/trunk/tools/targets/webapp-build.xml Wed Dec 1 03:23:24 2004
@@ -28,7 +28,7 @@
<copy file="${webapp}/welcome.xslt" tofile="${build.webapp}/welcome.xslt" filtering="on"/>
<copy file="${webapp}/sitemap.xmap" tofile="${build.webapp}/sitemap.xmap"/>
- <!-- generate sitemap entries
+ <!-- generate sitemap entries
<sitemap-components sitemap="${build.webapp}/sitemap.xmap" source="${java}"/>
-->