Browse Source

Implement the change in handling the top-level target before

executing other targets ( which is closer to the original
behavior ).

Import started to work a bit - but it complain about
circular dep on super.mb2, still investigating.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273135 13f79535-47bb-0310-9956-ffa450edef68
master
Costin Manolache 23 years ago
parent
commit
cb8e13aaed
2 changed files with 3 additions and 104 deletions
  1. +3
    -104
      proposal/sandbox/embed/ProjectHelperImpl2.java
  2. BIN
      proposal/sandbox/embed/ant-sax2.jar

+ 3
- 104
proposal/sandbox/embed/ProjectHelperImpl2.java View File

@@ -104,6 +104,7 @@ public class ProjectHelperImpl2 extends ProjectHelper {
project.addReference( "ant.parsing.context", context );
parse(project, source,new RootHandler(context));
context.implicitTarget.execute();
}

/**
@@ -680,7 +681,8 @@ public class ProjectHelperImpl2 extends ProjectHelper {
Project project=context.project;
target = new Target();
target.addDependency( "" );
// No need - it'll be handled explicitly
// target.addDependency( "" );
target.setName(name);
target.setIf(ifCond);
target.setUnless(unlessCond);
@@ -1153,107 +1155,4 @@ public class ProjectHelperImpl2 extends ProjectHelper {
return new NestedElementHandler(element, wrapper, target);
}
}

// /**
// * Handler for the root element. Its only child must be the "project" element.
// */
// static class ImportHandler extends AntHandler {

// /**
// * Initialisation routine called after handler creation
// * with the element name and attributes. The attributes which
// * this handler can deal with are: <code>"default"</code>,
// * <code>"name"</code>, <code>"id"</code> and <code>"basedir"</code>.
// *
// * @param tag Name of the element which caused this handler
// * to be created. Should not be <code>null</code>.
// * Ignored in this implementation.
// * @param attrs Attributes of the element which caused this
// * handler to be created. Must not be <code>null</code>.
// *
// * @exception SAXParseException if an unexpected attribute is
// * encountered or if the <code>"default"</code> attribute
// * is missing.
// */
// public void onStartElement(String uri, String tag, String qname,
// Attributes attrs,
// AntXmlContext context)
// throws SAXParseException
// {
// context._importlevel++;
// Project project=context.project;
// project.log("importlevel: "+(context._importlevel-1)+" -> "+(context._importlevel),
// Project.MSG_DEBUG);
// String file = null;
// for (int i = 0; i < attrs.getLength(); i++) {
// String key = attrs.getQName(i);
// String value = attrs.getValue(i);
// if (key.equals("file")) {
// file = value;
// } else {
// throw new SAXParseException("Unexpected attribute \"" + key + "\"", context.locator);
// }
// }

// if (file == null) {
// throw new SAXParseException("import element appears without a file attribute",
// context.locator);
// }
// file=project.replaceProperties(file);
// project.log("Importing file "+file+" from "+
// context.buildFile.getAbsolutePath(),
// Project.MSG_VERBOSE);

// // Paths are relative to the build file they're imported from,
// // *not* the current directory (same as entity includes).
// File importedFile = new File(file);
// if (!importedFile.isAbsolute()) {
// importedFile = new File(context.buildFileParent, file);
// }
// if (!importedFile.exists()) {
// throw new SAXParseException("Cannot find "+file+" imported from "+
// context.buildFile.getAbsolutePath(),
// context.locator);
// }

// // Add parent build file to the map to avoid cycles...
// String parentFilename = getPath(context.buildFile);
// if (!context._importedFiles.containsKey(parentFilename)) {
// context._importedFiles.put(parentFilename, context.buildFile);
// }

// // Make sure we import the file only once
// String importedFilename = getPath(importedFile);
// if (context._importedFiles.containsKey(importedFilename)) {
// project.log("\nSkipped already imported file:\n "+importedFilename+"\n",
// Project.MSG_WARN);
// return;
// }
// else {
// context._importedFiles.put(importedFilename, importedFile);
// }
// org.xml.sax.XMLReader oldparser = context.parser;
// context.ignoreProjectTag=true;
// context.helper.parse(context.project, importedFile, new RootHandler(context));
// context.ignoreProjectTag=false;
// context.parser = oldparser;

// context._importlevel--;
// context.project.log("importlevel: "+context._importlevel+" <- "+
// (context._importlevel+1) ,Project.MSG_DEBUG);
// }

// private static String getPath(File file) {
// try {
// return file.getCanonicalPath();
// }
// catch (IOException e) {
// return file.getAbsolutePath();
// }
// }
// }

}

BIN
proposal/sandbox/embed/ant-sax2.jar View File


Loading…
Cancel
Save