* fixed 'path' reference attribute for Nant and VS2008 targets.
parent
46fd31346d
commit
55d89b73ed
|
@ -94,24 +94,22 @@ 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), '/');
|
||||
ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name];
|
||||
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?
|
||||
string fileRef = FindFileReference(refr.Name, project);
|
||||
if( fileRef != null )
|
||||
if (fileRef != null)
|
||||
{
|
||||
return fileRef;
|
||||
}
|
||||
|
@ -119,19 +117,24 @@ namespace Prebuild.Core.Targets
|
|||
// Is there an explicit path in the project ref?
|
||||
if (refr.Path != null)
|
||||
{
|
||||
return Helper.NormalizePath( refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
|
||||
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), '/');
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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,14 +490,21 @@ namespace Prebuild.Core.Targets
|
|||
|
||||
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
|
||||
{
|
||||
path = refr.Path;
|
||||
}
|
||||
|
||||
// TODO: Allow reference to *.exe files
|
||||
ps.WriteLine(" <HintPath>{0}</HintPath>", path );
|
||||
|
|
BIN
bin/Prebuild.exe
BIN
bin/Prebuild.exe
Binary file not shown.
Loading…
Reference in New Issue