* fixed 'path' reference attribute for Nant and VS2008 targets.

0.6.3-post-fixes
lbsa71 2009-02-17 16:15:29 +00:00
parent 46fd31346d
commit 55d89b73ed
3 changed files with 107 additions and 75 deletions

View File

@ -94,42 +94,45 @@ namespace Prebuild.Core.Targets
string ret = ""; string ret = "";
string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path;
if (solution.ProjectsTable.ContainsKey(refr.Name)) if (String.IsNullOrEmpty(refr.Path))
{ {
ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; if (solution.ProjectsTable.ContainsKey(refr.Name))
string finalPath = Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); {
return finalPath; ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name];
string finalPath =
Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/');
return finalPath;
}
else
{
ProjectNode project = (ProjectNode) refr.Parent;
// Do we have an explicit file reference?
string fileRef = FindFileReference(refr.Name, project);
if (fileRef != null)
{
return fileRef;
}
// Is there an explicit path in the project ref?
if (refr.Path != null)
{
return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
}
// Is it a specified extension (dll or exe?)
if (ExtensionSpecified(refr.Name))
{
return Helper.NormalizePath(referencePath + GetRefFileName(refr.Name), '/');
}
// No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
return refr.Name + ".dll";
}
} }
else else
{ {
if (refr.Name == "Pootface.exe") return refr.Path;
{
Console.WriteLine("Poot!");
}
ProjectNode project = (ProjectNode) refr.Parent;
// Do we have an explicit file reference?
string fileRef = FindFileReference(refr.Name, project);
if( fileRef != null )
{
return fileRef;
}
// Is there an explicit path in the project ref?
if (refr.Path != null)
{
return Helper.NormalizePath( refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
}
// Is it a specified extension (dll or exe?)
if (ExtensionSpecified(refr.Name))
{
return Helper.NormalizePath( referencePath + GetRefFileName(refr.Name), '/');
}
// No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
return refr.Name + ".dll";
} }
} }
@ -160,47 +163,54 @@ namespace Prebuild.Core.Targets
return extension; return extension;
} }
private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) //private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
{ //{
string ret = ""; // string ret = "";
if (solution.ProjectsTable.ContainsKey(refr.Name)) // if (solution.ProjectsTable.ContainsKey(refr.Name))
{ // {
ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; // ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); // string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
return finalPath; // return finalPath;
} // }
else // else
{ // {
ProjectNode project = (ProjectNode)refr.Parent; // if (refr.Path == null)
string fileRef = FindFileReference(refr.Name, project); // {
// ProjectNode project = (ProjectNode) refr.Parent;
// string fileRef = FindFileReference(refr.Name, project);
if (refr.Path != null || fileRef != null) // if (refr.Path != null || fileRef != null)
{ // {
string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; // string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
ret += finalPath; // ret += finalPath;
return ret; // return ret;
} // }
try // try
{ // {
Assembly assem = Assembly.Load(refr.Name); // Assembly assem = Assembly.Load(refr.Name);
if (assem != null) // if (assem != null)
{ // {
ret += ""; // ret += "";
} // }
else // else
{ // {
ret += ""; // ret += "";
} // }
} // }
catch (System.NullReferenceException e) // catch (System.NullReferenceException e)
{ // {
e.ToString(); // e.ToString();
ret += ""; // ret += "";
} // }
} // }
return ret; // else
} // {
// ret = refr.Path;
// }
// }
// return ret;
//}
private static string FindFileReference(string refName, ProjectNode project) private static string FindFileReference(string refName, ProjectNode project)
{ {

View File

@ -364,6 +364,21 @@ namespace Prebuild.Core.Targets
return ret; return ret;
} }
private static bool ExtensionSpecified(string refName)
{
return refName.EndsWith(".dll") || refName.EndsWith(".exe");
}
private static string GetProjectExtension(ProjectNode project)
{
string extension = ".dll";
if (project.Type == ProjectType.Exe)
{
extension = ".exe";
}
return extension;
}
private void WriteProject(SolutionNode solution, ProjectNode project) private void WriteProject(SolutionNode solution, ProjectNode project)
{ {
if (!tools.ContainsKey(project.Language)) if (!tools.ContainsKey(project.Language))
@ -474,14 +489,21 @@ namespace Prebuild.Core.Targets
ps.WriteLine("\" >"); ps.WriteLine("\" >");
string path; string path;
if (refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase)) if (String.IsNullOrEmpty(refr.Path))
{ {
path = Helper.NormalizePath(Path.Combine( refPath, refr.Name), '\\'); if ( ExtensionSpecified( refr.Name ) )
{
path = Helper.NormalizePath(Path.Combine(refPath, refr.Name), '\\');
}
else
{
path = refr.Name + ".dll";
}
} }
else else
{ {
path = refr.Name + ".dll"; path = refr.Path;
} }
// TODO: Allow reference to *.exe files // TODO: Allow reference to *.exe files

Binary file not shown.