Good point on the strongly typed.  I had a whole hour to get my revised
WebMap done that done this morning before my real work day so I just
took the cheap approach.  Maybe I can look at it when I look at some of
the other bits I'd like to next week.  Then again, given that it is
cleanly encapsulated by the WebMap class, I may leave it alone.

-------------------------------------
Tom Cabanski, President
Objective Advantage, Inc.
http://www.oai.cc
Phone: +1-281-348-2517x15
 

-----Original Message-----
From: Gert Driesen [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 31, 2003 12:18 PM
To: Tom Cabanski

Hi Tom,

I would prefer using a strongly typed collection instead ...    You can
look
at the (NAnt.DotNet.Tasks) AssemblyInfoTask (and the collections it
uses)
for examples.

Great to have another active committer !!

Gert

----- Original Message ----- 
From: "Tom Cabanski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 31, 2003 3:44 PM
Subject: [nant-dev] Patch for fixes and new features


I've attached the diff generated by WinCVS for the NAnt.VSNet folder.  I
have also pasted it below if that is better.  I've also attached two new
files, which I added to the proper folders under the project - WebMap.cs
(types) and WebMapAttribute.cs (attributes).

Per Matthew's suggestion, the webmap is now a tag in the solution.  For
example:

<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>

Naturally, this supports any number of web projects in the solution.  I
know
the project I am working on has two right now.

Given that there are no tests, I'm not very certain that all of this
will
work in all scenarios.  I have only really tested in a scenario where I
am
building from a solution and the build order and dependencies are coming
from there.  I have tested with and without my new optional features
(webmap, outputdir, excludeprojects) with the solution scenario I
understand
well.  Next week, I can spend a bit of time writing a couple of tests
and
learning more about the ins and outs of some of the other scenarios I
suspect I do not understand as I write this.

Thanks
TFC

cvs diff (in directory C:\cvsroot\nant\src\NAnt.VSNet\)
? Attributes
? Types
? _sgvault
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 ) {
32,33c32,48
<             _strRelOutputPath = elemConfig.Attributes[
"OutputPath" ].Value;
<             _strOutputPath = new DirectoryInfo(
ps.ProjectRootDirectory +
@"\" + elemConfig.Attributes[ "OutputPath" ].Value ).FullName;
---
> _nanttask = nanttask;
> SolutionTask solutionTask = ((SolutionTask)_nanttask);
> if (solutionTask.OutputDir == null ||
solutionTask.OutputDir.Trim().Length
== 0)
> {
> _strRelOutputPath = elemConfig.Attributes[ "OutputPath" ].Value;
> _strOutputPath = new DirectoryInfo( ps.ProjectRootDirectory + @"\" +
elemConfig.Attributes[ "OutputPath" ].Value ).FullName;
> }
> else
> {
> _strRelOutputPath = solutionTask.OutputDir;
> if (!_strRelOutputPath.EndsWith(@"\"))
> {
> _strRelOutputPath = _strRelOutputPath + @"\";
> }
> _strOutputPath = Path.GetFullPath(_strRelOutputPath);
> }
>
39,43c54,66
<             if ( ( elemConfig.Attributes[ "DocumentationFile" ] !=
null )
&&
<                 ( elemConfig.Attributes[
"DocumentationFile" ].Value.Length > 0 )) {
<                 FileInfo fiDocumentation = new FileInfo(
ps.ProjectRootDirectory + @"/" + elemConfig.Attributes[
"DocumentationFile" ].Value );
<                 _strDocFilename = fiDocumentation.FullName;
<                 _alSettings.Add( @"/doc:""" + _strDocFilename + @""""
);
---
> if ( ( elemConfig.Attributes[ "DocumentationFile" ] != null ) &&
> ( elemConfig.Attributes[ "DocumentationFile" ].Value.Length > 0 ))
> {
> if (solutionTask.OutputDir == null ||
solutionTask.OutputDir.Trim().Length
== 0)
> {
> FileInfo fiDocumentation = new FileInfo( ps.ProjectRootDirectory +
@"/" +
elemConfig.Attributes[ "DocumentationFile" ].Value );
> _strDocFilename = fiDocumentation.FullName;
> }
> else
> {
> _strDocFilename =
Path.GetFullPath(Path.Combine(solutionTask.OutputDir,
elemConfig.Attributes[ "DocumentationFile" ].Value));
> }
> _alSettings.Add( @"/doc:""" + _strDocFilename + @"""" );
45,46c68,72
<                 Directory.CreateDirectory(
fiDocumentation.DirectoryName );
<             }
---
> Directory.CreateDirectory( Path.GetDirectoryName(_strDocFilename) );
> }
>
> _nanttask.Log(Level.Debug, "[solution] Project: {0} Relative Output
Path:
{1} Output Path: {2} Documentation Path: {3}",
> ps.Name, _strRelOutputPath, _strOutputPath, _strDocFilename);
52a79
> htStringSettings[ "DefineConstants" ] = @"/define:{0}";
122a150
> 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
124c124
<                 ConfigurationSettings cs = new ConfigurationSettings(
_ps,
elemConfig );
---
>                 ConfigurationSettings cs = new ConfigurationSettings(
_ps,
elemConfig, _nanttask );
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;
42a45,48
> SolutionTask solutionTask = ((SolutionTask)_nanttask);
> _strOutputDir = solutionTask.OutputDir;
> _webMap = solutionTask.WebMap;
>
60a67,69
> //Translate URLs to physical paths if using a webmap
> strProject = _webMap[strProject];
>
171,176c180,193
<             foreach ( DictionaryEntry de in _htProjectFiles ) {
<                 Project p = new Project( _nanttask, _tfc );
<                 //Console.WriteLine( "  {0}", de.Value );
<                 p.Load( this, ( string )de.Value );
<                 _htProjects[ de.Key ] = p;
<             }
---
> FileSet excludes = ((SolutionTask)_nanttask).ExcludeProjects;
> foreach ( DictionaryEntry de in _htProjectFiles )
> {
> if (!excludes.FileNames.Contains((string)de.Value))
> {
> Project p = new Project( _nanttask, _tfc );
> p.Load( this, ( string )de.Value );
> _htProjects[ de.Key ] = p;
> }
> else
> {
> _nanttask.Log(Level.Verbose, "[solution] Excluding project {0}",
(string)de.Value);
> }
> }
301a319,320
> private string _strOutputDir;
> private WebMap _webMap;
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,114c139,155
<             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);
<                 }
<                 if (!sln.Compile(_strConfiguration, new ArrayList(),
null,
Verbose, false)) {
<                     throw new BuildException("Project build failed");
<                 }
---
> 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);
> }
> else
> {
> sln = new Solution(_strSolutionFile, new
ArrayList(_fsProjects.FileNames),
new ArrayList(_fsReferenceProjects.FileNames), tfc, this);
> }
> if (!sln.Compile(_strConfiguration, new ArrayList(), null, Verbose,
false))
> {
> throw new BuildException("Project build failed");
> }
116,117c157,177
<                 System.IO.Directory.Delete( tfc.BasePath, true );
<             }
---
> basePath = tfc.BasePath;
> }
> }
> 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);
> }
> }
177,178c237,270
<         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;

***** CVS exited normally with code 1 *****







-------------------------------------------------------
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

Reply via email to