ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Kramer <Douglas.Kra...@Sun.COM>
Subject Re: AW: ant property
Date Fri, 25 Feb 2005 21:50:56 GMT
James Fuller wrote:
> Douglas Kramer wrote:
> 
>> I'd like to set up my Ant script to load one set of paths
>> if I'm building on one machine and a different set of
>> paths when building on a another machine.
>>
> this can be achieved in a variety of ways;

Good, thanks.

>> In build.properties I have:
>>
>> run.classpath.javadoc="${JAVA_HOME}/lib/tools.jar"
>> run.classpath.mifdoclet="${WORKDIR}/build/jar/mifdoclet.jar"
>>
>> My script is:
>>
>>       <exec dir="${sample}/example-bookfile" executable="java">
>>          <arg line="-classpath 
>> ${run.classpath.mifdoclet}:${run.classpath.javadoc}" />
>>          <arg line="-Xmx20M" />
>>          <arg line="com.sun.tools.javadoc.Main" />
>>          <arg line="-doclet 
>> com.sun.tools.doclets.formats.mif.MIFDoclet" />
>>          <arg line="-book book-solaris.xml" />
>>          <arg line="-group 'Summary of Sample Packages' 'com.*'" />
>>          <arg line="-sourcepath ../sample-src com.package1 
>> com.package1.subpackage com.package2" />
>>       </exec>
>>
> hmmm, may I suggest using the <java/> task instead of exec ?

Wish I could, but my application (MIF Doclet) currently overrides
classes in tools.jar, so that's not an option.  I must be able
to set the classpath to MIFDoclet.class ahead of tools.jar
(which is ${run.classpath.javadoc}).  Later, once the changes
are integrated into tools.jar, I will be able to use <java/>.

>        <java classname="com.sun.tools.javadoc.Main"
>           fork="true"
>           failonerror="true"
>           maxmemory="128m"
>           >
>         <arg line="-doclet com.sun.tools.doclets.formats.mif.MIFDoclet" />
>         <arg line="-book book-solaris.xml" />
>         <arg line="-group 'Summary of Sample Packages' 'com.*'" />
>         <arg line="-sourcepath ../sample-src com.package1 
> com.package1.subpackage com.package2" />
>         <classpath>
>           <pathelement location="${run.classpath.mifdoclet}"/>
>           <pathelement location="${run.classpath.javadoc}"/>
>         </classpath>
>       </java>
> 
> I assume that the things that are changing are your classpaths?

Yes.

> you know you can define reusable classpaths
> 
>         <path id="myclasspath">
>           <pathelement location="${run.classpath.mifdoclet}"/>
>           <pathelement location="${run.classpath.javadoc}"/>
>         </path>

Yes (however using properties seems to fail for me, but that's
another story)

> which can then be refered to by <java/> classpathref attribute
> 
>        <java classname="com.sun.tools.javadoc.Main"
>           fork="true"
>           failonerror="true"
>           maxmemory="128m"
>        classpathref="myclasspath"

This is fine.  I want it to automatically detect which
machine it's on and switch classpaths without any human intervention.

>           >
>         <arg line="-doclet com.sun.tools.doclets.formats.mif.MIFDoclet" />
>         <arg line="-book book-solaris.xml" />
>         <arg line="-group 'Summary of Sample Packages' 'com.*'" />
>         <arg line="-sourcepath ../sample-src com.package1 
> com.package1.subpackage com.package2" />
>       </java> 
>>
>> user.home      User's home directory
>> user.dir     User's current working directory
>>  
>> How would I set up the condition, please?
> 
> 
> not sure exactly what you want....have u seen <condition/> ? you know 
> you could just supply different property files...

That's fine as long as no manual intervention is required for the
switch.  That might be the cleanest -- if an alternate properties
file is present, use it, otherwise, use the default propert

   <if>
      // alternate.properties exists
      <then>
         <import file="alternate.properties">
      </then>
      <else>
         <import file="build.properties">
    </if>

> gl, Jim Fuller
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message