You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by th...@apache.org on 2006/08/17 13:07:11 UTC

svn commit: r432205 - in /lenya/trunk/tools/anttasks: build/classes/org/apache/lenya/cms/ant/GenerateModuleList.class src/org/apache/lenya/cms/ant/GenerateModuleList.java

Author: thorsten
Date: Thu Aug 17 04:07:11 2006
New Revision: 432205

URL: http://svn.apache.org/viewvc?rev=432205&view=rev
Log:
Enhancing the build process of modules. Checking now whether we have two modules with the same name. If so we will now throw an exception

Modified:
    lenya/trunk/tools/anttasks/build/classes/org/apache/lenya/cms/ant/GenerateModuleList.class
    lenya/trunk/tools/anttasks/src/org/apache/lenya/cms/ant/GenerateModuleList.java

Modified: lenya/trunk/tools/anttasks/build/classes/org/apache/lenya/cms/ant/GenerateModuleList.class
URL: http://svn.apache.org/viewvc/lenya/trunk/tools/anttasks/build/classes/org/apache/lenya/cms/ant/GenerateModuleList.class?rev=432205&r1=432204&r2=432205&view=diff
==============================================================================
Binary files - no diff available.

Modified: lenya/trunk/tools/anttasks/src/org/apache/lenya/cms/ant/GenerateModuleList.java
URL: http://svn.apache.org/viewvc/lenya/trunk/tools/anttasks/src/org/apache/lenya/cms/ant/GenerateModuleList.java?rev=432205&r1=432204&r2=432205&view=diff
==============================================================================
--- lenya/trunk/tools/anttasks/src/org/apache/lenya/cms/ant/GenerateModuleList.java (original)
+++ lenya/trunk/tools/anttasks/src/org/apache/lenya/cms/ant/GenerateModuleList.java Thu Aug 17 04:07:11 2006
@@ -20,6 +20,8 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.StringTokenizer;
 
@@ -80,9 +82,25 @@
                     "modules", null);
             File[] modules = (File[]) descriptors.toArray(new File[descriptors
                     .size()]);
+            HashMap keys = new HashMap();
             for (int i = 0; i < modules.length; i++) {
                 Element element = doc.createElementNS(NAMESPACE, "module");
-                element.setAttribute("src", modules[i].getAbsolutePath());
+                String absolutePath = modules[i].getAbsolutePath();
+                String key = absolutePath.substring(absolutePath
+                        .lastIndexOf("/") + 1);
+                if (keys.containsKey(key)) {
+                    String error = "\nThe module ["
+                            + key
+                            + "] is already registered with the path ["
+                            + keys.get(key)
+                            + "]!\n"
+                            + "You are trying to reuse the key for the path ["
+                            + absolutePath
+                            + "]\nPlease make sure you are using unique naming for modules.";
+                    throw new BuildException(error);
+                }
+                keys.put(key, absolutePath);
+                element.setAttribute("src", absolutePath);
                 doc.getDocumentElement().appendChild(element);
             }
             File file = new File(this.moduleFile.replace('/',



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org