You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ge...@apache.org on 2008/05/07 17:45:03 UTC

svn commit: r654154 - in /servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog: pom.xml src/main/resources/dedup.xsl src/main/resources/filter.xsl

Author: gertv
Date: Wed May  7 08:45:02 2008
New Revision: 654154

URL: http://svn.apache.org/viewvc?rev=654154&view=rev
Log:
SM-1277: Avoiding duplicate entries in archetype catalog

Added:
    servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/dedup.xsl
Modified:
    servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/pom.xml
    servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/filter.xsl

Modified: servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/pom.xml?rev=654154&r1=654153&r2=654154&view=diff
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/pom.xml (original)
+++ servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/pom.xml Wed May  7 08:45:02 2008
@@ -51,7 +51,8 @@
             <configuration>
               <tasks>
                 <mkdir dir="${project.build.directory}"/>
-                <mkdir dir="${project.build.directory}/temp"/>
+                <mkdir dir="${project.build.directory}/temp/allversions"/>
+                <mkdir dir="${project.build.directory}/temp/duplicates"/>
               </tasks>
             </configuration>
           </execution>
@@ -70,7 +71,7 @@
         </executions>
         <configuration>
           <repository>${settings.localRepository}/org/apache/servicemix/tooling</repository>
-          <catalogFile>${project.build.directory}/temp/archetype-catalog.xml</catalogFile>
+          <catalogFile>${project.build.directory}/temp/allversions/archetype-catalog.xml</catalogFile>
         </configuration>
       </plugin>
       <plugin>
@@ -79,18 +80,31 @@
         <version>1.0</version>
         <executions>
           <execution>
+            <id>filter-by-version</id>
             <phase>process-resources</phase>        
             <goals>
               <goal>transform</goal>
             </goals>
+            <configuration>
+              <xslFile>target/classes/filter.xsl</xslFile>
+              <srcDir>${project.build.directory}/temp/allversions</srcDir>
+              <destDir>${project.build.directory}/temp/duplicates</destDir>
+              <parameters><version>${servicemix-version}</version></parameters>
+            </configuration>
+          </execution>
+          <execution>
+            <id>dedup</id>
+            <phase>process-resources</phase>        
+            <goals>
+              <goal>transform</goal>
+            </goals>
+            <configuration>
+              <xslFile>target/classes/dedup.xsl</xslFile>
+              <srcDir>${project.build.directory}/temp/duplicates</srcDir>
+              <destDir>${project.build.directory}</destDir>
+            </configuration>
           </execution>
         </executions>
-        <configuration>
-          <xslFile>target/classes/filter.xsl</xslFile>
-          <srcDir>${project.build.directory}/temp</srcDir>
-          <destDir>${project.build.directory}</destDir>
-          <parameters><version>${servicemix-version}</version></parameters>
-        </configuration>
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>

Added: servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/dedup.xsl
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/dedup.xsl?rev=654154&view=auto
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/dedup.xsl (added)
+++ servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/dedup.xsl Wed May  7 08:45:02 2008
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <xsl:strip-space elements="*"/>
+  <xsl:param name="version"/>
+
+  <xsl:template match="archetype[artifactId = preceding-sibling::archetype/artifactId]">
+    <!-- drop any duplicate archetype definitions (e.g. with snapshot builds) -->
+  </xsl:template>
+
+  <xsl:template match="archetypes">
+     <archetypes>
+       <xsl:apply-templates select="archetype">
+         <xsl:sort select="artifactId"/>
+       </xsl:apply-templates>
+     </archetypes>
+  </xsl:template>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

Modified: servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/filter.xsl
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/filter.xsl?rev=654154&r1=654153&r2=654154&view=diff
==============================================================================
--- servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/filter.xsl (original)
+++ servicemix/smx3/trunk/archetypes/servicemix-archetype-catalog/src/main/resources/filter.xsl Wed May  7 08:45:02 2008
@@ -23,9 +23,8 @@
   <xsl:strip-space elements="*"/>
   <xsl:param name="version"/>
 
-  <xsl:template match="archetype[version != '@{servicemix-version}'] | archetype[concat(artifactId,version) = concat(preceding-sibling::archetype/artifactId,preceding-sibling::archetype/version)]">
+  <xsl:template match="archetype[version != '@{servicemix-version}']">
     <!-- simply drop archetypes for other versions of ServiceMix -->
-    <!-- and also drop any duplicate archetype definitions (e.g. with snapshot builds) -->
   </xsl:template>
 
   <xsl:template match="archetypes">