QUESTIONS ON PropertyHelper (Ant 1.6+) ANT-dev mailing list:

o Should PropertyHelper replacements honor currently attached
  hooks? What if a hook is attached and then the helper is
  unset (reset to the original Ant-installed one?) Should the
  (new) hooks be "moved" to the original helper?

o Can we create a formal method that gets/sets propertyHelper w/o
  generating reference-replacement warnings?

o What's the ant-dev position on recursive property resolution?
  Is it coming or is that value-added that one must put in one's
  own tasks?

o How do we propagate replaced helpers to sub-projects? What
  about sub-builds?

[NEW} Sooo how would custom PropertyHelpers and Hooks work with
  the selected <local> proposals?

Thanks,
The Wabbit


At 05:36 AM 10/8/2004, you wrote:
Hi,

I have had a proposal outstanding for a while for local properties:

http://issues.apache.org/bugzilla/show_bug.cgi?id=23942

I would like to see them included in ant.
There has been a (lot) of discussions - see

http://marc.theaimsgroup.com/?t=108765926600001&r=1&w=2
http://marc.theaimsgroup.com/?t=107030281800001&r=1&w=2
http://marc.theaimsgroup.com/?t=106916956400008&r=1&w=2

My current feelings (and implemenation) is

1) Syntax
The proposal adds a local property to a enclosing target/taskcontainer.

Example:
  <target name="example">
      <local name="prop" value="a local value"/>
      <echo>prop is ${prop}</echo>
  </target>

  <macrodef name="t2">
      <attribute name="file"/>
      <sequential>
        <local name="dir"/>
        <dirname property="dir" file="@{file}"/>
        <mkdir dir="${dir}"/>
        <touch file="@{file}"/>
      </sequential>
   </macrodef>

I think it is nicer to do this rather that having an explicit local
property container, or having special elements for different types
of structures (like for example a <local> element at the same level
as <attribute> in a <macrodef>).

2) Shadowing of properties

The proposal allows local properties to shadow normal and user properties.
I feel that this is necessary to allow macrodefs to be written without
them failing sometimes. This means that the following will work:

<project>
 <import file="macros.xml"/>
 <property name="dir" value="."/>

 <t2 file="${user.home}/.ant/lib/js.jar"/>
</project>

ant -Ddir=/var/tmp

3) Extent of local properties

local properties will be inherited to child projects (if inheritall is true).

Peter

Stephan Bodewig wrote:
Things we need to consider IMHO:

(1) Syntax

Your proposal uses a <local> task that sets up a local scope for a
named property until the enclosing target/sequential finishes.  Jose
Alberto suggested to use a <local> TaskContainer instead, something
like

<local>
 <local-property name="...."/>
</local>

which would essentially just add an explicit (and differently named)
<seqential> to your proposal.  I think I prefer the more explicit,
even if more verbose syntax of the second form.

(2) Shadowing of properties

Your updated proposal ensures that local properties do not override
"global" user properties.  I think they shouldn't be allowed to
override any outer scope properties at all.

(3) Extent of local properties

You make the local properties available to <script> - will they also
be available for builds that get called with the <ant> family of tasks
(assuming inheritall is true)?  I think they should be.



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to