Re: Building scala projects
Hi Harshad,
I have written a simple build tool in Scala that may interest you, but it is
brand new (no project page yet) and only tested on a couple of my own
projects. If that hasn't scared you away, here is more about it:
First, the types of projects it is useful for right now:
* Scala-only source files
* Projects with dependencies that are manually manageable (i.e., drop the jars
in the lib directory)
* Build process that goes something like: compile, test, doc, create jars
Second, some features:
* Fairly fast, unintrusive, and easy to set up for simple projects
* Configuration is just the project name + version in a two-line text file
* The default source directory layout is the same as maven's so you can always
switch to maven should you need/want to
* Regardless of what sources you have added, changed, or removed, it should
(in theory) recompile the right sources (using information extracted from
compilation with a plugin)
* Can run tests on all objects that subclass org.scalacheck.Properties
* Can generates documentation with scaladoc
* Packages jars (classes, sources, or api docs)
* Can start the Scala interpreter with the right classpath (dependencies +
compiled classes)
If this seems like something you'd be interested in, I'll write some
documentation and post the code somewhere.
-Mark
On Wednesday 01 October 2008 13:11, Harshad wrote:
> I feel pretty dumb asking this, but a lot of web-searching reveals nothing.
>
> How exactly do we build a scala project efficiently, without using maven,
> ant or an IDE?
>
> ant and maven are XML mine fields. I don't feel like looking at them (and I
> am usually game for learning something new!)
>
> IDEs are too heavy-weight for me. In all my development work, I have only
> needed vim + make. It's fast and it works.
>
> Assuming "make" is the build tool, how would I go about writing a Makefile
> for building a scala project?
>
> Scalac generates a whole lot of class files whose names are not
> (necessarily) related to the original source file name. How would I write
> dependencies? Is there a way to auto-generate the dependencies
> like "gcc -M"?
>
> One way I can think of, is to do it with a little script (instead of make):
> 1. t = timestamp of output jar
> 2. "*.scala" foreach (f => if (t < f.timestamp) scalac f)
> 3. Build output jar
>
> Is that a good approach?
>
> The maven invocation to build (for example) a /lift/ project seems to
> automatically detect the source files which have been modified. It prints
> something like:
> Compiling 3 source files...
>
> How does it manage that?
>
> Thanks,
> Harshad
>
>
>