A build engine that uses C# as a scripting language.
The recipe for a build frequently includes a number of tools. A few utility .exes here, some .bat files there. A bit of scripting in NAnt or MSBuild. Maybe even some custom extensions to the build engine. Finally, a little continuous integration scripting to finish it all off.
Wouldn't it be neater to unify this into one tool?
Why should I need to learn yet another syntax (i.e. Nant or MSBuild)?
Why create clumsy custom language using XML when C# is more powerful then msbuild will ever be?
Imagine that you want to have a file that contains a simple timestamp. Something along the lines of:
namespace MyProject {
public class BuildInfo {
public string BuildDate = "_BUILDDATE_PLACEHOLDER_";
}
}
And you want to transform this into:
namespace MyProject {
public class BuildInfo {
public string BuildDate = "2008-10-07";
}
}
How would you update this using msbuild? My best bet is that you would need to obtain and include MSBuild community tasks and use FileUpdate task. I have no idea how to obtain a properly formatted date...
Compare this to:
string templateText = File.ReadAllText("BuildDate.cs.template");
string buildDate = DateTime.Now.ToShortDateString();
string updatedText = templateText.Replace("_BUILDDATE_PLACEHOLDER_", buildDate );
File.WriteAllText("BuildDate.cs", updatedText);
To solve some of these issues I initiated a project with the boring yet appropriate name BuildLib.
So, what is the current state of BuildLib?
- It has a name! That took me a good two hours.
- It has project page on google code.
- It has stub projects and a directory structure (heavliy influenced by JP Boodhoos post)
Since I have a 8 week old girl at home I don't expect any abundance of free time. On the other hand, she normally wakes me up at 6 in the morning so I do have an hour or two before work...
No comments:
Post a Comment