From b25b0b2662f40db9c4a8e832e41cda6d899027ee Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 17 Sep 2007 10:58:06 +0000 Subject: allow for raw inject of nant files to aid in building things like build targets --- Prebuild/src/Core/Targets/NAntTarget.cs | 41 +++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'Prebuild') diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 0ec2470..e9870db 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs @@ -490,8 +490,45 @@ public class NAntTarget : ITarget ss.WriteLine(" "); ss.WriteLine(); - // sdague - make a zip target - ss.WriteLine(" "); + + + // 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("", ((FileInfo)item).FullName); + while (sr.Peek() != -1) { + ss.WriteLine(sr.ReadLine()); + } + ss.WriteLine(); + } + } + } + } + } + } catch {} + // ss.WriteLine(" "); // ss.WriteLine(" "); // ss.WriteLine(" ", solution.Name, solution.Version); // ss.WriteLine(" "); -- cgit v1.1