ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: Patch proposal for 1.6.3: parse a Ant project from a resource
Date Thu, 27 Jan 2005 12:14:33 GMT
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.

Peter

Yves Martin wrote:

>Yves Martin <yves.martin@elca.ch> writes:
>
>  
>
>>   Hello,
>>
>> I'm writing a task which aim is to parse a Ant Project with 'helper.parse(p,
>> myURL)'
>>
>> It works well when myURL is a File on disk - but it failed with "Source not
>> supported by this plugin" when it is a URL... whereas I saw some parts of
>> ProjectHelper2 designed to load a URL resource.
>>
>> I would like to avoid to inherit from ProjectHelper2 to work-around the check
>> that failed.
>>    
>>
>
> I would like to understand why a BuildException is thrown when trying to parse
> a URL ?
>
> I disabled that exception throwing and in fact, I just use
> helper.parse(project, URL) with a URL and it works perfectly well.
>
> If there is no "good" reason or constraint about that exception, I would be
> pleased to see that part of code removed. Or simply disabled by a project
> property, why not. What do you think about it ? Is it possible to get it for
> release 1.6.3 (it will be a great help for me to release my build system) ?
>
> Thanks in advance for your help
>
><ProjectHelper2>
>    public void parse(Project project, Object source, RootHandler handler)
>            throws BuildException {
>
>        AntXMLContext context = handler.context;
>
>        File buildFile = null;
>        URL  url = null;
>        String buildFileName = null;
>
>        if (source instanceof File) {
>            buildFile = (File) source;
>            buildFile = fu.normalize(buildFile.getAbsolutePath());
>            context.setBuildFile(buildFile);
>            buildFileName = buildFile.toString();
>//         } else if (source instanceof InputStream ) {
>        } else if (source instanceof URL) {
>//             if (handler.getCurrentAntHandler() != elementHandler) {
>//                 throw new BuildException(
>//                     "Source " + source.getClass().getName()
>//                     + " not supported by this plugin for "
>//                     + " non task xml");
>//             }
>            url = (URL) source;
>            buildFileName = url.toString();
>//         } else if (source instanceof InputSource ) {
>        } else {
>            throw new BuildException("Source " + source.getClass().getName()
>                                     + " not supported by this plugin");
>        }
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message