You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Joel Rees <jo...@alpsgiken.gr.jp> on 2002/04/09 09:51:02 UTC

Re: always recompiles

Stefan Bodewig suggested:


> On Mon, 8 Apr 2002, Joel Rees <jo...@alpsgiken.gr.jp> wrote:
>
> >   <property name="src" value="."/>
> >   <property name="build" value="../classes"/>
>
> I'd highly recommend location instead of value here.
>
> >     <javac
> >         srcdir="${src}/${dbdriver_loc}"
> >         destdir="${build}"
> >         debug="on"/>
>
> srcdir should be the top of the source tree, which is ${src} in your
> case.

Not sure what you mean by location instead of value, but here's what I did:

<?xml version="1.0" encoding="Shift_JIS" ?>
<project name="My_project" default="rest" basedir="src">

  <!-- set global properties for this build -->
  <property name="src" value="."/>
  <property name="build" value="../classes"/>
  <property name="dbdriver" value="jp/gr/alpsgiken/myclass/dbdriver"/>

  <target name="init">
    <!-- ?????????? -->
    <tstamp/>
    <!-- ??????????????? -->
    <mkdir dir="${build}/${dbdriver}"/>
  </target>

  <target name="dbdriver" depends="init">
    <!-- dbdriver ???????????? ${build} ?????????? -->
    <javac destdir="${build}" debug="on">
        <src path="${src}"/>
        <include name="${dbdriver}/*.java"/>
    </javac>
  </target>

  <target name="rest" depends="dbdriver">
    <!-- ??????????????? ${build} ?????????? -->
    <javac destdir="${build}" debug="on">
        <src path="${src}"/>
        <exclude name="${dbdriver}/**"/>
    </javac>
 </target>

</project>

dbdriver is "package jp.gr.alpsgiken.myclass.dbdriver". I'm in the process
of modularizing the code, and the dbdriver class was the first package to
fall out. This keeps the dependencies straight, and does not cause
unnecessary recompiling. The rest of the packages will fall out in a similar
way.

The exclude element/property was relatively intuitive to me, but include was
a little counter-intuitive, until I caught onto src/srcdir being directories
rather than files. I guess that's what you mean by location instead of
value.

Thanks, and sorry for the noise.

Joel Rees
Alps Giken Kansai Systems Develoment
Suita, Osaka




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: always recompiles

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 9 Apr 2002, Joel Rees <jo...@alpsgiken.gr.jp> wrote:
> Stefan Bodewig suggested:
> 
>> On Mon, 8 Apr 2002, Joel Rees <jo...@alpsgiken.gr.jp> wrote:
>>
>> >   <property name="src" value="."/>
>> >   <property name="build" value="../classes"/>
>>
>> I'd highly recommend location instead of value here.
>
> Not sure what you mean by location instead of value,

<property name="src"   location="."/>
<property name="build" location="../classes"/>

Ant now knows that you want the properties to point to files and that
it should resolve the file names relative to the project's basedir.
The values of the properties will be absolute pathnames.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>