ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craeg K Strong <cstr...@arielpartners.com>
Subject Alternatives to <if> task [was: Re: Anyone working on ant tasks for Oracle 9i App Svr (formerly Orion)?]
Date Wed, 04 Jul 2001 19:06:52 GMT
Diane Holt wrote:

>Can't help you out with the Oracle stuff, but as to your "Also" -- I'm not
>against having an <if> task (or a more generalized <condition> task), but
>your example case doesn't really need one. A <property file=...> won't
>complain if the file doesn't exist, so if you want to allow for a user's
>properties file to set the values, or use default values if the user
>doesn't have a properties file, you can just specify both files -- eg:
>  <property file="user.properties"/>
>  <property file="default.properties"/>
>If user.properties exists and contains settings for properties that are
>also in default.properties, the values for those properties will be what
>they're set to in user.properties.
>
>...
>
>>  it would make my life much simpler in
>>the long run to have *simplistic* control tasks to just be able to load
>>one property file or another based on a property file w/o the arduous
>>creation of other tasks to do the same exact thing.
>>
If I understand the problem correctly, you are trying to load different 
sets of properties
each of which really represents (the settings to describe) a context.  A 
particular context might
represent some combination of type-of-release, which-customer, 
which-developer,
which-os-platform, etc.  

We have solved this problem by creating a task that loads properties 
from property
files based on the "path" concept.  You simply define a single property 
that indicates
the set of property files that correspond to your context.  The custom 
task reads this
property and loads in the appropriate property files.  By changing this 
single property,
you can dramatically alter build behavior.  This can be done in an 
"init" or "bootstrap"
target that all other targets depend on.

Some benefits of this approach:
- no mutable properties
- does not require templating
- only one new relatively simple task required

HTH,

--Craeg

-- 
Craeg K. Strong                               | www.arielpartners.com
Ariel Partners LLC		              | cstrong@arielpartners.com 
85 River Street, Ste. 3A                      | Fax:      (781) 647-9690
Waltham, MA 02453                             | Voice:    (781) 647-2425




Mime
View raw message