ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Ant start on a given file
Date Tue, 09 Apr 2002 16:52:38 GMT
<javac> is not designed to work like javac.exe, finding what needs to be
recompiled automatically thanks to the -classpath and -sourcepath arguments.
With <javac>, you specify yourself all the sources to compiles (by
specifying the directory where the code lies in scrdir attribute if only
one, or with <src> sub-element if several), where to put the classes, and
ANT itself compares the dates of all the sources and corresponding classes
(if they exist), passing all the sources out-of-date to the
com.sun.tools.javac.Main (or something like that) class. ANT automatically
searches the "src" directory (recursively) for all .java files, looks in
destdir for the corresponding class, and if not there, or out-of-date, adds
it to the list of file to compile (deleting the classes too I think, but
maybe not).

It's a different philosophy. --DD

-----Original Message-----
From: comp boy [mailto:compboy80@hotmail.com] 
Sent: Tuesday, April 09, 2002 11:02 AM
To: Ant Users List
Subject: Re: Ant start on a given file

Well I have this part so far:
<target name="compileStand" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<delete dir="${build}/com"/>
<javac srcdir="${src}" destdir="${build}" >
<include name="com/nex/mwt/app/MWTApp.java" />
</javac>
</target>

When this file (com/nex/mwt/app/MWTApp.java) gets compiled I also want all
the files that this file depends on to also be compiled.

How can I do this?



----- Original Message -----
From: "Sujan Digumarti" <Sujan.Digumarti@india.techspan.com>
To: "'Ant Users List'" <ant-user@jakarta.apache.org>
Sent: Tuesday, April 09, 2002 2:48 AM
Subject: RE: Ant start on a given file


> You can create two targets in the build.xml file for this purpose and
> call them accordingly
>
> for ex:
> $ ant <target name for building applet>
> $ ant <target name for building application>
>
> For compiling only specific files or excluding specific files
> you can use the include and exclude tags with javac
> Have a look at the docs for javac
>
> Rgds,
> Sujan
>
> -----Original Message-----
> From: comp boy [mailto:compboy80@hotmail.com]
> Sent: Tuesday, April 09, 2002 9:48 AM
> To: ant-user@jakarta.apache.org
> Subject: Ant start on a given file
>
>
> I have source code directory that has files to create both an applet
version
> and a standalone application version.  Most of the src files are needed by
> both versions but some have files only necessary for one or the other.  Is
> there a tag in the build.xml file where I can specify a target and it will
> compile just a applet version (ant applet) or a standalone (ant
standalone)
> and it will start compiling at the main file for each and not compile all
> the files in the src directory.  I am new to Ant and have read through
much
> of the documentation but haven't been able to find something taht will
> satisfy my need.  I used to just run javac and the file name to do it, but
I
> decided to finally move into the 21st century and automate this process.
>
> TIA
>
> This is what I have right now:
>
> <project name="project" default="dist" basedir=".">
>
> <!-- set global properties for this build -->
>
> <property name="src" value="src"/>
> <property name="build" value="build"/>
> <property name="dist" value="dist"/>
>
> <target name="init">
> <!-- Create the time stamp -->
> <tstamp/>
>
> <!-- Create the build directory structure used by compile -->
> <mkdir dir="${build}"/>
> </target>
>
> <target name="compile" depends="init">
> <!-- Compile the java code from ${src} into ${build} -->
> <javac srcdir="${src}" destdir="${build}"/>
> </target>
>
> <target name="dist" depends="compile">
> <!-- Create the distribution directory -->
> <mkdir dir="${dist}/lib"/>
> <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
> <jar jarfile="${dist}/lib/project-${DSTAMP}.jar" basedir="${build}"/>
> </target>
>
> <target name="clean">
> <!-- Delete the ${build} and ${dist} directory trees -->
> <delete dir="${build}"/>
> <delete dir="${dist}"/>
> </target>
>
> </project>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>

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

--
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