ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1385265 - in /ant/sandbox/antdsl/branches/import-experiment: org.apache.ant.antdsl/src/org/apache/ant/antdsl/ org.apache.ant.antdsl/src/org/apache/ant/antdsl/antlr/ org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/ org.apache.ant.antd...
Date Sun, 16 Sep 2012 13:47:20 GMT
Author: hibou
Date: Sun Sep 16 13:47:20 2012
New Revision: 1385265

URL: http://svn.apache.org/viewvc?rev=1385265&view=rev
Log:
Try the isolation of build files

Added:
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/Pair.java
      - copied, changed from r1378639, ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/antlr/Pair.java
Removed:
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/antlr/Pair.java
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/xtend-gen/org/apache/ant/antdsl/xtext/generator/AntDSLGenerator.java
Modified:
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AbstractAntDslProjectHelper.java
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSLArgProcessor.java
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDslContext.java
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
    ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
    ant/sandbox/antdsl/branches/import-experiment/test/ant/ivy-fixed.xml
    ant/sandbox/antdsl/branches/import-experiment/test/build.ant

Modified: ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AbstractAntDslProjectHelper.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AbstractAntDslProjectHelper.java?rev=1385265&r1=1385264&r2=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AbstractAntDslProjectHelper.java
(original)
+++ ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AbstractAntDslProjectHelper.java
Sun Sep 16 13:47:20 2012
@@ -37,7 +37,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Stack;
-import java.util.UUID;
 import java.util.Vector;
 
 import org.apache.ant.antdsl.expr.AntExpression;
@@ -264,11 +263,6 @@ public abstract class AbstractAntDslProj
             if (def != null) {
                 project.setDefault(def);
             }
-        } else {
-            if (isInIncludeMode() && !"".equals(name) && (getCurrentTargetPrefix()
== null || getCurrentTargetPrefix().length() == 0)) {
-                // help nested include tasks
-                setCurrentTargetPrefix(name);
-            }
         }
 
         String antFileProp = MagicNames.ANT_FILE + "." + context.getCurrentProjectName();
@@ -340,21 +334,12 @@ public abstract class AbstractAntDslProj
         context.setCurrentTarget(context.getImplicitTarget());
     }
 
-    protected String getTargetPrefix(AntXMLContext context) {
-        String configuredValue = getCurrentTargetPrefix();
-        if (configuredValue != null && configuredValue.length() == 0) {
-            configuredValue = null;
-        }
-        if (configuredValue != null) {
-            return configuredValue;
-        }
-
-        String projectName = context.getCurrentProjectName();
-        if ("".equals(projectName)) {
-            projectName = null;
+    private String getTargetPrefix(AntXMLContext context) {
+        String prefix = getCurrentTargetPrefix();
+        if (prefix != null && prefix.length() == 0) {
+            return null;
         }
-
-        return projectName;
+        return prefix;
     }
 
     protected void setupAntpath(Project project, AntDslContext context, List<InnerElement>
antpathElements) {
@@ -423,7 +408,13 @@ public abstract class AbstractAntDslProj
         Ivy ivy = configureBuildIvy(project);
 
         ResolveReport report = resolveBuild(project, ivyFile, ivy);
+        writeIvyFixed(project, ivy, report);
+        Path ivyPath = getIvyBuildPath(project, report);
+        writePath(project, ivyPath);
+        antPath.add(ivyPath);
+    }
 
+    private void writeIvyFixed(Project project, Ivy ivy, ResolveReport report) {
         File ivyFixFile = new File(project.getBaseDir(), "ant/ivy-fixed.xml");
         ModuleDescriptor md = report.toFixedModuleDescriptor(ivy.getSettings());
         try {
@@ -431,10 +422,6 @@ public abstract class AbstractAntDslProj
         } catch (IOException e) {
             throw new BuildException("Failed to write into the file " + ivyFixFile + " ("
+ e.getMessage() + ")", e);
         }
-
-        Path ivyPath = getIvyBuildPath(project, report);
-        writePath(project, ivyPath);
-        antPath.add(ivyPath);
     }
 
     private ResolveReport resolveBuild(Project project, File ivyFile, Ivy ivy) {
@@ -442,15 +429,16 @@ public abstract class AbstractAntDslProj
         try {
             ResolveOptions options = new ResolveOptions();
             options.setUncompress(true);
-            options.setDownload(false);
-            report = ivy.resolve(ivyFile, options );
+            report = ivy.resolve(ivyFile, options);
         } catch (ParseException e) {
             throw new BuildException("The ivy file " + ivyFile + " could not be parsed",
e);
         } catch (IOException e) {
             throw new BuildException("The ivy file " + ivyFile + " could not be read", e);
         }
         if (report.hasError()) {
-            for (String error : ((List<String>) report.getAllProblemMessages())) {
+            @SuppressWarnings("unchecked")
+            List<String> errors = (List<String>) report.getAllProblemMessages();
+            for (String error : errors) {
                 project.log(error, Project.MSG_ERR);
             }
             throw new BuildException("Resolve of the build path failed");
@@ -487,6 +475,7 @@ public abstract class AbstractAntDslProj
         if (!antPathFile.exists()) {
             File ivyFixFile = new File(project.getBaseDir(), "ant/ivy-fixed.xml");
             if (!ivyFixFile.exists()) {
+                updateBuild(project, antPath);
                 return;
             }
             Ivy ivy = configureBuildIvy(project);
@@ -585,21 +574,20 @@ public abstract class AbstractAntDslProj
     protected void importAntlib(Project project, AntDslContext context, String name, String
resource) {
         // TODO maybe we can do some caching here, each time a build module import the exact
same antlib, it is reloaded
 
-        // FIXME we ensured it is unique, but it is ugly for the end user: we should prefer
something derived from 'resource'
-        String uri = UUID.randomUUID().toString();
+        String fqn = context.addFQNPrefix(name, resource);
 
         ClassLoader cl = getClassloaderStack(project).peek();
 
         Taskdef taskdef = new Taskdef();
+        taskdef.setTaskName("import");
         taskdef.setProject(project);
         taskdef.setResource(resource);
-        taskdef.setURI(uri);
+        taskdef.setURI(fqn);
         taskdef.setAntlibClassLoader(cl);
         taskdef.execute();
-        context.addNamespace(name, uri);
     }
 
-    protected void importBuildModule(Project project, AntDslContext context, String buildModule)
{
+    protected void importBuildModule(Project project, AntDslContext context, String name,
String buildModule) {
         ClassLoader cl = getClassloaderStack(project).peek();
 
         URL buildUrl = cl.getResource(buildModule);
@@ -623,12 +611,28 @@ public abstract class AbstractAntDslProj
         }
         getClassloaderStack(project).push(childCl);
 
+        String oldPrefix = ProjectHelper.getCurrentTargetPrefix();
+        boolean oldIncludeMode = ProjectHelper.isInIncludeMode();
+        String oldSep = ProjectHelper.getCurrentPrefixSeparator();
+        boolean oldIgnoringProjectTag = context.isIgnoringProjectTag();
+
+        String fqn = context.addFQNPrefix(name, buildModule);
+        setCurrentTargetPrefix(fqn);
+
         // push current stacks into the sub helper
         subHelper.getImportStack().addAll(this.getImportStack());
         subHelper.getExtensionStack().addAll(this.getExtensionStack());
         project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, subHelper);
 
-        subHelper.parse(project, urlResource);
+        context.push();
+
+        try {
+            subHelper.parse(project, urlResource);
+        } catch (BuildException e) {
+            throw ProjectHelper.addLocationToBuildException(e, context.getLocation());
+        }
+
+        context.pop();
 
         // push back the stack from the sub helper to the main one
         getClassloaderStack(project).pop();
@@ -637,11 +641,16 @@ public abstract class AbstractAntDslProj
         getImportStack().addAll(subHelper.getImportStack());
         getExtensionStack().clear();
         getExtensionStack().addAll(subHelper.getExtensionStack());
+
+        ProjectHelper.setCurrentTargetPrefix(oldPrefix);
+        ProjectHelper.setCurrentPrefixSeparator(oldSep);
+        ProjectHelper.setInIncludeMode(oldIncludeMode);
+        context.setIgnoreProjectTag(oldIgnoringProjectTag);
     }
 
     public void mapCommonTarget(
-            Target target, Project project, AntDslContext context, String name, String description,
List<String> depends, List<String> extensionsOf,
-            String onMiss) {
+            Target target, Project project, AntDslContext context, String name, String description,
List<Pair<String, String>> depends,
+            List<Pair<String, String>> extensionsOf, String onMiss) {
         OnMissingExtensionPoint extensionPointMissing = null;
         if (onMiss != null) {
             extensionPointMissing = OnMissingExtensionPoint.valueOf(onMiss.toUpperCase(Locale.ENGLISH));
@@ -649,75 +658,52 @@ public abstract class AbstractAntDslProj
 
         context.addTarget(target);
         target.setProject(project);
-        if ("".equals(name)) {
-            throw new BuildException("name attribute must " + "not be empty");
-        }
         target.setName(name);
         target.setDescription(description);
 
-        String prefix = null;
-        boolean isInIncludeMode = context.isIgnoringProjectTag() && isInIncludeMode();
-        String sep = getCurrentPrefixSeparator();
-
-        if (isInIncludeMode) {
-            prefix = getTargetPrefix(context);
-            if (prefix == null) {
-                throw new BuildException("can't include build file " + context.getBuildFileURL()
+ ", no as attribute has been given"
-                        + " and the project tag doesn't" + " specify a name attribute");
-            }
-            name = prefix + sep + name;
+        String fqnPrefix;
+        if (context.isIgnoringProjectTag()) {
+            fqnPrefix = getTargetPrefix(context) + getCurrentPrefixSeparator();
+        } else {
+            fqnPrefix = "";
         }
+        String fqn = fqnPrefix + name;
 
         // Check if this target is in the current build file
-        if (context.getCurrentTargets().get(name) != null) {
+        if (context.getCurrentTargets().get(fqn) != null) {
             throw new BuildException("Duplicate target '" + name + "'", target.getLocation());
         }
-        Hashtable<String, Target> projectTargets = project.getTargets();
-        boolean usedTarget = false;
-        // If the name has not already been defined define it
-        if (projectTargets.containsKey(name)) {
-            project.log("Already defined in main or a previous import, ignore " + name, Project.MSG_VERBOSE);
-        } else {
-            target.setName(name);
-            context.getCurrentTargets().put(name, target);
-            project.addOrReplaceTarget(name, target);
-            usedTarget = true;
-        }
+        context.getCurrentTargets().put(fqn, target);
+        project.addOrReplaceTarget(fqn, target);
 
         if (depends != null) {
-            for (String dep : depends) {
-                if (!isInIncludeMode) {
-                    target.addDependency(dep);
+            for (Pair<String, String> dep : depends) {
+                if (dep.first == null) {
+                    target.addDependency(fqnPrefix + dep.second);
                 } else {
-                    target.addDependency(prefix + sep + dep);
+                    target.addDependency(context.getFQNPrefix(dep.first) + getCurrentPrefixSeparator()
+ dep.second);
                 }
             }
         }
 
-        if (!isInIncludeMode && context.isIgnoringProjectTag() && (prefix
= getTargetPrefix(context)) != null) {
-            // In an imported file (and not completely
-            // ignoring the project tag or having a preconfigured prefix)
-            String newName = prefix + sep + name;
-            Target newTarget = usedTarget ? new Target(target) : target;
-            newTarget.setName(newName);
-            context.getCurrentTargets().put(newName, newTarget);
-            project.addOrReplaceTarget(newName, newTarget);
-        }
         if (extensionPointMissing != null && extensionsOf == null) {
             throw new BuildException("onMissingExtensionPoint attribute cannot be specified
unless extensionOf is specified", target.getLocation());
         }
         if (extensionsOf != null) {
             ProjectHelper helper = context.getProject().getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
-            for (String extensionOf : extensionsOf) {
-                if (isInIncludeMode()) {
-                    extensionOf = prefix + sep + extensionOf;
+            for (Pair<String, String> extensionOf : extensionsOf) {
+                String extensionName;
+                if (extensionOf.first == null) {
+                    extensionName = fqnPrefix + extensionOf.second;
+                } else {
+                    extensionName = context.getFQNPrefix(extensionOf.first) + getCurrentPrefixSeparator()
+ extensionOf.second;
                 }
                 if (extensionPointMissing == null) {
                     extensionPointMissing = OnMissingExtensionPoint.FAIL;
                 }
                 // defer extensionpoint resolution until the full
                 // import stack has been processed
-                helper.getExtensionStack().add(new String[] {extensionOf, name, extensionPointMissing.name()});
+                helper.getExtensionStack().add(new String[] {extensionName, name, extensionPointMissing.name()});
             }
         }
     }
@@ -743,7 +729,7 @@ public abstract class AbstractAntDslProj
             qname = tag;
         } else {
             qname = ns + ":" + tag;
-            uri = context.getURI(ns);
+            uri = context.getFQNPrefix(ns);
             if (uri == null) {
                 uri = ns;
             }

Modified: ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSLArgProcessor.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSLArgProcessor.java?rev=1385265&r1=1385264&r2=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSLArgProcessor.java
(original)
+++ ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSLArgProcessor.java
Sun Sep 16 13:47:20 2012
@@ -1,5 +1,6 @@
 package org.apache.ant.antdsl;
 
+import java.io.PrintStream;
 import java.util.List;
 
 import org.apache.tools.ant.ArgumentProcessor;
@@ -7,11 +8,11 @@ import org.apache.tools.ant.Project;
 
 public class AntDSLArgProcessor implements ArgumentProcessor {
 
-    public int readArgument(String arg) {
-        if (arg.equals("-update-build")) {
-            return 1;
+    public int readArguments(String[] args, int pos) {
+        if (args[pos].equals("-update-build")) {
+            return pos + 1;
         }
-        return 0;
+        return -1;
     }
 
     public boolean handleArg(List<String> extraArgs) {
@@ -26,8 +27,8 @@ public class AntDSLArgProcessor implemen
         return true;
     }
 
-    public void printUsage(StringBuffer msg, String lSep) {
-        msg.append("  -update-build          launch a resolve of the ant path" + lSep);
+    public void printUsage(PrintStream writer) {
+        writer.println("  -update-build          launch a resolve of the ant path");
     }
 
 }

Modified: ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDslContext.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDslContext.java?rev=1385265&r1=1385264&r2=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDslContext.java
(original)
+++ ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDslContext.java
Sun Sep 16 13:47:20 2012
@@ -18,25 +18,91 @@
 package org.apache.ant.antdsl;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
+import java.util.Stack;
 
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Location;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.helper.AntXMLContext;
+import org.xml.sax.Locator;
 
 public class AntDslContext extends AntXMLContext {
 
-    private Map<String, String> namespaces = new HashMap<String, String>();
+    private Stack<Map<String, String>> fqnPrefixesMapping = new Stack<Map<String,
String>>();
+
+    private Set<String> fqnPrefixes = new HashSet<String>();
+
+    private Location location;
 
     public AntDslContext(Project project) {
         super(project);
+        push();
+    }
+
+    public void push() {
+        fqnPrefixesMapping.push(new HashMap<String, String>());
+    }
+
+    public void pop() {
+        fqnPrefixesMapping.pop();
     }
 
-    public void addNamespace(String name, String uri) {
-        namespaces.put(name, uri);
+    public String addFQNPrefix(String name, String resource) {
+        Map<String, String> mapping = fqnPrefixesMapping.peek();
+        if (mapping.containsKey(name)) {
+            throw new BuildException("Alias " + name + " already defined in the file", getLocation());
+        }
+        String fqnPrefix = asFQN(resource);
+        if (fqnPrefixes.contains(fqnPrefix)) {
+            int i = 1;
+            while(fqnPrefixes.contains(fqnPrefix + (++i)));
+            fqnPrefix = fqnPrefix + i;
+        }
+        boolean added = fqnPrefixes.add(fqnPrefix);
+        if (!added) {
+            throw new RuntimeException("Fully qualified name prefix already used " + fqnPrefix);
+        }
+        mapping.put(name, fqnPrefix);
+        return fqnPrefix;
     }
 
-    public String getURI(String name) {
-        return namespaces.get(name);
+    public String getFQNPrefix(String name) {
+        return fqnPrefixesMapping.peek().get(name);
     }
 
+    private String asFQN(String resource) {
+        if (resource == null) {
+            resource = "";
+        }
+        String pkgName;
+        if (resource.startsWith("/")) {
+            pkgName = resource.substring(1);
+        } else {
+            pkgName = resource;
+        }
+        int end = pkgName.lastIndexOf('/');
+        if (end > 0) {
+            pkgName = pkgName.substring(0, end);
+        }
+        pkgName = pkgName.replace('/', '.');
+        return pkgName;
+    }
+
+    public void setLocation(Location location) {
+        this.location = location;
+    }
+
+    public Location getLocation() {
+        if (location != null) {
+            return location;
+        }
+        Locator l = super.getLocator();
+        if (l != null) {
+            return new Location(l.getSystemId(), l.getLineNumber(), l.getColumnNumber());
+        }
+        return null;
+    }
 }

Copied: ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/Pair.java
(from r1378639, ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/antlr/Pair.java)
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/Pair.java?p2=ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/Pair.java&p1=ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/antlr/Pair.java&r1=1378639&r2=1385265&rev=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/antlr/Pair.java
(original)
+++ ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/Pair.java
Sun Sep 16 13:47:20 2012
@@ -15,18 +15,27 @@
  *  limitations under the License.
  *
  */
-package org.apache.ant.antdsl.antlr;
+package org.apache.ant.antdsl;
 
-public class Pair<F,S> {
+public class Pair<F, S> {
 
     public F first;
 
     public S second;
 
+    public Pair() {
+        // default constructor
+    }
+
+    public Pair(F first, S second) {
+        this.first = first;
+        this.second = second;
+    }
+
     public F getFirst() {
         return first;
     }
-    
+
     public S getSecond() {
         return second;
     }

Modified: ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext?rev=1385265&r1=1385264&r2=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
(original)
+++ ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
Sun Sep 16 13:47:20 2012
@@ -43,7 +43,7 @@ EAntlibImport:
 ;
 
 EBuildImport:
-    'module' file=StringLiteral
+    'module' file=StringLiteral 'as' name=Identifier
 ;
 
 EExtensionPoint:
@@ -72,7 +72,7 @@ ETaskLists:
 ;
 
 ETargetList:
-    names+=Identifier (',' names+=Identifier)*
+    names+=ENSName (',' names+=ENSName)*
 ;
 
 ETask:

Modified: ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java?rev=1385265&r1=1385264&r2=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
(original)
+++ ant/sandbox/antdsl/branches/import-experiment/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
Sun Sep 16 13:47:20 2012
@@ -36,6 +36,7 @@ import org.apache.ant.antdsl.FunctionDef
 import org.apache.ant.antdsl.FunctionDef.TemplateElement;
 import org.apache.ant.antdsl.IfTask;
 import org.apache.ant.antdsl.IfTask.ConditionnalSequential;
+import org.apache.ant.antdsl.Pair;
 import org.apache.ant.antdsl.expr.AddAntExpression;
 import org.apache.ant.antdsl.expr.AndAntExpression;
 import org.apache.ant.antdsl.expr.AntExpression;
@@ -95,6 +96,7 @@ import org.apache.ant.antdsl.xtext.antds
 import org.apache.ant.antdsl.xtext.antdsl.ELocalAssignment;
 import org.apache.ant.antdsl.xtext.antdsl.ELocalPropertyFuncArgument;
 import org.apache.ant.antdsl.xtext.antdsl.EMultiplicativeExpr;
+import org.apache.ant.antdsl.xtext.antdsl.ENSName;
 import org.apache.ant.antdsl.xtext.antdsl.ENullExpr;
 import org.apache.ant.antdsl.xtext.antdsl.EOctalLiteralExpr;
 import org.apache.ant.antdsl.xtext.antdsl.EProject;
@@ -183,7 +185,7 @@ public class AntDslXTextProjectHelper ex
                     importAntlib(project, context, readIdentifier(eAntlibImport.getName()),
readString(eAntlibImport.getResource()));
                 } else if (eImport instanceof EBuildImport) {
                     EBuildImport eBuildImport = (EBuildImport) eImport;
-                    importBuildModule(project, context, readString(eBuildImport.getFile()));
+                    importBuildModule(project, context, readIdentifier(eBuildImport.getName()),
readString(eBuildImport.getFile()));
                 } else {
                     throw new IllegalArgumentException("Unsupported import " + eImport.getClass().getName());
                 }
@@ -263,13 +265,13 @@ public class AntDslXTextProjectHelper ex
         return target;
     }
 
-    private List<String> mapTargetList(ETargetList targetList) {
+    private List<Pair<String, String>> mapTargetList(ETargetList targetList)
{
         if (targetList == null) {
             return null;
         }
-        List<String> names = new ArrayList<String>();
-        for (String name : targetList.getNames()) {
-            names.add(readIdentifier(name));
+        List<Pair<String, String>> names = new ArrayList<Pair<String, String>>();
+        for (ENSName name : targetList.getNames()) {
+            names.add(new Pair<String, String>(readIdentifier(name.getNamespace()),
readIdentifier(name.getName())));
         }
         return names;
     }

Modified: ant/sandbox/antdsl/branches/import-experiment/test/ant/ivy-fixed.xml
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/test/ant/ivy-fixed.xml?rev=1385265&r1=1385264&r2=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/test/ant/ivy-fixed.xml (original)
+++ ant/sandbox/antdsl/branches/import-experiment/test/ant/ivy-fixed.xml Sun Sep 16 13:47:20
2012
@@ -4,7 +4,7 @@
 		module="test-build"
 		revision="working@hibpro.home"
 		status="integration"
-		publication="20120828211112"
+		publication="20120829210819"
 	/>
 	<configurations>
 		<conf name="default" visibility="public"/>

Modified: ant/sandbox/antdsl/branches/import-experiment/test/build.ant
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/branches/import-experiment/test/build.ant?rev=1385265&r1=1385264&r2=1385265&view=diff
==============================================================================
--- ant/sandbox/antdsl/branches/import-experiment/test/build.ant (original)
+++ ant/sandbox/antdsl/branches/import-experiment/test/build.ant Sun Sep 16 13:47:20 2012
@@ -7,10 +7,10 @@ antpath {
 }
 */
 import antlib "org/apache/ant/antunit/antlib.xml" as antunit
-import module "org/apache/ant/antdsl/test/build.ant"
+import module "org/apache/ant/antdsl/test/build.ant" as test
 
 target build
-    depends imported
+    depends test:imported
 {
     antunit:assertEquals(expected = "test", actual = "test")
     antunit:assertEquals(expected = "test", actual = "nok")



Mime
View raw message