You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/08/16 14:40:27 UTC

svn commit: rev 36469 - avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks

Author: niclas
Date: Mon Aug 16 05:40:26 2004
New Revision: 36469

Modified:
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java
Log:
Often one copies the build.xml from one project to a new one. This gave errors 'later' and not in the project being compiled. Now I have added checks that the project name is synchronized with the expectations from the index.xml

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/HomeTask.java	Mon Aug 16 05:40:26 2004
@@ -21,6 +21,8 @@
 import org.apache.avalon.tools.model.Info;
 import org.apache.avalon.tools.model.Home;
 import org.apache.avalon.tools.model.Magic;
+
+import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 
 import java.io.File;
@@ -42,11 +44,13 @@
         m_path = path;
     }
 
-    public void execute()
+    public void execute() 
+        throws BuildException
     {
         final Project project = getProject();
 
-        if( null != getProject().getReference( Home.KEY ) ) return;
+        if( null != getProject().getReference( Home.KEY ) ) 
+            return;
 
         Magic system = Magic.getSystem( project );        
         Home home = system.getHome( project, m_path );
@@ -67,6 +71,7 @@
         if( home.isaResourceKey( key ) )
         {
             final Definition def = home.getDefinition( getKey() );
+            verifyBaseDir( def );
             final Info info = def.getInfo();
             final String name = info.getName();
             final String group = info.getGroup();
@@ -105,5 +110,15 @@
     private String getIndexPath( Home home )
     {
         return home.getIndex().toString();
+    }
+    
+    private void verifyBaseDir( Definition def )
+        throws BuildException
+    {
+        String defBase = def.getBaseDir().getAbsolutePath();
+        String projBase = getProject().getBaseDir().getAbsolutePath();
+        if( defBase.equals( projBase ) )
+            return;
+        throw new BuildException( "The basedir in the Magic Index file, does not correspond with the current working directory. Most probably, you have the wrong project name in the build.xml file." );
     }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org