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 Mon, 13 Jan 2003 16:24:20 GMT
Hello Nicola,

Externally loaded properties can be prefixed, since <property file=""/> and
<xmlproperty> have "prefix" attributes, but externally loaded properties
cannot be rebased in pre-processor, only in ANT itself. I had to provide a
"project.root" property to ANT and use it in all externally loaded property
files for path properties to work correctly.

Property rebasing requires some discipline from a build writer. That means
all path properties should be in <property location=""/> form. Sometimes a
property can be used in both string and path context. That is why the real
string property is not rebased, but a shadow rebased property should be
created:
<property name="some-dir" value="build"/>

<fileset dir="${some-dir}/.." includes="${some-dir}"/>

is translated into something like:

<property name="some-dir" value="build"/>
<property name="some-dir~~rebased"
location="${**rebased-base-dir**}/build"/> 
<fileset dir="${some-dir~~rebased}/.." includes="${some-dir}"/>

ANT itself can be changed to save three kinds of values for each property -
a string value, path value and path list value. In that case no magical
names are needed.

In case of one property uses another rebased property it does not have to be
changed at all.

I think that dropping property rebasing will leave build writing still
inconvenient.

- Alexey.

-----Original Message-----
From: Nicola Ken Barozzi [mailto:nicolaken@apache.org] 
Sent: Saturday, January 11, 2003 4:20 AM
To: Ant Developers List
Subject: Re: Improt task and project basedir



....
 From my read of your comments, it seems that there are some issues with 
these tasks, that have since prevented me from trying it in the first place:

   -  property renaming:
       - properties that are loaded from external files are not prefixed

         * This can be fixed by setting a value in the base
           propertyHelper that prefixes all preperties set.
           This would be controlled by the Import task.

       - each build file is given a prefix, and the same build file can
         be included with different prefixes from different files

         * This would just need a change in the circular reference
           resolution to not skip same imports with different prefixes.

   -  property rebasing:
       - 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

         * How do you know if a property has to be rebased?
           I would not even try to rebase simple string properties.

       - for a normal property in place of location, another rebased
         property is created for the same reason

         * But this ties us to "magic name" attributes...

       - a property being rebased that starts with another property,
         that property is rebased as well

         * If a property uses a rebased property, it doesn't need itself
           rebasing, no?

For rebasing, I'm not that sure it's worth the effort, though it seems 
interestig. My current take with it is that I always use the 
${ant.file.buildfile} property to "base" the properties correctly. Also, 
I want to retain the possibility of accessing the "originating" basedir, 
so that has also to be taken into account.

Given the above, ATM I'm tending to think that the easiest effective 
course of action is to:

  * add the prefixing possibility to imported stuff
  * make ${currentprojectname. basedir} be resolved relative to the
    basedir of the current projectcurrent
  * mark projects that are designed to be imported as importable="true"

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


--
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