In our loadbuild we created a "wrapper" to javac (actually JavaMake) that is
called by all build.xml files. This way we can use one property to control
the behavior of the compiler in all subprojects. 

Works like that:

In the build.xml that compiles the code:
  <target name="compile" depends="init">
    <ant antfile="${include.dir}/compile.xml"/>
  </target>

In compile.xml (package-compile is the default target) - we control the
compiler flags using the global property production.load. Other variables
can be overloaded by the caller for further fine tuning:
  <!-- Set compiler flags based on kind of load -->  
  <!-- Default is true, but may be overriden          -->
  <target name="init-debug" unless="production.load">
    <property name="debug.status" value="on"/>  
    <property name="optimize.status" value="off"/>
  </target>
  
  <target name="init-release" if="production.load">
    <property name="debug.status" value="off"/>  
    <property name="optimize.status" value="on"/>
  </target>

  <!-- compiles the package source -->
  <!-- code under a test subdirectory is automatically excluded -->
  <property name="compile.src.includes" value="**/*.java"/>
  <property name="compile.src.excludes" value=""/>        
  <target name="package-compile" depends="init-debug,init-release">
    <javamake
        srcdir="${src.dir}"
        destdir="${build.dir}"
        classpathref="build.classpath"
        includeJavaRuntime="yes"
        pdbFilename="${basedir}/javamake.pdb"
        debug="${debug.status}"
        optimize="${optimize.status}"
        includes="${compile.src.includes}"
        excludes="${compile.src.excludes}" />
  </target>  

> -----Original Message-----
> From: Dominique Devienne [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 2:02 PM
> To: 'Ant Users List'
> Subject: RE: global javac debug flag
> 
> 
> No. --DD
> 
> -----Original Message-----
> From: Ilya Lipkind [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, May 13, 2002 12:57 PM
> To: Ant Users List
> Subject: global javac debug flag
> 
> Hi all,
> 
> Is there any way to specify global javac property (like 
> debug="on") that
> will be used by all of my javac tasks,
> so I don't have to specify it for each javac target.
> 
> thanks,
> - Ilya
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

Reply via email to