ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: A strategy to deal with platform specific stuff?
Date Wed, 24 Sep 2003 08:55:52 GMT
You can store plattform specific properties in its own property files
and include the right one via system property "os.name".

    <!-- include plattform specifics -->
    <property file="${os.name}.properties"/>
    <!-- defaults if not set in plattform specifics -->
    <property file="os-default.properties"/>

See
  Build in properties
  http://ant.apache.org/manual/using.html#built-in-props

  System properties
 
http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#getProperties()

  Condition "OS"
  file:///C:/seu/cvs-downloads/ant/ant/docs/manual/CoreTasks/conditions.html



Jan


> -----Original Message-----
> From: Mika Moilanen [mailto:mikmoila@stybba.ntc.nokia.com]
> Sent: Wednesday, September 24, 2003 10:44 AM
> To: user@ant.apache.org
> Subject: A strategy to deal with platform specific stuff?
> 
> 
> 
> I have been figuring out the best way to organize ANT systems in
> multi-platform cases: Where to store those differences, and how to
> control them? 
> 
> A simplistic example is a property, let's say
> "application.classpath"; This needs to be different on UNIX and on
> Windows. This property is used in a target called "run_application".
> 
> Instead of setting/evaluating "application.classpath" in the body of
> "run_application" target, I've removed it out as a target of it's own:
> 
> ----------------------------------------------------------
> <target name="set_application.classpath">
>   <condition property="application.classpath" value="...">
>   .
>   .
>   .
> </target>
> ----------------------------------------------------------
> 
> ...and made "run_application" target to depend on this:
> 
> ----------------------------------------------------------
> <target name="set_application.classpath" 
> depends="set_application.classpath>
>   .
>   .
>   .
> </target>
> ----------------------------------------------------------
> 
> This "separation" of differences to a smaller targets of their own
> frees me from having one huge "init" block in my ANT system, which
> would evalluate and set all the platform specific stuff...Or is this
> "one init block wehere we set all the stuff" a common approach?
> 
> My approach creates a bit of more work since I've to think the
> dependency relationships between targets and the platform specific
> aspects they potentially use.
> 
> What do you think, it this level of "control" a madness not going to
> give any benefits after all, or are there any other users building a
> similar system?
> 
> -- 
> Best Regards, 
> 	Mika
> ----------------------------------------------------------
> mikmoila@shire.ntc.nokia.com  phone: +358-0-511-23587
> Nokia Networks, PO box 320, FIN-00045 NOKIA GROUP, Finland
> ----------------------------------------------------------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message