* 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 referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path;
if (String.IsNullOrEmpty(refr.Path))
{
if (solution.ProjectsTable.ContainsKey(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;
}
else
{
if (refr.Name == "Pootface.exe")
{
Console.WriteLine("Poot!");
}
ProjectNode project = (ProjectNode) refr.Parent;
// Do we have an explicit file reference?
@ -132,6 +130,11 @@ namespace Prebuild.Core.Targets
return refr.Name + ".dll";
}
}
else
{
return refr.Path;
}
}
public static string GetRefFileName(string refName)
{
@ -160,47 +163,54 @@ namespace Prebuild.Core.Targets
return extension;
}
private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
{
string ret = "";
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
return finalPath;
}
else
{
ProjectNode project = (ProjectNode)refr.Parent;
string fileRef = FindFileReference(refr.Name, project);
//private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
//{
// string ret = "";
// if (solution.ProjectsTable.ContainsKey(refr.Name))
// {
// ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
// string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/');
// return finalPath;
// }
// else
// {
// if (refr.Path == null)
// {
// ProjectNode project = (ProjectNode) refr.Parent;
// string fileRef = FindFileReference(refr.Name, project);
if (refr.Path != null || fileRef != null)
{
string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
ret += finalPath;
return ret;
}
// if (refr.Path != null || fileRef != null)
// {
// string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
// ret += finalPath;
// return ret;
// }
try
{
Assembly assem = Assembly.Load(refr.Name);
if (assem != null)
{
ret += "";
}
else
{
ret += "";
}
}
catch (System.NullReferenceException e)
{
e.ToString();
ret += "";
}
}
return ret;
}
// try
// {
// Assembly assem = Assembly.Load(refr.Name);
// if (assem != null)
// {
// ret += "";
// }
// else
// {
// ret += "";
// }
// }
// catch (System.NullReferenceException e)
// {
// e.ToString();
// ret += "";
// }
// }
// else
// {
// ret = refr.Path;
// }
// }
// return ret;
//}
private static string FindFileReference(string refName, ProjectNode project)
{

View File

@ -364,6 +364,21 @@ namespace Prebuild.Core.Targets
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)
{
if (!tools.ContainsKey(project.Language))
@ -475,7 +490,9 @@ namespace Prebuild.Core.Targets
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), '\\');
}
@ -483,6 +500,11 @@ namespace Prebuild.Core.Targets
{
path = refr.Name + ".dll";
}
}
else
{
path = refr.Path;
}
// TODO: Allow reference to *.exe files
ps.WriteLine(" <HintPath>{0}</HintPath>", path );

Binary file not shown.