cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r106334 - /cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/blocks-classpath.xsl /cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl /cocoon/branches/BRANCH_2_1_X/tools/targets/ide-build.xml
Date Tue, 23 Nov 2004 19:52:41 GMT
Author: antonio
Date: Tue Nov 23 11:52:40 2004
New Revision: 106334

Added:
   cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/blocks-classpath.xsl
Modified:
   cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl
   cocoon/branches/BRANCH_2_1_X/tools/targets/ide-build.xml
Log:
Add eclipse-customized-project (use [local.]blocks.properties)

Added: cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/blocks-classpath.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/blocks-classpath.xsl?view=auto&rev=106334
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/blocks-classpath.xsl	Tue Nov 23 11:52:40
2004
@@ -0,0 +1,234 @@
+<?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}}/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}}/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}}:@eclipse-src@"/>
+                    <filter token="LIBS" value="${{libs}}:@eclipse-libs@"/>
+                    <filter token="MOCKS_DIRS" value="${{mockss}}:@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=":@eclipse-src@" value=""/>
+
+            <replace file="${{build.temp}}/classpath-temp.xml"
+                    token=":@eclipse-libs@" value=""/>
+            <replace file="${{build.temp}}/classpath-temp.xml"
+                    token="@eclipse-libs@" value=""/>
+
+            <replace file="${{build.temp}}/classpath-temp.xml"
+                    token=":@eclipse-mocks@" value=""/>
+
+            <!-- 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 -->
+            <echo>Generate classpath</echo>
+            <xslt in="${{build.temp}}/classpath-temp.xml" out="${{basedir}}/.classpath"
+                    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}}}:@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}}}:@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}}}:@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}}}:@eclipse-libs@"/>
+                                </then>
+                            </if>
+                        </then>
+                    </if>
+                </xsl:for-each>
+            </xsl:if>
+        </target>
+    </xsl:template>
+</xsl:stylesheet>

Modified: cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl?view=diff&rev=106334&p1=cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl&r1=106333&p2=cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl&r2=106334
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/tools/ide/eclipse/make-classpath.xsl	Tue Nov 23 11:52:40
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/branches/BRANCH_2_1_X/tools/targets/ide-build.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/tools/targets/ide-build.xml?view=diff&rev=106334&p1=cocoon/branches/BRANCH_2_1_X/tools/targets/ide-build.xml&r1=106333&p2=cocoon/branches/BRANCH_2_1_X/tools/targets/ide-build.xml&r2=106334
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/tools/targets/ide-build.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/tools/targets/ide-build.xml	Tue Nov 23 11:52:40 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">
@@ -71,7 +84,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"/>
@@ -85,7 +98,7 @@
       <!-- tools libs -->
       <fileset dir="${tools}/lib">
         <include name="*.jar"/>
-      </fileset>      
+      </fileset>
     </path>
 
     <!-- convert paths to properties -->
@@ -122,7 +135,6 @@
 
     <!-- now build the .classpath file -->
     <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>
@@ -146,7 +158,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>

Mime
View raw message