* 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,19 +94,17 @@ namespace Prebuild.Core.Targets
string ret = ""; string ret = "";
string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path;
if (String.IsNullOrEmpty(refr.Path))
{
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(referencePath + refr.Name + GetProjectExtension(project), '/'); string finalPath =
Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/');
return finalPath; return finalPath;
} }
else else
{ {
if (refr.Name == "Pootface.exe")
{
Console.WriteLine("Poot!");
}
ProjectNode project = (ProjectNode) refr.Parent; ProjectNode project = (ProjectNode) refr.Parent;
// Do we have an explicit file reference? // Do we have an explicit file reference?
@ -132,6 +130,11 @@ namespace Prebuild.Core.Targets
return refr.Name + ".dll"; return refr.Name + ".dll";
} }
} }
else
{
return refr.Path;
}
}
public static string GetRefFileName(string refName) public static string GetRefFileName(string refName)
{ {
@ -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))
@ -475,7 +490,9 @@ namespace Prebuild.Core.Targets
string path; string path;
if (refr.Name.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase)) if (String.IsNullOrEmpty(refr.Path))
{
if ( ExtensionSpecified( refr.Name ) )
{ {
path = Helper.NormalizePath(Path.Combine(refPath, refr.Name), '\\'); path = Helper.NormalizePath(Path.Combine(refPath, refr.Name), '\\');
} }
@ -483,6 +500,11 @@ namespace Prebuild.Core.Targets
{ {
path = refr.Name + ".dll"; path = refr.Name + ".dll";
} }
}
else
{
path = refr.Path;
}
// TODO: Allow reference to *.exe files // TODO: Allow reference to *.exe files
ps.WriteLine(" <HintPath>{0}</HintPath>", path ); ps.WriteLine(" <HintPath>{0}</HintPath>", path );

Binary file not shown.