|
@@ -31,6 +31,8 @@ import org.apache.tools.ant.BuildException; |
|
|
import org.apache.tools.ant.DirectoryScanner; |
|
|
import org.apache.tools.ant.DirectoryScanner; |
|
|
import org.apache.tools.ant.Project; |
|
|
import org.apache.tools.ant.Project; |
|
|
import org.apache.tools.ant.taskdefs.MatchingTask; |
|
|
import org.apache.tools.ant.taskdefs.MatchingTask; |
|
|
|
|
|
import org.apache.tools.ant.taskdefs.rmic.DefaultRmicAdapter; |
|
|
|
|
|
import org.apache.tools.ant.taskdefs.rmic.WLRmic; |
|
|
import org.apache.tools.ant.types.Path; |
|
|
import org.apache.tools.ant.types.Path; |
|
|
import org.apache.tools.ant.types.Reference; |
|
|
import org.apache.tools.ant.types.Reference; |
|
|
import org.apache.tools.ant.util.depend.DependencyAnalyzer; |
|
|
import org.apache.tools.ant.util.depend.DependencyAnalyzer; |
|
@@ -95,6 +97,11 @@ public class Depend extends MatchingTask { |
|
|
*/ |
|
|
*/ |
|
|
private boolean closure = false; |
|
|
private boolean closure = false; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* flag to enable warning if we encounter RMI stubs |
|
|
|
|
|
*/ |
|
|
|
|
|
private boolean warnOnRmiStubs=true; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Flag which controls whether the reversed dependencies should be |
|
|
* Flag which controls whether the reversed dependencies should be |
|
|
* dumped to the log |
|
|
* dumped to the log |
|
@@ -154,6 +161,16 @@ public class Depend extends MatchingTask { |
|
|
createClasspath().setRefid(r); |
|
|
createClasspath().setRefid(r); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* flag to set to true if you want dependency issues with RMI |
|
|
|
|
|
* stubs to appear at warning level. |
|
|
|
|
|
* @param warnOnRmiStubs |
|
|
|
|
|
* @since Ant1.7 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void setWarnOnRmiStubs(boolean warnOnRmiStubs) { |
|
|
|
|
|
this.warnOnRmiStubs = warnOnRmiStubs; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Read the dependencies from cache file |
|
|
* Read the dependencies from cache file |
|
|
* |
|
|
* |
|
@@ -326,10 +343,8 @@ public class Depend extends MatchingTask { |
|
|
while (depEnum.hasMoreElements()) { |
|
|
while (depEnum.hasMoreElements()) { |
|
|
dependencyList.addElement(depEnum.nextElement()); |
|
|
dependencyList.addElement(depEnum.nextElement()); |
|
|
} |
|
|
} |
|
|
if (dependencyList != null) { |
|
|
|
|
|
cacheDirty = true; |
|
|
|
|
|
dependencyMap.put(info.className, dependencyList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
cacheDirty = true; |
|
|
|
|
|
dependencyMap.put(info.className, dependencyList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// This class depends on each class in the dependency list. For each |
|
|
// This class depends on each class in the dependency list. For each |
|
@@ -454,14 +469,7 @@ public class Depend extends MatchingTask { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (affectedClassInfo.sourceFile == null) { |
|
|
if (affectedClassInfo.sourceFile == null) { |
|
|
if (!affectedClassInfo.isUserWarned) { |
|
|
|
|
|
log("The class " + affectedClass + " in file " |
|
|
|
|
|
+ affectedClassInfo.absoluteFile.getPath() |
|
|
|
|
|
+ " is out of date due to " + className |
|
|
|
|
|
+ " but has not been deleted because its source file" |
|
|
|
|
|
+ " could not be determined", Project.MSG_WARN); |
|
|
|
|
|
affectedClassInfo.isUserWarned = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
warnOutOfDateButNotDeleted(affectedClassInfo, affectedClass, className); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -503,6 +511,54 @@ public class Depend extends MatchingTask { |
|
|
return count; |
|
|
return count; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* warn when a class is out of date, but not deleted as its source is unknown. |
|
|
|
|
|
* MSG_WARN is the normal level, but we downgrade to MSG_VERBOSE for RMI files |
|
|
|
|
|
* if {@link #warnOnRmiStubs is false} |
|
|
|
|
|
* @param affectedClassInfo info about the affectd class |
|
|
|
|
|
* @param affectedClass the name of the affected .class file |
|
|
|
|
|
* @param className the file that is triggering the out of dateness |
|
|
|
|
|
*/ |
|
|
|
|
|
private void warnOutOfDateButNotDeleted( |
|
|
|
|
|
ClassFileInfo affectedClassInfo, String affectedClass, |
|
|
|
|
|
String className) { |
|
|
|
|
|
if (affectedClassInfo.isUserWarned) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
int level = Project.MSG_WARN; |
|
|
|
|
|
if(!warnOnRmiStubs) { |
|
|
|
|
|
//downgrade warnings on RMI stublike classes, as they are generated |
|
|
|
|
|
//by rmic, so there is no need to tell the user that their source is |
|
|
|
|
|
//missing. |
|
|
|
|
|
if(isRmiStub(affectedClass, className)) { |
|
|
|
|
|
level=Project.MSG_VERBOSE; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
log("The class " + affectedClass + " in file " |
|
|
|
|
|
+ affectedClassInfo.absoluteFile.getPath() |
|
|
|
|
|
+ " is out of date due to " + className |
|
|
|
|
|
+ " but has not been deleted because its source file" |
|
|
|
|
|
+ " could not be determined", level); |
|
|
|
|
|
affectedClassInfo.isUserWarned = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* test for being an RMI stub |
|
|
|
|
|
* @param affectedClass |
|
|
|
|
|
* @param className |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private boolean isRmiStub(String affectedClass, String className) { |
|
|
|
|
|
return isStub(affectedClass,className, DefaultRmicAdapter.RMI_STUB_SUFFIX) |
|
|
|
|
|
|| isStub(affectedClass, className, DefaultRmicAdapter.RMI_SKEL_SUFFIX) |
|
|
|
|
|
|| isStub(affectedClass, className, WLRmic.RMI_STUB_SUFFIX) |
|
|
|
|
|
|| isStub(affectedClass, className, WLRmic.RMI_SKEL_SUFFIX); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isStub(String affectedClass,String baseClass,String suffix) { |
|
|
|
|
|
return (baseClass+suffix).equals(affectedClass); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Dump the dependency information loaded from the classes to the Ant log |
|
|
* Dump the dependency information loaded from the classes to the Ant log |
|
|
*/ |
|
|
*/ |
|
@@ -548,7 +604,7 @@ public class Depend extends MatchingTask { |
|
|
private void determineOutOfDateClasses() { |
|
|
private void determineOutOfDateClasses() { |
|
|
outOfDateClasses = new Hashtable(); |
|
|
outOfDateClasses = new Hashtable(); |
|
|
for (int i = 0; i < srcPathList.length; i++) { |
|
|
for (int i = 0; i < srcPathList.length; i++) { |
|
|
File srcDir = (File) getProject().resolveFile(srcPathList[i]); |
|
|
|
|
|
|
|
|
File srcDir = getProject().resolveFile(srcPathList[i]); |
|
|
if (srcDir.exists()) { |
|
|
if (srcDir.exists()) { |
|
|
DirectoryScanner ds = this.getDirectoryScanner(srcDir); |
|
|
DirectoryScanner ds = this.getDirectoryScanner(srcDir); |
|
|
String[] files = ds.getIncludedFiles(); |
|
|
String[] files = ds.getIncludedFiles(); |
|
|