Browse Source

Place antlibs temp defintions in a ant:current namespace.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275163 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 22 years ago
parent
commit
665a5463e7
2 changed files with 16 additions and 9 deletions
  1. +13
    -9
      src/main/org/apache/tools/ant/ComponentHelper.java
  2. +3
    -0
      src/main/org/apache/tools/ant/ProjectHelper.java

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

@@ -112,7 +112,7 @@ public class ComponentHelper {
*/
private Stack antLibStack = new Stack();
/** current antlib context */
private AntTypeTable antLibTypeTable = null;
private AntTypeTable antLibCurrentTypeTable = null;

/**
* Map from task names to vectors of created tasks
@@ -268,8 +268,10 @@ public class ComponentHelper {
public AntTypeDefinition getDefinition(String componentName) {
checkNamespace(componentName);
AntTypeDefinition ret = null;
if (antLibTypeTable != null && componentName.indexOf(':') == -1) {
ret = antLibTypeTable.getDefinition(componentName);
if (antLibCurrentTypeTable != null
&& ProjectHelper.ANT_CURRENT_URI.equals(
ProjectHelper.extractUriFromComponentName(componentName))) {
ret = antLibCurrentTypeTable.getDefinition(componentName);
}
if (ret == null) {
ret = antTypeTable.getDefinition(componentName);
@@ -689,9 +691,11 @@ public class ComponentHelper {
Project.MSG_DEBUG);
antTypeTable.put(name, def);

if (antLibTypeTable != null && name.lastIndexOf(':') != -1) {
if (antLibCurrentTypeTable != null && name.lastIndexOf(':') != -1) {
String baseName = name.substring(name.lastIndexOf(':') + 1);
antLibTypeTable.put(baseName, def);
antLibCurrentTypeTable.put(
ProjectHelper.genComponentName(
ProjectHelper.ANT_CURRENT_URI, baseName), def);
}
}
}
@@ -700,8 +704,8 @@ public class ComponentHelper {
* Called at the start of processing an antlib
*/
public void enterAntLib() {
antLibTypeTable = new AntTypeTable(project);
antLibStack.push(antLibTypeTable);
antLibCurrentTypeTable = new AntTypeTable(project);
antLibStack.push(antLibCurrentTypeTable);
}

/**
@@ -710,9 +714,9 @@ public class ComponentHelper {
public void exitAntLib() {
antLibStack.pop();
if (antLibStack.size() != 0) {
antLibTypeTable = (AntTypeTable) antLibStack.peek();
antLibCurrentTypeTable = (AntTypeTable) antLibStack.peek();
} else {
antLibTypeTable = null;
antLibCurrentTypeTable = null;
}
}



+ 3
- 0
src/main/org/apache/tools/ant/ProjectHelper.java View File

@@ -88,6 +88,9 @@ public class ProjectHelper {
/** The URI for ant name space */
public static final String ANT_CORE_URI = "ant:core";

/** The URI for antlib current definitions */
public static final String ANT_CURRENT_URI = "ant:current";

/** The URI for defined types/tasks - the format is antlib:<package> */
public static final String ANTLIB_URI = "antlib:";



Loading…
Cancel
Save