I had a dream tonight:
project BuildAll default BuildAll
{
target BuildManifest
{
foreach(Line lab.dir in “manifest.txt”)
nant(“${lab.dir}/app.build”, “Build”);
}
target BuildAll
{
foreach(Folder lab.dir in “.”)
nant(“${lab.dir}/app.build”, “Build”);
}
target Clean
{
foreach(Folder lab.dir in “.”)
nant(“${lab.dir}/app.build”, “Clean”);
}
}
10 archived reader comments
Gerry Shaw (2004-07-09)
You should dream in C# instead of yet another custom lanugage.
public class BuildAll : BuildProject {
public SimpleBuild() { DefaultTarget = “BuildAll”; }
public void BuildManifest() { foreach (string path in FileHelper.ReadTextFile(“manifest.txt”)) { RunNant(path + “/app.build”, “Build”); } }
public void BuildAll() { foreach (string path in Directory.GetDirectories(Environment.CurrentDirectory)) { RunNant(path + /app.build”, “Build”); } }
public void Clean() { foreach (string path in Directory.GetDirectories(Environment.CurrentDirectory)) { RunNant(path + /app.build”, “Clean”); } } }
Barry Gervin (2004-07-09)
I’m sure MLK was a NAnt user too :)
I bet the VB programmers are feeling the curly brace/semi-colon tax :)
John Lam (2004-07-09)
Gerry, the reason why most folks still write NAnt scripts using XML is because C# is arguably an even worse syntax. Besides, they lose the nice Perl-like semantics of inline property expansion within string literals.
If you can build a nice clean language (no easy feat - and that syntax did come from a dream-like state) that generates NAnt XML on the fly, you can get some real benefit.
I’m not volunteering to write said language, but it is intriguing to me nonetheless.
ITIL Consultant (2004-07-09)
Why, on earth, are you dreaming of code???
_______________ ITIL Consultant
Gordon Weakliem (2004-07-09)
Surely either someone’s impersonating Gerry Shaw, or he relishes being ironic.
Peter Provost (2004-07-09)
I like this John. We should work out a grammar and try to make it go. Shouldn’t be too bad…
Pete McKinney (2004-07-13)
How about something like this for a C# approach. It loses some of the simplicity of the original code (especially the string construction) but stays pretty close.
[BuildProject( “BuildAll” )] public class BuildAll : BuildBase { [Target] public void BuildManifest() { foreach(Line lab in Dir(“manifest.txt”) ) nant(lab+”/app.build”, “Build”); }
[Target] public void BuildAll() { foreach(Folder lab in “.”) nant(lab+”/app.build”, “Build”); }
[Target] public void Clean() { foreach(Folder lab in “.”) nant(lab+”/app.build”, “Clean”); } }
Alex (2004-07-14)
Being both a Java and C# developer, Apache’s Maven looks attractive to me. Now I have dreams to get this on dotNet.
M. (2004-07-22)
The thing exists, actually, using the most beautifull programming language that there is:
http://rake.rubyforge.org/
A. Coward (2004-07-30)
Something similar can be found here : http://today.java.net/pub/a/today/2003/06/10/jython.html Stop dreamin’ John ! ;-)