diff options
Diffstat (limited to 'Prebuild/src')
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index 2e06a50..b64c57e 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -92,27 +92,62 @@ namespace Prebuild.Core.Targets | |||
92 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) | 92 | private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) |
93 | { | 93 | { |
94 | string ret = ""; | 94 | string ret = ""; |
95 | string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; | ||
96 | |||
95 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 97 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
96 | { | 98 | { |
97 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 99 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
98 | string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/'); | 100 | string finalPath = Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); |
99 | return finalPath; | 101 | return finalPath; |
100 | } | 102 | } |
101 | else | 103 | else |
102 | { | 104 | { |
103 | ProjectNode project = (ProjectNode)refr.Parent; | 105 | if (refr.Name == "Pootface.exe") |
106 | { | ||
107 | Console.WriteLine("Poot!"); | ||
108 | } | ||
109 | |||
110 | ProjectNode project = (ProjectNode) refr.Parent; | ||
111 | |||
112 | // Do we have an explicit file reference? | ||
104 | string fileRef = FindFileReference(refr.Name, project); | 113 | string fileRef = FindFileReference(refr.Name, project); |
114 | if( fileRef != null ) | ||
115 | { | ||
116 | return fileRef; | ||
117 | } | ||
105 | 118 | ||
106 | if (refr.Path != null || fileRef != null) | 119 | // Is there an explicit path in the project ref? |
120 | if (refr.Path != null) | ||
107 | { | 121 | { |
108 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/') : fileRef; | 122 | return Helper.NormalizePath( refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); |
109 | ret += finalPath; | 123 | } |
110 | return ret; | 124 | |
125 | // Is it a specified extension (dll or exe?) | ||
126 | if (ExtensionSpecified(refr.Name)) | ||
127 | { | ||
128 | return Helper.NormalizePath( referencePath + GetRefFileName(refr.Name), '/'); | ||
111 | } | 129 | } |
112 | 130 | ||
113 | ret += (refr.Name + ".dll"); | 131 | // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway |
132 | return refr.Name + ".dll"; | ||
114 | } | 133 | } |
115 | return ret; | 134 | } |
135 | |||
136 | public static string GetRefFileName(string refName) | ||
137 | { | ||
138 | if (ExtensionSpecified(refName)) | ||
139 | { | ||
140 | return refName; | ||
141 | } | ||
142 | else | ||
143 | { | ||
144 | return refName + ".dll"; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | private static bool ExtensionSpecified(string refName) | ||
149 | { | ||
150 | return refName.EndsWith(".dll") || refName.EndsWith(".exe"); | ||
116 | } | 151 | } |
117 | 152 | ||
118 | private static string GetProjectExtension(ProjectNode project) | 153 | private static string GetProjectExtension(ProjectNode project) |
@@ -177,6 +212,13 @@ namespace Prebuild.Core.Targets | |||
177 | { | 212 | { |
178 | return fullPath; | 213 | return fullPath; |
179 | } | 214 | } |
215 | |||
216 | fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); | ||
217 | |||
218 | if (File.Exists(fullPath)) | ||
219 | { | ||
220 | return fullPath; | ||
221 | } | ||
180 | } | 222 | } |
181 | 223 | ||
182 | return null; | 224 | return null; |