ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Importing and caching build files from a URL
Date Wed, 30 Nov 2005 05:26:46 GMT
On Tue, 29 Nov 2005, Peter Reilly <peter.kitt.reilly@gmail.com> wrote:

> The current file attribute of the import task is meant to act
> in the same way as href in html- - i.e relative to the
> directory that the importer file is in.
> 
> THe import task could easily use urls in the same way - but
> some internals in ant assume that build files are Files and
> only Files.

Does this apply to imported files as well?  Or only to the main build
file loaded at first?

Right now we suggest to use the property ant.file.IMPORTED and use it
as if it was a file name.  I guess we'd need a new task like

<resolve property="my.path.relative.to.this.url"
         base="ant.file.IMPORTED"
         path="some/relative/path"/>

which would resolve a relative path and set a property with the
absolute value.  This task could deal with files as well as arbitrary
URLs as values for ant.file.IMPORTED.  The result would be an URL,
even in the file case.

People who write build files and anticipate their file to be imported
via non-file URLs should use that and resource versions of tasks.
I.e. instead of

  <basedir property="imported.basedir" file="${ant.file.IMPORTED}"/>
  <property file="${imported.basedir}/imported.properties"/>

you'd write

  <resolve property="imported.properties" base="${ant.file.IMPORTED}"
           path="imported.properties"/>
  <loadproperties>
    <url url="${imported.properties}"/>
  </loadproperties>

That way we'd require some thinking ahead of people writing build
files that get imported, but should be able to solve the relative path
issue.

Other "build files are files" problems are probably waiting to be
discovered.

Stefan

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


Mime
View raw message