allow for raw inject of nant files to aid in building

things like build targets
afrisby
Sean Dague 2007-09-17 10:58:06 +00:00
parent 995d7cb96b
commit b25b0b2662
1 changed files with 39 additions and 2 deletions

View File

@ -490,8 +490,45 @@ public class NAntTarget : ITarget
ss.WriteLine(" </target>");
ss.WriteLine();
// sdague - make a zip target
ss.WriteLine(" <include buildfile=\".nant/local.include\" />");
// sdague - ok, this is an ugly hack, but what it lets
// us do is native include of files into the nant
// created files from all .nant/*include files. This
// lets us keep using prebuild, but allows for
// extended nant targets to do build and the like.
try {
Regex re = new Regex(".include$");
DirectoryInfo nantdir = new DirectoryInfo(".nant");
foreach (FileSystemInfo item in nantdir.GetFileSystemInfos())
{
if (item is DirectoryInfo) {}
else if (item is FileInfo)
{
if (re.Match(((FileInfo)item).FullName) !=
System.Text.RegularExpressions.Match.Empty) {
Console.WriteLine("Including file: " + ((FileInfo)item).FullName);
using (FileStream fs = new FileStream(((FileInfo)item).FullName,
FileMode.Open,
FileAccess.Read,
FileShare.None))
{
using (StreamReader sr = new StreamReader(fs))
{
ss.WriteLine("<!-- included from {0} -->", ((FileInfo)item).FullName);
while (sr.Peek() != -1) {
ss.WriteLine(sr.ReadLine());
}
ss.WriteLine();
}
}
}
}
}
} catch {}
// ss.WriteLine(" <include buildfile=\".nant/local.include\" />");
// ss.WriteLine(" <target name=\"zip\" description=\"\">");
// ss.WriteLine(" <zip zipfile=\"{0}-{1}.zip\">", solution.Name, solution.Version);
// ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");