Author: kentam
Date: Fri Apr 29 12:04:01 2005
New Revision: 165335

URL: http://svn.apache.org/viewcvs?rev=165335&view=rev
Log:
BEEHIVE-413: build failure resolving shared flow from jpf with a control

So the root of the problem is that if there are sourcepaths rooted in subdirs 
of the srcdir, (for example, if the srcdir is <webapp-root> and 
<webapp-root>\WEB-INF\src is a sourcepath), then corresponding subdirs in the 
gendir need to be added to the sourcepath (ie, <gen-dir>\WEB-INF\src needs to 
be on the sourcepath).

This can get a little involved to cover comprehensively, because it really 
needs to loop over all srcdirs and all sourcepaths looking for overlap. I've 
added code to handle the simple cases for webapps (single srcdir, all 
sourcepaths are subdirs of the srcdir). 


Modified:
    
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java

Modified: 
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java?rev=165335&r1=165334&r2=165335&view=diff
==============================================================================
--- 
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java
 (original)
+++ 
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java
 Fri Apr 29 12:04:01 2005
@@ -112,7 +112,9 @@
         {
             Path srcPath = new Path(getProject()); 
             srcPath.setLocation(srcDir);
-            setSourcepath(srcPath);
+            Path sp = getSourcepath();
+            sp.append(srcPath);
+            setSourcepath(sp);
         }
 
         GlobPatternMapper m = new GlobPatternMapper();
@@ -175,13 +177,36 @@
         if (_srcExts.size() == 0)
             _srcExts.add("*.java");
 
-        // Save whether a user sourcepath was provided
+        // Save whether a user sourcepath was provided, and if so, the paths
+        String[] userSourcepaths = null;
         _hasSourcepath = getSourcepath() != null;
+        if ( _hasSourcepath )
+            userSourcepaths = getSourcepath().list();
 
         // The generation dir is always added to the source path for 
compilation
         Path genPath = new Path(getProject()); 
         genPath.setLocation(_genDir);
         setSourcepath(genPath);
+        
+        // If the user sourcepath specifies subdirs underneath the srcdir, 
then we need to add
+        // the corresponding subdirs under the gendir to the source path for 
compilation.
+        // For example, if the user sourcepath is 
"<webapp-root>;<webapp-root>\WEB-INF\src",
+        // then the sourcepath for compilation should include 
"<gen-dir>;<gen-dir>\WEB-INF\src".
+        if ( _hasSourcepath )
+        {
+            String genDirPath = _genDir.getAbsolutePath();
+            String srcDirPath = (getSrcdir().list())[0]; // TODO: handle 
multiple srcdirs
+            for ( String p: userSourcepaths )
+            {
+                if ( p.startsWith( srcDirPath ) && p.length() > 
srcDirPath.length() )
+                {
+                    File genDirElem = new File( _genDir, p.substring( 
srcDirPath.length()+1 ));
+                    Path gp = new Path(getProject());
+                    gp.setLocation( genDirElem );
+                    setSourcepath(gp);
+                }
+            }
+        }
 
         //
         // Select the executable (apt) and set fork = true


Reply via email to