From 5a8d0dcb27fb9e3040f36569224569caf28a5ada Mon Sep 17 00:00:00 2001
From: Peter Reilly
Date: Fri, 20 May 2005 16:33:15 +0000
Subject: [PATCH] add uri attribute to typefound type
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278308 13f79535-47bb-0310-9956-ffa450edef68
---
docs/manual/CoreTasks/conditions.html | 9 ++++++++-
.../tools/ant/taskdefs/condition/TypeFound.java | 16 ++++++++++++++--
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/docs/manual/CoreTasks/conditions.html b/docs/manual/CoreTasks/conditions.html
index 96e9eaca8..84802601e 100644
--- a/docs/manual/CoreTasks/conditions.html
+++ b/docs/manual/CoreTasks/conditions.html
@@ -425,6 +425,13 @@ tasks, datatypes, scriptdefs, macrodefs and presetdefs.
name of the type |
Yes |
+
+ uri |
+
+ The uri that this type lives in.
+ |
+ No |
+
@@ -433,7 +440,7 @@ tasks, datatypes, scriptdefs, macrodefs and presetdefs.
<typefound name="junit"/>
- <typefound name="antlib:org.apache.maven.artifact.ant:artifact"/>
+ <typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/>
scriptcondition
diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/TypeFound.java b/src/main/org/apache/tools/ant/taskdefs/condition/TypeFound.java
index 934ce1e17..c6a3ee0ef 100644
--- a/src/main/org/apache/tools/ant/taskdefs/condition/TypeFound.java
+++ b/src/main/org/apache/tools/ant/taskdefs/condition/TypeFound.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 The Apache Software Foundation
+ * Copyright 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.
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.condition;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.ComponentHelper;
import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.AntTypeDefinition;
/**
@@ -30,6 +31,7 @@ import org.apache.tools.ant.AntTypeDefinition;
public class TypeFound extends ProjectComponent implements Condition {
private String name;
+ private String uri;
/**
* the task or other type to look for
@@ -39,6 +41,15 @@ public class TypeFound extends ProjectComponent implements Condition {
this.name = name;
}
+ /**
+ * The URI for this definition.
+ * @param uri the namespace URI. If this is not set, use the
+ * default namespace.
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
/**
* test for a task or other ant type existing in the current project
* @param typename the name of the type
@@ -48,7 +59,8 @@ public class TypeFound extends ProjectComponent implements Condition {
ComponentHelper helper =
ComponentHelper.getComponentHelper(getProject());
- AntTypeDefinition def = helper.getDefinition(typename);
+ AntTypeDefinition def = helper.getDefinition(
+ ProjectHelper.genComponentName(uri, typename));
if (def == null) {
return false;
}