|
|
@@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
* Copyright 2001-2002,2004 The Apache Software Foundation |
|
|
|
* Copyright 2001-2002, 2004-2005 The Apache Software Foundation |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
@@ -27,9 +27,7 @@ import org.apache.tools.ant.util.depend.DependencyAnalyzer; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* An interface used to describe the actions required by any type of |
|
|
|
* directory scanner. |
|
|
|
* |
|
|
|
* DirectoryScanner for finding class dependencies. |
|
|
|
*/ |
|
|
|
public class DependScanner extends DirectoryScanner { |
|
|
|
/** |
|
|
@@ -39,19 +37,19 @@ public class DependScanner extends DirectoryScanner { |
|
|
|
= "org.apache.tools.ant.util.depend.bcel.FullAnalyzer"; |
|
|
|
|
|
|
|
/** |
|
|
|
* The root classes to drive the search for dependent classes |
|
|
|
* The root classes to drive the search for dependent classes. |
|
|
|
*/ |
|
|
|
private Vector rootClasses; |
|
|
|
|
|
|
|
/** |
|
|
|
* The names of the classes to include in the fileset |
|
|
|
* The names of the classes to include in the fileset. |
|
|
|
*/ |
|
|
|
private Vector included; |
|
|
|
|
|
|
|
/** |
|
|
|
* The parent scanner which gives the basic set of files. Only files which |
|
|
|
* are in this set and which can be reached from a root class will end |
|
|
|
* up being included in the result set |
|
|
|
* up being included in the result set. |
|
|
|
*/ |
|
|
|
private DirectoryScanner parentScanner; |
|
|
|
|
|
|
@@ -69,16 +67,16 @@ public class DependScanner extends DirectoryScanner { |
|
|
|
/** |
|
|
|
* Sets the root classes to be used to drive the scan. |
|
|
|
* |
|
|
|
* @param rootClasses the rootClasses to be used for this scan |
|
|
|
* @param rootClasses the rootClasses to be used for this scan. |
|
|
|
*/ |
|
|
|
public void setRootClasses(Vector rootClasses) { |
|
|
|
this.rootClasses = rootClasses; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Get the names of the class files, baseClass depends on |
|
|
|
* Get the names of the class files on which baseClass depends. |
|
|
|
* |
|
|
|
* @return the names of the files |
|
|
|
* @return the names of the files. |
|
|
|
*/ |
|
|
|
public String[] getIncludedFiles() { |
|
|
|
int count = included.size(); |
|
|
@@ -98,9 +96,9 @@ public class DependScanner extends DirectoryScanner { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Scans the base directory for files that baseClass depends on |
|
|
|
* Scans the base directory for files on which baseClass depends. |
|
|
|
* |
|
|
|
* @exception IllegalStateException when basedir was set incorrecly |
|
|
|
* @exception IllegalStateException when basedir was set incorrectly. |
|
|
|
*/ |
|
|
|
public void scan() throws IllegalStateException { |
|
|
|
included = new Vector(); |
|
|
@@ -119,7 +117,6 @@ public class DependScanner extends DirectoryScanner { |
|
|
|
String rootClass = (String) e.nextElement(); |
|
|
|
analyzer.addRootClass(rootClass); |
|
|
|
} |
|
|
|
|
|
|
|
Enumeration e = analyzer.getClassDependencies(); |
|
|
|
|
|
|
|
String[] parentFiles = parentScanner.getIncludedFiles(); |
|
|
@@ -127,7 +124,6 @@ public class DependScanner extends DirectoryScanner { |
|
|
|
for (int i = 0; i < parentFiles.length; ++i) { |
|
|
|
parentSet.put(parentFiles[i], parentFiles[i]); |
|
|
|
} |
|
|
|
|
|
|
|
while (e.hasMoreElements()) { |
|
|
|
String classname = (String) e.nextElement(); |
|
|
|
String filename = classname.replace('.', File.separatorChar); |
|
|
@@ -167,7 +163,9 @@ public class DependScanner extends DirectoryScanner { |
|
|
|
return new String[0]; |
|
|
|
} |
|
|
|
|
|
|
|
//inherit doc |
|
|
|
/** |
|
|
|
* @see DirectoryScanner#getIncludedDirsCount |
|
|
|
*/ |
|
|
|
public int getIncludedDirsCount() { |
|
|
|
return 0; |
|
|
|
} |
|
|
|