- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Building Scala Projects with Ant
Tue, 2009-03-24, 17:29
Hi,
Is it recommended (or required) that Ant scripts that build Scala
projects remove all the .class files every time and re-build from
scratch?
I ask because that's what the build.xml file generated by IDEA does.
Randall Schulz
Tue, 2009-03-24, 18:07
#2
Re: Building Scala Projects with Ant
On Tuesday March 24 2009, Jim Miller wrote:
> There's no need for this because the scalac task will filter out
> files that have up to date class files (just like the javac task). I
> never do a clean between builds as it significantly slows down
> compilation times.
OK. I'll take out the dependency on the clean target.
> On Tue, Mar 24, 2009 at 12:29 PM, Randall R Schulz wrote:
> > Hi,
> >
> > Is it recommended (or required) that Ant scripts that build Scala
> > projects remove all the .class files every time and re-build from
> > scratch?
> >
> > I ask because that's what the build.xml file generated by IDEA
> > does.
Randall Schulz
Tue, 2009-03-24, 18:17
#3
Re: Building Scala Projects with Ant
The reason for deleting class files is that class files are not removed from
the output directory when the corresponding class in the source is removed or
renamed.
-Mark
On Tuesday 24 March 2009, Jim Miller wrote:
> There's no need for this because the scalac task will filter out files
> that have up to date class files (just like the javac task). I never
> do a clean between builds as it significantly slows down compilation
> times.
>
> On Tue, Mar 24, 2009 at 12:29 PM, Randall R Schulz
wrote:
> > Hi,
> >
> > Is it recommended (or required) that Ant scripts that build Scala
> > projects remove all the .class files every time and re-build from
> > scratch?
> >
> > I ask because that's what the build.xml file generated by IDEA does.
> >
> >
> > Randall Schulz
Tue, 2009-03-24, 18:57
#4
Re: Building Scala Projects with Ant
On Tuesday March 24 2009, Mark Harrah wrote:
> The reason for deleting class files is that class files are not
> removed from the output directory when the corresponding class in the
> source is removed or renamed.
That's unfortunate. Given that only the compiler knows about
which .class files a given collection of source code yields, shouldn't
it do this itself? Otherwise the wasteful practice of compiling from
scratch every time is forced upon us.
Randall Schulz
Tue, 2009-03-24, 18:57
#5
Re: Building Scala Projects with Ant
That would make it considerably more annoying to compile two source
trees into one directory in two invocations of the compiler, say, for
src/scala and src/java, or for src/main and src/test (compiling
src/main before src/test ensures main doesn't accidentally depend on
test).
2009/3/24 Randall R Schulz :
> On Tuesday March 24 2009, Mark Harrah wrote:
>> The reason for deleting class files is that class files are not
>> removed from the output directory when the corresponding class in the
>> source is removed or renamed.
>
> That's unfortunate. Given that only the compiler knows about
> which .class files a given collection of source code yields, shouldn't
> it do this itself? Otherwise the wasteful practice of compiling from
> scratch every time is forced upon us.
>
>
> Randall Schulz
>
Tue, 2009-03-24, 19:17
#6
Re: Building Scala Projects with Ant
When building with Ant, its not the compiler that's determining what
class files are out of date, its Ant. If you run with the -verbose
flag (or maybe the -debug) you'll see Ant determining which files are
out of date and eliminating them from the build.
On Tue, Mar 24, 2009 at 1:46 PM, Randall R Schulz wrote:
> On Tuesday March 24 2009, Mark Harrah wrote:
>> The reason for deleting class files is that class files are not
>> removed from the output directory when the corresponding class in the
>> source is removed or renamed.
>
> That's unfortunate. Given that only the compiler knows about
> which .class files a given collection of source code yields, shouldn't
> it do this itself? Otherwise the wasteful practice of compiling from
> scratch every time is forced upon us.
>
>
> Randall Schulz
>
Tue, 2009-03-24, 19:47
#7
Re: Building Scala Projects with Ant
Jim Miller wrote:
> When building with Ant, its not the compiler that's determining what
> class files are out of date, its Ant. If you run with the -verbose
> flag (or maybe the -debug) you'll see Ant determining which files are
> out of date and eliminating them from the build.
And it does a terrible job at that, since it has no way to get at
reliable dependency information, see for example
https://lampsvn.epfl.ch/trac/scala/ticket/354
- Florian.
Tue, 2009-03-24, 21:27
#8
Re: Building Scala Projects with Ant
This is one of the main reasons I wrote sbt, which handles this kind of thing:
http://code.google.com/p/simple-build-tool/
Things should improve for Scala users in general with David's dependency
analysis in the compiler itself.
-Mark
On Tuesday 24 March 2009, Randall R Schulz wrote:
> On Tuesday March 24 2009, Mark Harrah wrote:
> > The reason for deleting class files is that class files are not
> > removed from the output directory when the corresponding class in the
> > source is removed or renamed.
>
> That's unfortunate. Given that only the compiler knows about
> which .class files a given collection of source code yields, shouldn't
> it do this itself? Otherwise the wasteful practice of compiling from
> scratch every time is forced upon us.
>
>
> Randall Schulz
There's no need for this because the scalac task will filter out files
that have up to date class files (just like the javac task). I never
do a clean between builds as it significantly slows down compilation
times.
On Tue, Mar 24, 2009 at 12:29 PM, Randall R Schulz wrote:
> Hi,
>
> Is it recommended (or required) that Ant scripts that build Scala
> projects remove all the .class files every time and re-build from
> scratch?
>
> I ask because that's what the build.xml file generated by IDEA does.
>
>
> Randall Schulz
>