I won't repeat everything here, but I believe some of the forces we were trying to balance included:
1. Properties specified on the command-line should override everything, always (this, I believe,
was part of the original motivation for differentiating properties from userProperties)
2. Its nice to be able to specify defaults for properties that would apply unless overridden
3. Properties should be immutable within a given buildfile
4. It is desireable (especially in light of #3) to be able to control which properties are passed on to sub-builds and which are not.
5. We don't want to introduce radically different behavior, at least not until Ant2
I believe there are some proposals floating around for a new "Preferences" facility in Ant 2
that might address the "defaults" issue (point 2 above).
The last I remember, some consensus was building around a possible approach that would provide at least a
partial solution for Ant 1.X, while preserving compatibility -- namely: the ability to choose whether all properties
are passed to sub-builds or not.
What about the following: a new attribute for the <ant> task called "inheritAll."
The attribute defaults to "true," which preserves current behavior.
If "false," the only properties passed along to the sub-build are userProperties and properties specified in the actual <ant> call.
While this is certainly not a comprehensive solution, it incurs minimal breakage, requires about 5 lines of code to implement :-),
and solves my problem nicely.
Incidentally, it almost seems as if the above behavior (the "false" case) was the original intent of the code-- notice the cryptic comment on line 152 of Ant.java:
// set user-define properties
Did the original coder (duncan?) really intend the next line to read:
Hashtable prop1 = project.getProperties();
as it stands today, or rather:
Hashtable prop1 = project.getUserProperties();
which more closely matches the comment....?
Curious, indeed!
--Craeg
--
Craeg K. Strong | www.arielpartners.com
Ariel Partners LLC | [EMAIL PROTECTED] 85 River Street, Ste. 3A | Fax: (781) 647-9690
Waltham, MA 02453 | Voice: (781) 647-2425
