[Scons-dev] File-based build tools will never handle Java

Greg Ward greg at gerg.ca
Wed Sep 5 22:20:47 EDT 2012


OK, I finally sat down and did a little thought experiment, and have
convinced myself that file-based buld tools will never handle Java.
The reason? Dependency cycles.

Short version: in Java, cycles between source files in the same
package are commonplace and often impossible to avoid. Because
interface and implementation are in the same file, that leads to DAG
cycles, which any DAG-of-files-based build tool (make, SCons, tup,
waf, ...) will reject. (Yes, I know that SCons nodes don't have to be
files. But writing non-File Nodes is so painful that SCons might as
well have that restriction.)

Why? Because packages (directories of source files) fill much the same
role in Java that modules do in Python or C. We don't sneer at Python
code where two functions in the same module call each other, so don't
mock Java developers who put a cycle in one package. Save your mockery
for the ones who put cycles *between* packages. ;-)

Concrete example:

hg clone http://hg.gerg.ca/sample-java

and just try to build the files in cycle/ using a file-based build
tool *without* making fake nodes that represent the whole package, or
a jar file, or what-have-you.

Disclaimer: I haven't tried this yet. I wrote the code and drew the
graph, so I just *know* it won't work with make, SCons, or tup. I'm
still going to try just to prove a point, but it won't work.

--
Greg Ward http://www.gerg.ca/
Never underestimate the power of human stupidity.


More information about the Scons-dev mailing list