Russel Winder's Website

Gant vs Gosling

Justin Lee has created a build tool he calls Gosling(*) which he 'announced' here. Like Justin, I believe that XML is not a good language for specifying builds and yet the Ant tasks are a massive resource for build infrastructure. This is why I created Gant

I disagree with Justin when he says Java is good for describing builds. I think a dynamic language such as Groovy, is far better than Java for describing these things. SCons, Waf and Rant have shown that using dynamic languages and creating internal DSLs is the way forward for build systems. Unlike SCons, Waf and Rant, Gant does not (currently anyway) create a complete relationship/dependency graphs. Currently, Gant is a way of scripting Ant (and other, e.g. Ivy) tasks using Groovy, bringing in the power of using a general- purpose, dynamic programming language.

Justin presents a part of his build system for Gosling as:

@Default @Description("Builds the Gosling project") public void build() { new Javac(this, BUILD_DIR) .addSources(new FileSet("src/java") .addInclude("/*.java")) .addOption("-Xlint:unchecked") .addOption("-Xlint:deprecated") .addOption("-g") .execute(); new Copy(this) .setDestDir(new File(BUILD_DIR)) .addFileSet(new FileSet(JAVA_SRC_DIR) .addExclude("/*.java")) .execute(); }

Using Gant, this looks something like:

task ( build : 'Builds the Gosling project' ) { Ant.javac ( srcdir : 'src/java' , destdir : 'build' ) { compilerarg ( line : '-Xlint:unchecked -Xlint:deprecated -g' ) } } task ( 'default' : '' ) { build ( ) }

I feel that the power of Groovy's AntBuilder, and its harmony with the Ant XML labelling, makes Gant the tool of choice. Certainly I use it for builds where I would previously have used Ant. But then I would, wouldn't I.

(*) Even though Justin claims the original of the name Gosling is not derived from James Gosling's surname, it is a master stroke of publicity to use it. I hope the connection was intentional and not an accident.

Copyright © 2017 Russel Winder -