ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject RE: Compile stops after first error.. how to avoid that?
Date Wed, 17 Jul 2002 15:01:40 GMT
--- "Hertel, Oliver" <Oliver.Hertel@Dresdner-Bank.com> wrote:
>  > > I want to rebuild the whole project and don't mind if a minor
>  > > subproject doesn't compile, but I need all the other 
>  > classes compiled.
>  > 
>  > You'd need to have separate <javac> tasks.
> 
> Any idea how to do that for 2500 files of sourcecode?

The number of source files wouldn't be the determining factor -- it'd be
how many "minor subprojects" you have.
 
> Before using ant we had a loop like this
> 
> 	for file in `find . -name *.java`
> 	do
> 	  javac [...] $file
> 	end
> 
> but that was pretty slow.

Indeed -- since you're putting them through one at a time. Ant's <javac>
uses FileSets -- ie., sets of files determined by specifying the base
directory and, optionally, which files to include/exclude from there (the
default fileset for <javac> is all .java files under 'srcdir'), which it
then hands off to the compiler en masse.

So, eg., if you had 10 different packages (or however you have things
organized), and you wanted to build them independent of each other (ie.,
you want the build to continue even if some file in one of them doesn't
compile), then you'd need to have something like:

  <target name="compile">
    <javac srcdir="${srcdir}" destdir="${destdir}" failonerror="${foe}">
      <include name="com/foo/pkg1/**"/>
    </javac>
    <javac srcdir="${srcdir}" destdir="${destdir}" failonerror="${foe}">
      <include name="com/foo/pkg2/**"/>
    </javac>
     ...
  </target>

If you want to try to nest them all under <parallel>, keep this excerpt
from the doc in mind:
  Care must be taken when using multithreading to ensure the tasks
  within the threads do not interact. For example, two javac compile
  tasks which write classes into the same destination directory may
  interact where one tries to read a class for dependency information
  while the other task is writing the class file. Be sure to avoid
  these types of interactions within a <parallel> task.

Diane

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



__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.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