Automating Builds For Visage Projects

22 views
Skip to first unread message

Nick Apperley

unread,
Nov 29, 2011, 7:37:53 PM11/29/11
to Visage Users
Having done some builds with Visage projects I have found that
manually building a project is too tedious, slow, and error prone.
Recently I have been looking at some automated build systems. Most of
these systems rely on XML which is very messy to automate builds (too
verbose) with, and is too rigid/error prone (see Freedom From XML
petition- http://steveonjava.com/freedom-from-xml/).

Found an automated build system called Buildr which is reasonably
simple to use (uses Ruby, not XML), and handles builds in a
declarative manner via a build file (Ruby like). Since Buildr has no
Visage support someone with a reasonable amount of Ruby experience
will need to extend it. What I like about Buildr is that it does
things in a similar way to Visage (without the ugly XML) which fits in
nicely despite using a different language (Ruby).

Buildr could be a good way to easily automate the building of a Visage
project for all developers without doing builds manually (no one
should ever be in this position). Interested in finding out what other
people think of Buildr, and if possible their experiences with using
it on some other projects.

Alain FAGOT BÉAREZ

unread,
Nov 30, 2011, 10:51:04 AM11/30/11
to visage...@googlegroups.com
Nick,

As nice as Buildr is SBT (Scala Build Tool), with several advantages:
- Scala is a language not that much different from Visage
- runs on the JVM (well, Buildr does too with JRuby)
- Stephen knows about it ;-)

Regards,
Alain

Nick Apperley

unread,
Nov 30, 2011, 3:20:53 PM11/30/11
to Visage Users
One key question I have with SBT is if it can automatically pick up
libraries (eg JARs) from a directory (eg lib), without specifying the
libraries manually. Buildr can do this. Since SBT is geared towards
Scala can it be adapted to build Visage projects?

I like the idea that SBT can build a project that is written in
multiple languages (seems to be restricted to Scala and Java). A few
Visage projects contain some Java code which would benefit from SBT if
it can be adapted (is it flexible?).

The biggest downside to SBT is its complexity where lots of different
operators are being used, which could mean anything and is not very
readable (it is just like Regular Expressions). A user is forced to
learn way too many operators which is rediculous. Also the examples
show an excessive amount of nesting (more difficult to troubleshoot).
Buildr certainly has an advantage over SBT with simplicity even though
Ruby is not as close to Visage as Scala is.

Nick Apperley

unread,
Nov 30, 2011, 3:26:44 PM11/30/11
to Visage Users
Alain can you show me the simplist example of a SBT script for
building a Visage project? Treat it hypothetically as though SBT has
recently added support for building Visage projects.

Nick Apperley

unread,
Dec 2, 2011, 4:50:32 PM12/2/11
to Visage Users
Below you will find a sample buildr build file (called buildfile):

=================================================
require 'buildr/visage'


define 'hello-visage' do
project.version = '0.1'
compile.with Dir['lib/*.jar']
manifest['Main-Class'] = 'org.example.Hello'
package :jar
end
=================================================

As you can see above the build file is short and simple. Although
Buildr doesn't have Visage support yet if it did then the first line
would be needed so that Buildr knows it is dealing with a Visage
project. After the first line a block is defined for the "hello-
visage" project. In the block the project version is set, and it is
packaged as a JAR file.

With project dependencies any JARs that are in the lib directory (in
the project's directory) are picked up. The "Main-Class" property is
set for the manifest. Visage source files are placed in src/main/
visage (in the project's directory), but that will only work once
Buildr has support for Visage. Calling the buildr command from the
command line (using the project's directory as the working directory)
will produce a file called hello-visage-0.1.jar in the target
directory (in the project's directory).

How would a SBT script compare to the Buildr build file shown above?

Nick Apperley

unread,
Dec 2, 2011, 7:03:49 PM12/2/11
to Visage Users
Just uploaded a 7z file containing the required files (Ruby script
files) to provide Visage support for Buildr 1.4.6 (based on the Scala
support). You can find the file called Buildr 1.4.6 - Visage.7z at the
following URL - http://sites.google.com/site/napperley/visage-files.
Do note that the support isn't complete as I need to find out which
classes and methods are used to invoke the Visage compiler to compile
some Visage source files, and display compilation errors to the
console.

I wonder what Steve Chin's plans are for versioning with Visage, and
if he look through the files providing the Visage support for Buildr.
There may be other stuff that is missing/needs to be fixed for the
Visage support. For your convenience I also have a Visage distribution
file called Visage SDK (03 Dec 2011).7z at the following URL -
http://sites.google.com/site/napperley/visage-files.

Reply all
Reply to author
Forward
0 new messages