Phantom 0.2 Released

Phantom 0.2 is now available to download. A big thanks goes to Andrey Shchekin for this release who contributed the NAnt integration and the Runnable syntax.

For those not familiar with Phantom, this is a build system written in C# and Boo.

This release includes:

NAnt Integration

You can now execute NAnt tasks from within Phantom build scripts. In order for this to work, you'll need to drop Phantom.Integration.Nant.dll and NAnt.Core.dll into the same directory as Phantom.exe. Once in place, you can import the NAnt tasks. This example executes the 'echo' task which is part of NAnt.Core.dll:

import tasks from NAnt.Core
target default:
   echo(message : "Hello from NAnt!")

Runnables

With v0.1 of Phantom, a lot of options were passed to helper methods via Hashes. For example, if you wanted tell msbuild to compile a project with a particular configuration and verbosity, you'd have to do the following:

msbuild("foo.sln", { "configuration": "release", "verbosity": "normal" })

With Phantom 0.2, most of these methods have been converted to classes that define regular properties. You can use Boo's object initializer syntax they can still be declared on one line:

msbuild(file: "foo.sln", configuration: "release", verbosity: "normal")

This is called a 'runnable' as the msbuild class implements the IRunnable interface. When Phantom sees an instance of an IRunnable type being created, it will automatically call the 'Run' method (in this case, to kick off MSbuild). This syntax is equivalent to the following:

m = msbuild()
m.file = "foo.sln"
m.configuration = "release"
m.verbosity = "normal"
m.Run()

Runnables can also be used inside a with block:

with msbuild():
  .file = "foo.sln"
  .verbosity = "normal"
  .configuration = "release"

...and the 'Run' method will automatically be called at the end of the block. This is particularly useful if you have lots of properties that you want to set that cannot all fit on one line.

Improved FileList support

The 0.1 version of FileLists were rather limited. With 0.2 they now support exclusion patterns as well as recursively copying subdirectories:

with FileList("path/to/bin/debug"):
  .Include("**/*")
  .ForEach def(file):
    file.CopyToDirectory("directoryToPackage")

NCover Integration

Phantom 0.2 now includes runnables for executing NCover and NCoverExplorer. At present, these only work with the free Community Edition of NCover.

Written on December 30, 2009