ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Solofnenko <A.Solofne...@mdl.com>
Subject RE: Improt task and project basedir
Date Fri, 10 Jan 2003 19:48:16 GMT
I have added a pseudo task <use> that looks like:

  <use file="../commons.xml" basedir=".." prefix="ics"/>
  <use generator="jython:genant.generate" file="JBuilder_project.jpx"
some-generator-parameter="XXX"/> <!-- can generate other <use> tasks -->

Now all targets and properties in commons.xml can be referenced by using
"ics." prefix. The prefix can be empty, but in that case the include is
treated as "local", so it cannot be included anywhere else.

The targets can be overwritten (very useful with build generators). There is
an example:
  <target name="new:precompile"
depends="old:precompile,other-project.do-something">
    <xslt in="${error-file}" out="${error-output}"
style="${ics.error-xsl}"/>
  </target>

The pre-processor does the following:
- reads the main build file and recursively all other files that are used
(each file is loaded only once).
- during parsing a property dictionary is created for each build file,
saying what kind of property it is. Unfortunately ANT does not declare
explicitly path list properties.
- the includes are sorted, so global properties can be initialised in a
proper order (cannot be done for build files with circular imports).
- each build file is given a prefix, the pre-processor tries to keep
original prefixes, but the same build file can be included with different
prefixes from different files
- all tasks are rebased and names are renamed:
  // property renaming and rebasing is difficult with externally loaded
properties
  // there is still no uniformity in task attribute names, the same
attributes can mean different things in different tasks
  + property and task names are prefixed with their resulting prefixes 
  + for a property in place of path list another property is created with
all elements are rebased, because the original property can be used as a
string somewhere else
  + for a normal property in place of location, another rebased property is
created for the same reason
  + a property being rebased that starts with another property, that
property is rebased as well
  + if a property is unknown (such as "java.class.path") its name is not
modified
  + "new:*" and "old:*" tasks are handled by task renaming and creating a
new task with original name
- after that all build files are written into one file and ANT is executed
with new build file.


- Alexey.

-----Original Message-----
From: Costin Manolache [mailto:cmanolache@yahoo.com] 
Sent: Friday, January 10, 2003 11:15 AM
To: ant-dev@jakarta.apache.org
Subject: RE: Improt task and project basedir

Alexey Solofnenko wrote:

> I have written an ANT pre-processor that supports "smart" includes with
> support of rebasing properties and paths, and renaming properties and
> targets to avoid clashes. It supports recursive includes, so build files
> can reference each others properties and targets. It is also possible to
> generate some includes with a script and overwrite targets in other build
> files. I will ask my boss for permission to publish the code.

I think it would be more usefull to contribute informations about your 
use cases.
We (hopefully) agreed on adding <import>, now the question is "What's the
cleanest and simplest default behavior". We can tune it with attributes,
but if a user just types:
 <import file="foo/bar.xml" /> 
we need to know how to resolve the relative paths.

What's the behavior in your preprocessor ?


Costin


> 
> - Alexey.
> 
> -----Original Message-----
> From: Costin Manolache [mailto:cmanolache@yahoo.com]
> Sent: Friday, January 10, 2003 7:08 AM
> To: ant-dev@jakarta.apache.org
> Subject: RE: Improt task and project basedir
> 
> Jose Alberto Fernandez wrote:
> 
>> Do you really think I can get the buildfiles of lets say 5 different
>> jakarta projects and just import all of them on my build file and then
>> with a few additional main targets being able to build all those projects
>> on one go?
> 
> Why not ?
> 
> Maybe not any 5 different projects - but at least for the 4-5 tomcat
> components, most commons, etc. Maybe with small changes.
> 
> 
>> What about clashes on property names? Are we going to have separte names
>> spaces for properties declared in different import files? How would I
>> access properties fro imported build files then.
> 
> Property names - clashes are desirable :-) ( i.e. same naming conventions
> for locating .jars, paths, etc ).
> 
> For targets - we already rewrite then on conflict. That's where some
> changes may be needed in the build files.
> 
> I'm not sure I understood your proposal for basedir - you disagree with
> using the imported file basedir as default, but I fail to see what
> alternative you propose and what use case.
> 
> 
> Costin
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>



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

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


Mime
View raw message