Psake: new PowerShell based build tool for .NET

Psake: new PowerShell based build tool for .NET

(image taken from mx5tx’s photostream)
The news is pretty much what the title says: A guy called James Kovacs has implemented an experimental make clone in under 200 lines of PowerShell. You might think that it’s another doomed build tool. Personally I think this one might have legs. Only time will tell. But I think it’s interesting for two reasons: PowerShell itself, and the approach.

Rake: The approach of implementing a build tool in your favorite dynamic language by using blocks or closures was demonstrated by Jim Weirich, the author of Rake. The first working prototype took Jim about an hour:

… would need to register the tasks, you need some way of specifying dependencies between tasks, and some way of kicking off the process. Hey! What if we did … and fifteen minutes later I had a working prototype of Ruby make, complete with dependencies and actions.

(from the Rake documentation)

Compare that to writing an XML based tool like NAnt: parsing the XML based build file is enough work, let alone implementing anything else like dependency resolution. Psake in it’s present form is under 200 lines of code, and my Ruby 1.8 install of Rake has about 1300 lines of code, with a bunch of new tasks:

Fox:/usr/lib/ruby/site_ruby/1.8/rake jsimpson$ find . -type f -exec cat {} ; | wc -l
1271
Fox:/usr/lib/ruby/site_ruby/1.8/rake jsimpson$

NAnt, by comparison has considerably more. Just one of the files that deals with parsing XML, without tasks is bigger than Rake:

Fox:~/Desktop/nant-0.85/src/NAnt.Core jsimpson$ wc -l Element.cs
1683 Element.cs

Now: size isn’t everything, and this post isn’t a NAnt bashing post. I’m just trying to illustrate one of the reasons why I think that this tool might go places: it’s a very elegant and simple approach that relies on someone else having done 5 years or so of development.

There could be some merit in exposing NAnt or MSBuild tasks in Rake via Iron Ruby. But someone who already uses PowerShell will probably head in that direction.

PowerShell:

Disney and Apple/Microsoft are in the same business: short-circuiting laborious, explicit verbal communication with expensively designed interfaces.

(Neal Stevenson, In the Beginning was the Command Line)

Does anybody else think it’s interesting that the other Disneyland of operating systems is slowly making everything scriptable? There’s a growing number of Windows applications that you can manage, (interactively or not) from PowerShell. Which could be a huge step above the polyglot of C#, VB, and batch files that people seem to use right now. If PowerShell gains enough ground, it might not make Windows administration so damn hard.

Anyway: check out Psake (and no, it doesn’t rhyme with ‘make’).

Link (via email from Ian Cooper)

Tagged
%d bloggers like this: