conor 02/04/10 17:57:27
Modified: src/main/org/apache/tools/ant/taskdefs/optional/depend
Depend.java
Log:
Remove time based checks
Revision Changes Path
1.24 +39 -11
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
Index: Depend.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -w -u -r1.23 -r1.24
--- Depend.java 9 Apr 2002 13:20:08 -0000 1.23
+++ Depend.java 11 Apr 2002 00:57:26 -0000 1.24
@@ -80,13 +80,6 @@
*/
public class Depend extends MatchingTask {
/**
- * Tolerance on time checks to take into account inner to outer
- * class dependencies when the classes are written at slightly different
- * times
- */
- static private final int TIME_TOLERANCE = 100;
-
- /**
* A class (struct) user to manage information about a class
*
* @author Conor MacNeill
@@ -271,6 +264,40 @@
}
}
+ /**
+ * Get the classpath for dependency checking.
+ *
+ * This method removes the dest dirs if it is given from the dependency
classpath
+ */
+ private Path getCheckClassPath() {
+ if (dependClasspath == null) {
+ return null;
+ }
+
+ String[] destPathElements = destPath.list();
+ String[] classpathElements = dependClasspath.list();
+ String checkPath = "";
+ for (int i = 0; i < classpathElements.length; ++i) {
+ String element = classpathElements[i];
+ boolean inDestPath = false;
+ for (int j = 0; j < destPathElements.length && !inDestPath; ++j)
{
+ inDestPath = destPathElements[j].equals(element);
+ }
+ if (!inDestPath) {
+ if (checkPath.length() == 0) {
+ checkPath = element;
+ } else {
+ checkPath += ":" + element;
+ }
+ }
+ }
+
+ if (checkPath.length() == 0) {
+ return null;
+ }
+
+ return new Path(getProject(), checkPath);
+ }
/**
* Determine the dependencies between classes. Class dependencies are
@@ -366,11 +393,12 @@
}
classpathDependencies = null;
- if (dependClasspath != null) {
+ Path checkPath = getCheckClassPath();
+ if (checkPath != null) {
// now determine which jars each class depends upon
classpathDependencies = new Hashtable();
AntClassLoader loader
- = new AntClassLoader(getProject(), dependClasspath);
+ = new AntClassLoader(getProject(), checkPath);
Hashtable classpathFileCache = new Hashtable();
Object nullFileMarker = new Object();
@@ -591,7 +619,7 @@
for (Enumeration e2 = dependencies.elements();
e2.hasMoreElements(); ) {
File classpathFile = (File)e2.nextElement();
if (classpathFile.lastModified()
- > (info.absoluteFile.lastModified() +
TIME_TOLERANCE)) {
+ > info.absoluteFile.lastModified()) {
log("Class " + className +
" is out of date with respect to " +
classpathFile, Project.MSG_DEBUG);
outOfDateClasses.put(className, className);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>