Peter Reilly <[EMAIL PROTECTED]> writes:
> The problem is that this will not set the basedir correctly.
> (The basedir will be set to something like:
> File(url_string).getParentFile().getAbsolutePath()).
> This will cause all sorts of problems and is the reason why
> <import url="..."/> has not been implemented.
OK. It is a good reason.
My build system loads Ant project files from the disk, and I just adapt the
code to load them from a JAR resources.
I can say to you that such a code (set basedir, listener and project name) is
working with both a File and a URL in my build system context as fas as the
exception is not thrown in the ProjectHelper2:
public static Project loadAntProject(Project currentProject,
Object antproject) {
ProjectHelper helper =
(ProjectHelper) currentProject.getReference("ant.projectHelper");
Project project = new Project();
currentProject.initSubProject(project);
// Copy listeners to enable logging
Iterator listenerIt = currentProject.getBuildListeners().iterator();
while (listenerIt.hasNext()) {
BuildListener bl = (BuildListener) listenerIt.next();
currentProject.log(" Adding listener " + bl, Project.MSG_DEBUG);
project.addBuildListener(bl);
}
project.addReference("ant.projectHelper", helper);
project.setBaseDir(currentProject.getBaseDir());
helper.parse(project, antproject);
// Set project name
AntXMLContext context = null;
context = (AntXMLContext)
project.getReference("ant.parsing.context");
project.setName(context.getCurrentProjectName());
return project;
}
Isn't it possible to remove the exception 'throw' statement and document the
method to say that parsing a URL is at your own risk (I aggree to take it ;)) ?
In fact, ProjectHelper2 is not opened enough (private attributes) to be
inherited to change such a small part of code...
Please help me, comment that part of code that never occurs finally (as far as
import url is not implemented as your said) !
Many thanks in advance
--
Yves Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]