ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Compiling from subdirs
Date Thu, 20 Jun 2002 18:40:01 GMT
I sent this to Bela privately, but thought maybe someone else might find
it useful. See:
  http://marc.theaimsgroup.com/?l=ant-dev&m=102444112702134&w=2
for what he was looking to do. (Nutshell: Compile from a subdir only those
files in the current directory on down.)

<target name="compile">
  <path id="userdir" path="${user.dir}"/>
  <pathconvert property="in.dir" pathsep="" refid="userdir">
    <map from="${basedir}${file.separator}src${file.separator}" to=""/>
  </pathconvert>
  <condition property="cur.dir" value="">
    <equals arg1="${in.dir}" arg2="${basedir}" casesensitive="no"/>
  </condition>
  <condition property="cur.dir" value="">
    <equals arg1="${in.dir}" arg2="${basedir}${file.separator}src"
            casesensitive="no"/>
  </condition>
  <property name="cur.dir" value="${in.dir}${file.separator}"/>
  <mkdir dir="classes"/>
  <javac srcdir="src" destdir="classes" includes="${cur.dir}**/*.java"/>
</target>

Note: Since there's only a top-level build file, you need to run with
Ant's -find option. You can set ANT_ARGS to include it for you instead of
having to type it every time, but be sure to include the build file name
as well, even if it's build.xml (otherwise, anything following -find will
get interpreted as the build file name [true, even when typed by hand on
the command-line, unless -find is the last arg]).

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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


Mime
View raw message