Hi Tom, I'll look into committing your patch later today.
I'll probable change your WebMap class to be a strongly typed collection, and remove your WebMapAttribute class as I don't see any added value in that. Keep the patches coming !! Gert ----- Original Message ----- From: "Tom Cabanski" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 13, 2003 11:47 PM Subject: [nant-dev] Contributing I've cleaned up a variety of little bugs in the solution task as follows: Leaks temp files under some circumstances (e.g. read-only files cannot be deleted). Fixed. Define settings are not read from project file (e.g. TRACE;DEBUG). Fixed. Resource compiles blow up under some circumstances because of changes to the ResGen task. Fixed. I've also added a couple new features because the WebDAV thing was such a pain. The Solution task now includes the following attributes: webmap(optional): A fileset that maps the URL of web projects to the physical path. <solution ...> <webmap> <map url="http://localhost/a/a.csproj path="c:\inetpub\wwwroot\a\a.csproj"/> <map url="http://localhost/b/b.csproj path="c:\inetpub\wwwroot\b\b.csproj"/> </webmap> </solution> Outputdir(optional): The name of the path where output DLLs and EXEs will be placed. This overrides settings from the project file. excludeprojects (fileset) (optional): Projects that will not be built. I added this because when building from a solution it does not honor the Build|Configuration Manager settings for the configuration. I checked the .csproj and .sln files for these settings but they aren't there. I guess they are buried in the .suo or .user files. Anyway, my project has a bunch of sample applications that we only want to build as part of the release and this was a handy way to set it all up. Per my email exchange with Ian, I have cleaned up my braces and changed tabs into 4 spaces. Note that the existing files did not follow the naming conventions so I cleaned up a bit of original code too (put braces on the same line as the opening keyword, got rid of explicit private declarations for member variables etc.). I'm pretty sure I caught all the ones I had in my original patch attempt. I have also eliminated the upcasts of _nanttask to SolutionTask; instead I pass the parameters of the solution task down the line as needed. This certainly makes the Solution, Project and related classes more general and possibly more reusable. Please notify me if the patch cannot be applied. We are currently having some trouble with the resource generation and how it works in some cases. As best we can tell, sometimes the resource names end up with double dots. Anyway, I want to take a look at this as soon as possible but am hesitant to do so until I am sure I am adhering to the proper standards so my code changes can make it into the official source. The bottom line here is I really don't want to maintain my own custom version of NAnt. The patch is copied inline below and is also attached as 20030813.txt. ------------------------------------- TFC cvs diff (in directory C:\cvsroot\nant\nant\src\NAnt.VSNet\) ? Attributes ? Types cvs server: Diffing . Index: ConfigurationSettings.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/ConfigurationSettings.cs,v retrieving revision 1.4 diff -r1.4 ConfigurationSettings.cs 30c30 < public ConfigurationSettings( ProjectSettings ps, XmlElement elemConfig ) { --- > public ConfigurationSettings( ProjectSettings ps, XmlElement elemConfig, Task nanttask, string outputDir ) { 32,33c32,43 < _strRelOutputPath = elemConfig.Attributes[ "OutputPath" ].Value; < _strOutputPath = new DirectoryInfo( ps.ProjectRootDirectory + @"\" + elemConfig.Attributes[ "OutputPath" ].Value ).FullName; --- > _nanttask = nanttask; > if (outputDir == null || outputDir.Trim().Length == 0) { > _strRelOutputPath = elemConfig.Attributes[ "OutputPath" ].Value; > _strOutputPath = new DirectoryInfo( ps.ProjectRootDirectory + @"\" + elemConfig.Attributes[ "OutputPath" ].Value ).FullName; > } else { > _strRelOutputPath = outputDir; > if (!_strRelOutputPath.EndsWith(@"\")) { > _strRelOutputPath = _strRelOutputPath + @"\"; > } > _strOutputPath = Path.GetFullPath(_strRelOutputPath); > } > 41,42c51,56 < FileInfo fiDocumentation = new FileInfo( ps.ProjectRootDirectory + @"/" + elemConfig.Attributes[ "DocumentationFile" ].Value ); < _strDocFilename = fiDocumentation.FullName; --- > if (outputDir == null || outputDir.Trim().Length == 0) { > FileInfo fiDocumentation = new FileInfo( ps.ProjectRootDirectory + @"/" + elemConfig.Attributes[ "DocumentationFile" ].Value ); > _strDocFilename = fiDocumentation.FullName; > } else { > _strDocFilename = Path.GetFullPath(Path.Combine(outputDir, elemConfig.Attributes[ "DocumentationFile" ].Value)); > } 45c59 < Directory.CreateDirectory( fiDocumentation.DirectoryName ); --- > Directory.CreateDirectory( Path.GetDirectoryName(_strDocFilename) ); 47a62,64 > _nanttask.Log(Level.Debug, "[solution] Project: {0} Relative Output Path: {1} Output Path: {2} Documentation Path: {3}", > ps.Name, _strRelOutputPath, _strOutputPath, _strDocFilename); > 52a70 > htStringSettings[ "DefineConstants" ] = @"/define:{0}"; 122a141 > Task _nanttask; Index: NAnt.VSNet.csproj =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/NAnt.VSNet.csproj,v retrieving revision 1.4 diff -r1.4 NAnt.VSNet.csproj 4,5c4,5 < ProductVersion = "7.0.9466" < SchemaVersion = "1.0" --- > ProductVersion = "7.10.3077" > SchemaVersion = "2.0" 18a19,20 > PreBuildEvent = "" > PostBuildEvent = "" 19a22 > RunPostBuildEvent = "OnBuildSuccess" 32a36,37 > NoStdLib = "false" > NoWarn = "" 50a56,57 > NoStdLib = "false" > NoWarn = "" 90a98,102 > <Reference > Name = "System.Data" > AssemblyName = "System.Data" > HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" > /> 96a109 > SubType = "Code" 101a115 > SubType = "Code" 109,112c123,126 < <File < RelPath = "NAnt.VSNet.build" < BuildAction = "None" < /> --- > <File > RelPath = "NAnt.VSNet.build" > BuildAction = "None" > /> 138a153,162 > RelPath = "WebDavClient.cs" > SubType = "Code" > BuildAction = "Compile" > /> > <File > RelPath = "Attributes\WebMapAttribute.cs" > SubType = "Code" > BuildAction = "Compile" > /> > <File 144c168 < RelPath = "WebDavClient.cs" --- > RelPath = "Types\WebMap.cs" Index: Project.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/Project.cs,v retrieving revision 1.9 diff -r1.9 Project.cs 40c40 < public Project(Task nanttask, TempFileCollection tfc) { --- > public Project(Task nanttask, TempFileCollection tfc, string outputDir) { 47a48 > _strOutputDir = outputDir; 124c125 < ConfigurationSettings cs = new ConfigurationSettings( _ps, elemConfig ); --- > ConfigurationSettings cs = new ConfigurationSettings( _ps, elemConfig, _nanttask, _strOutputDir ); 130c131 < Reference reference = new Reference( sln, _ps, elemReference, _nanttask ); --- > Reference reference = new Reference( sln, _ps, elemReference, _nanttask, _strOutputDir ); 426,438c427,440 < private Hashtable _htConfigurations; < private Hashtable _htReferences; < private Hashtable _htFiles; < private Hashtable _htResources; < private Hashtable _htAssemblies; < private string _strImports; < private Task _nanttask; < private bool _bWebProject; < < private string _strProjectDirectory; < private string _strWebProjectBaseUrl; < private ProjectSettings _ps; < private TempFileCollection _tfc; --- > Hashtable _htConfigurations; > Hashtable _htReferences; > Hashtable _htFiles; > Hashtable _htResources; > Hashtable _htAssemblies; > string _strImports; > Task _nanttask; > bool _bWebProject; > > string _strProjectDirectory; > string _strWebProjectBaseUrl; > ProjectSettings _ps; > TempFileCollection _tfc; > string _strOutputDir; Index: Reference.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/Reference.cs,v retrieving revision 1.8 diff -r1.8 Reference.cs 34c34 < public Reference( Solution sln, ProjectSettings ps, XmlElement elemReference, Task nanttask ) { --- > public Reference( Solution sln, ProjectSettings ps, XmlElement elemReference, Task nanttask, string outputDir ) { 48c48 < Project p = new Project( _nanttask, ps.TemporaryFiles ); --- > Project p = new Project( _nanttask, ps.TemporaryFiles, outputDir ); Index: Resource.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/Resource.cs,v retrieving revision 1.10 diff -r1.10 Resource.cs 223a224,226 > _nanttask.Project.Indent(); > _nanttask.Log(Level.Verbose, "[solution] ResGenTask Input: {0} Output: {1}", strInFile, strOutFile); > _nanttask.Project.Unindent(); 226c229,230 < rt.Output = strOutFile; --- > rt.Output = Path.GetFileName(strOutFile); > rt.ToDirectory = Path.GetDirectoryName(strOutFile); Index: Solution.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/Solution.cs,v retrieving revision 1.6 diff -r1.6 Solution.cs 25a26,27 > using NAnt.Core.Types; > using NAnt.VSNet.Types; 32c34,35 < public Solution( string strSolutionFilename, ArrayList alAdditionalProjects, ArrayList alReferenceProjects, TempFileCollection tfc, Task nanttask ) { --- > public Solution( string strSolutionFilename, ArrayList alAdditionalProjects, ArrayList alReferenceProjects, TempFileCollection tfc, Task nanttask, > WebMap webMap, FileSet excludesProjects, string strOutputDir) { 41a45,48 > _strOutputDir = strOutputDir; > _excludesProjects = excludesProjects; > _webMap = webMap; > 60a68,70 > //Translate URLs to physical paths if using a webmap > strProject = _webMap[strProject]; > 62c72 < if ( uri.Scheme == Uri.UriSchemeFile ) --- > if ( uri.Scheme == Uri.UriSchemeFile ) { 64c74 < else --- > } else { 65a76 > } 71c82 < if ( Project.IsEnterpriseTemplateProject( strFullPath ) ) --- > if ( Project.IsEnterpriseTemplateProject( strFullPath ) ) { 73c84 < else --- > } else { 74a86 > } 112c124,125 < public Solution( ArrayList alProjects, ArrayList alReferenceProjects, TempFileCollection tfc, Task nanttask ) { --- > public Solution( ArrayList alProjects, ArrayList alReferenceProjects, TempFileCollection tfc, Task nanttask, > WebMap webMap, FileSet excludesProjects, string strOutputDir) { 120a134,135 > _excludesProjects = excludesProjects; > _webMap = webMap; 170a186 > FileSet excludes = ((SolutionTask)_nanttask).ExcludeProjects; 172,175c188,194 < Project p = new Project( _nanttask, _tfc ); < //Console.WriteLine( " {0}", de.Value ); < p.Load( this, ( string )de.Value ); < _htProjects[ de.Key ] = p; --- > if (!excludes.FileNames.Contains((string)de.Value)) { > Project p = new Project( _nanttask, _tfc, _strOutputDir ); > p.Load( this, ( string )de.Value ); > _htProjects[ de.Key ] = p; > } else { > _nanttask.Log(Level.Verbose, "[solution] Excluding project {0}", (string)de.Value); > } 293,301c312,323 < private string _strFilename; < private Hashtable _htProjectFiles; < private Hashtable _htProjects; < private Hashtable _htProjectDirectories; < private Hashtable _htProjectDependencies; < private Hashtable _htOutputFiles; < private Hashtable _htReferenceProjects; < private Task _nanttask; < private TempFileCollection _tfc; --- > string _strFilename; > Hashtable _htProjectFiles; > Hashtable _htProjects; > Hashtable _htProjectDirectories; > Hashtable _htProjectDependencies; > Hashtable _htOutputFiles; > Hashtable _htReferenceProjects; > Task _nanttask; > WebMap _webMap; > FileSet _excludesProjects; > string _strOutputDir; > TempFileCollection _tfc; cvs server: Diffing Tasks Index: Tasks/SolutionTask.cs =================================================================== RCS file: /cvsroot/nant/nant/src/NAnt.VSNet/Tasks/SolutionTask.cs,v retrieving revision 1.7 diff -r1.7 SolutionTask.cs 22a23 > using System.IO; 26a28,29 > using NAnt.VSNet.Types; > using NAnt.VSNet.Attributes; 80a84,111 > /// <para>Compiles all of the projects in the solution except for project A.</para> > /// <code> > /// <![CDATA[ > /// <solution solutionfile="test.sln" configuration="release"> > /// <excludeprojects> > /// <includes name="A\A.csproj" /> > /// </excludeprojects> > /// </solution> > /// ]]> > /// </code> > /// <para>Compiles all of the projects in the solution mapping the project at > /// http://localhost/A/A.csproj to c:\inetpub\wwwroot\A\A.csproj. This allows > /// the build to work without WebDAV.</para> > /// <code> > /// <![CDATA[ > /// <solution solutionfile="test.sln" configuration="release"> > /// <webmap> > /// <map url="http://localhost/A/A.csproj c:\inetpub\wwwroot\A\A.csproj" /> > /// </webmap> > /// </solution> > /// ]]> > /// </code> > /// <para>Compiles all of the projects in the solution placing compiled outputs in c:\temp.</para> > /// <code> > /// <![CDATA[ > /// <solution solutionfile="test.sln" configuration="release" outputdir="c:\temp"/> > /// ]]> > /// </code> 87a119,120 > _fsExcludeProjects = new FileSet(); > _webMap = new WebMap(); 106,110c139,153 < using (TempFileCollection tfc = new TempFileCollection()) { < if (_strSolutionFile == null) { < sln = new Solution(new ArrayList(_fsProjects.FileNames), new ArrayList(_fsReferenceProjects.FileNames), tfc, this); < } else { < sln = new Solution(_strSolutionFile, new ArrayList(_fsProjects.FileNames), new ArrayList(_fsReferenceProjects.FileNames), tfc, this); --- > string basePath = null; > try { > using (TempFileCollection tfc = new TempFileCollection()) { > if (_strSolutionFile == null) { > sln = new Solution(new ArrayList(_fsProjects.FileNames), new ArrayList(_fsReferenceProjects.FileNames), tfc, > this, WebMap, ExcludeProjects, OutputDir); > } else { > sln = new Solution(_strSolutionFile, new ArrayList(_fsProjects.FileNames), > new ArrayList(_fsReferenceProjects.FileNames), tfc, this, WebMap, ExcludeProjects, OutputDir); > } > if (!sln.Compile(_strConfiguration, new ArrayList(), null, Verbose, false)) { > throw new BuildException("Project build failed"); > } > > basePath = tfc.BasePath; 112,113c155,166 < if (!sln.Compile(_strConfiguration, new ArrayList(), null, Verbose, false)) { < throw new BuildException("Project build failed"); --- > } finally { > if (basePath != null) { > Log(Level.Debug, "[solution] Cleaning up temp folder {0}", basePath); > //force all files that have other than normal attributes, set to normal attribute to allow deletion > DirectoryInfo di = new DirectoryInfo(basePath); > foreach (FileInfo info in di.GetFiles("*.*")) { > if (info.Attributes != FileAttributes.Normal) { > Log(Level.Debug, "[solution] File {0} has other than normal attributes. Fixing", info.FullName); > File.SetAttributes(info.FullName, FileAttributes.Normal); > } > } > System.IO.Directory.Delete(basePath, true); 115,116d167 < < System.IO.Directory.Delete( tfc.BasePath, true ); 177,178c228,261 < string _strSolutionFile, _strConfiguration; < FileSet _fsProjects, _fsReferenceProjects; --- > /// <summary> > /// The directory where compiled targets will be placed. This > /// overrides path settings contained in the solution/project. > /// </summary> > [TaskAttribute("outputdir", Required=false)] > public string OutputDir > { > set { _strOutputDir = value; } > get { return _strOutputDir; } > } > > /// <summary> > /// WebMap of URL to project references. > /// </summary> > [WebMap("webmap", Required=false)] > public WebMap WebMap > { > get { return _webMap; } > set { _webMap = value; } > } > > /// <summary> > /// Fileset of projects to exclude. > /// </summary> > [FileSet("excludeprojects", Required=false)] > public FileSet ExcludeProjects > { > get { return _fsExcludeProjects; } > set { _fsExcludeProjects = value; } > } > > string _strSolutionFile, _strConfiguration, _strOutputDir; > FileSet _fsProjects, _fsReferenceProjects, _fsExcludeProjects; > WebMap _webMap; ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers