[Scons-users] Several questions that may sound silly :)

Greg Ward greg at gerg.ca
Wed Jul 25 23:18:46 EDT 2012


On 24 July 2012, Propadovic Nenad said:

> I was told to search for a Python equivalent to Maven


I think the Python equivalent to Maven would be:

* go to the hardware store and buy a nailgun
* fire nails into your own eyes
* then punch yourself in the face a few times for good measure
* finally, write some Python code

IOW, you would have to make a serious effort to find something as
deeply unpleasant as Maven.


> #2: I see there is support for Java, but is Scons up to date with Java?

>

> Is it still a good choice as a Java build system?


SCons' built-in support for Java is a nice try, but it looks like it
was written by a C/C++ programmer who read about Java but never
actually used it. (Or at least never used it on badly organized code
like I deal with at work.) It might work for toy examples, but it's
not much good in the real world.

Some of the problems are:

* predicting the output of javac is difficult; you have to parse the
source code to guess what .class files will result from each .java
file, and that varies from compiler to compiler. SCons tries, but
I don't know how good it is.

* knowing what to recompile based on upstream changes is extremely
difficult; you would basically have to implement most of a Java
compiler (everything except code generation and optimization)
to do it right. Thus, nobody actually tries to do this.

AFAICT most Java build systems compile groups of related files
together and call it incremental. If one file in the group changes,
you recompile the whole group and (if that change affects the
bytecode) any downstream groups.

The best -- OK, only -- explanation I've seen is from the answer
to a question I posted on the Gradle support forum:

http://forums.gradle.org/gradle/topics/how_does_incremental_java_compilation_work

* Java programmers just love to create bazillions of deeply nested
packages, and SCons doesn't have a recursive file finder builtin
-- just Glob(). You have to roll your own.

* Java programmers just love to create bazillions of source files,
and SCons wants each one to be a Node. Unfortunately, SCons scales
badly when the number of nodes gets into the tens of thousands. ;-(

I recommend you take a good hard look at Gradle. It appears to be the
only Java build tool that doesn't suck, in that they have actually
thought hard about how to build large Java systems intelligently and
come up with a pretty good solution. I blatantly ripped off most of
Gradle's good ideas in the homebrew Java build system I wrote on top
of SCons. So even if you go with SCons in the end, there are good
ideas in Gradle just waiting to be stolen. ;-)

Greg
--
Greg Ward http://www.gerg.ca/
Support bacteria -- it's the only culture some people have!


More information about the Scons-users mailing list