Browse Source

typefound prints diags in -v option

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278516 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 20 years ago
parent
commit
a44afbeef7
2 changed files with 10 additions and 4 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/ComponentHelper.java
  2. +9
    -3
      src/main/org/apache/tools/ant/taskdefs/condition/TypeFound.java

+ 1
- 1
src/main/org/apache/tools/ant/ComponentHelper.java View File

@@ -789,7 +789,7 @@ public class ComponentHelper {
/**
* Handler called to do decent diagnosis on instantiation failure.
* @param componentName component name.
* @param type component type.
* @param type component type, used in error messages
* @return a string containing as much diagnostics info as possible.
*/
public String diagnoseCreationFailure(String componentName, String type) {


+ 9
- 3
src/main/org/apache/tools/ant/taskdefs/condition/TypeFound.java View File

@@ -22,6 +22,7 @@ import org.apache.tools.ant.ComponentHelper;
import org.apache.tools.ant.ProjectComponent;
import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.AntTypeDefinition;
import org.apache.tools.ant.Project;

/**
* looks for a task or other Ant type that exists. Existence is defined as
@@ -59,13 +60,18 @@ public class TypeFound extends ProjectComponent implements Condition {

ComponentHelper helper =
ComponentHelper.getComponentHelper(getProject());
AntTypeDefinition def = helper.getDefinition(
ProjectHelper.genComponentName(uri, typename));
String componentName = ProjectHelper.genComponentName(uri, typename);
AntTypeDefinition def = helper.getDefinition(componentName);
if (def == null) {
return false;
}
//now verify that the class has an implementation
return def.getExposedClass(getProject()) != null;
boolean found = def.getExposedClass(getProject()) != null;
if(!found) {
String text= helper.diagnoseCreationFailure(componentName,"type");
log(text, Project.MSG_VERBOSE);
}
return found;
}




Loading…
Cancel
Save