23
Nov 08

AlexBuild refactoring

So we're going through some major refactoring for AlexBuild. We quickly realized that the original syntax didn't have enough provisions to make Alex extensible for 3rd party plugins as well as making it easier for us to add various lifecycle strategies.

Here is what we have so far…

################################################

define project as {
 name: “some_widget”,
 version: “0.01-alpha”
}

set property src to “java/src”
set property build_dir to “target/classes”

define dependency ivy://commons-logging.commons-logging version 1.1.1 as logging for all
define dependency commons-lang.commons-lang version LATEST as lang for compile, test, package
define dependency file:///home/user/dependencies/spring-2.5.5.jar as spring-full for compile

compile java from “${src}” to “${build_dir}”
compile groovy from “groovy/src” to “target/groovy_classes”
compile resources from “resources” to “target/classes”

create jar named “CoolWidget.jar”
 from “${build_dir}” and “target/groovy_classes”
{
 manifest: “path/to/MANIFEST”,
 include: [ “**/*.class”, “**/*.xml”, “**/*.properties” ]
}

################################################

The basic idea is that each statement is implemented as an AlexPlug, which is an extensible set of interfaces that allow you to develop and extend how various statements in particular contexts are implemented.  Each AlexPlug will consume a set of parameters called AlexParams and arguments called AlexArgs.  The difference between AlexParams and AlexArgs is that AlexParams is a strongly typed set of parameters injected into the implementation of the plugin and AlexArgs is a JSON-like data structures which allows you to provide extensive loosely typed configuration for plugins.  Take a look at the "create jar" statement above.

I'm hoping to have the grammar redefined tonight with the refactoring complete sometime this week.  Once that's done, we can finally do our initial release.  I say finally because before this refactoring exercise, the code in the trunk was ready for the first alpha release, though it didn't provide any points of extensibility that didn't require tinkering with the grammar.  I believe this small delay is good and we can release the initial version with extensive extension APIs to allow for folks to write AlexPlugs.

More to come….

Leave a comment