diff options
Diffstat (limited to 'Prebuild/src/Core/Targets/NAntTarget.cs')
-rw-r--r-- | Prebuild/src/Core/Targets/NAntTarget.cs | 148 |
1 files changed, 79 insertions, 69 deletions
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index b64c57e..eb5325d 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs | |||
@@ -94,42 +94,45 @@ namespace Prebuild.Core.Targets | |||
94 | string ret = ""; | 94 | string ret = ""; |
95 | string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; | 95 | string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; |
96 | 96 | ||
97 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 97 | if (String.IsNullOrEmpty(refr.Path)) |
98 | { | 98 | { |
99 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 99 | if (solution.ProjectsTable.ContainsKey(refr.Name)) |
100 | string finalPath = Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); | ||
101 | return finalPath; | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | if (refr.Name == "Pootface.exe") | ||
106 | { | 100 | { |
107 | Console.WriteLine("Poot!"); | 101 | ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name]; |
102 | string finalPath = | ||
103 | Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); | ||
104 | return finalPath; | ||
108 | } | 105 | } |
106 | else | ||
107 | { | ||
108 | ProjectNode project = (ProjectNode) refr.Parent; | ||
109 | 109 | ||
110 | ProjectNode project = (ProjectNode) refr.Parent; | 110 | // Do we have an explicit file reference? |
111 | string fileRef = FindFileReference(refr.Name, project); | ||
112 | if (fileRef != null) | ||
113 | { | ||
114 | return fileRef; | ||
115 | } | ||
111 | 116 | ||
112 | // Do we have an explicit file reference? | 117 | // Is there an explicit path in the project ref? |
113 | string fileRef = FindFileReference(refr.Name, project); | 118 | if (refr.Path != null) |
114 | if( fileRef != null ) | 119 | { |
115 | { | 120 | return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); |
116 | return fileRef; | 121 | } |
117 | } | ||
118 | 122 | ||
119 | // Is there an explicit path in the project ref? | 123 | // Is it a specified extension (dll or exe?) |
120 | if (refr.Path != null) | 124 | if (ExtensionSpecified(refr.Name)) |
121 | { | 125 | { |
122 | return Helper.NormalizePath( refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); | 126 | return Helper.NormalizePath(referencePath + GetRefFileName(refr.Name), '/'); |
123 | } | 127 | } |
124 | 128 | ||
125 | // Is it a specified extension (dll or exe?) | 129 | // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway |
126 | if (ExtensionSpecified(refr.Name)) | 130 | return refr.Name + ".dll"; |
127 | { | ||
128 | return Helper.NormalizePath( referencePath + GetRefFileName(refr.Name), '/'); | ||
129 | } | 131 | } |
130 | 132 | } | |
131 | // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway | 133 | else |
132 | return refr.Name + ".dll"; | 134 | { |
135 | return refr.Path; | ||
133 | } | 136 | } |
134 | } | 137 | } |
135 | 138 | ||
@@ -160,47 +163,54 @@ namespace Prebuild.Core.Targets | |||
160 | return extension; | 163 | return extension; |
161 | } | 164 | } |
162 | 165 | ||
163 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) | 166 | //private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) |
164 | { | 167 | //{ |
165 | string ret = ""; | 168 | // string ret = ""; |
166 | if (solution.ProjectsTable.ContainsKey(refr.Name)) | 169 | // if (solution.ProjectsTable.ContainsKey(refr.Name)) |
167 | { | 170 | // { |
168 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | 171 | // ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; |
169 | string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); | 172 | // string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); |
170 | return finalPath; | 173 | // return finalPath; |
171 | } | 174 | // } |
172 | else | 175 | // else |
173 | { | 176 | // { |
174 | ProjectNode project = (ProjectNode)refr.Parent; | 177 | // if (refr.Path == null) |
175 | string fileRef = FindFileReference(refr.Name, project); | 178 | // { |
176 | 179 | // ProjectNode project = (ProjectNode) refr.Parent; | |
177 | if (refr.Path != null || fileRef != null) | 180 | // string fileRef = FindFileReference(refr.Name, project); |
178 | { | 181 | |
179 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; | 182 | // if (refr.Path != null || fileRef != null) |
180 | ret += finalPath; | 183 | // { |
181 | return ret; | 184 | // string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; |
182 | } | 185 | // ret += finalPath; |
183 | 186 | // return ret; | |
184 | try | 187 | // } |
185 | { | 188 | |
186 | Assembly assem = Assembly.Load(refr.Name); | 189 | // try |
187 | if (assem != null) | 190 | // { |
188 | { | 191 | // Assembly assem = Assembly.Load(refr.Name); |
189 | ret += ""; | 192 | // if (assem != null) |
190 | } | 193 | // { |
191 | else | 194 | // ret += ""; |
192 | { | 195 | // } |
193 | ret += ""; | 196 | // else |
194 | } | 197 | // { |
195 | } | 198 | // ret += ""; |
196 | catch (System.NullReferenceException e) | 199 | // } |
197 | { | 200 | // } |
198 | e.ToString(); | 201 | // catch (System.NullReferenceException e) |
199 | ret += ""; | 202 | // { |
200 | } | 203 | // e.ToString(); |
201 | } | 204 | // ret += ""; |
202 | return ret; | 205 | // } |
203 | } | 206 | // } |
207 | // else | ||
208 | // { | ||
209 | // ret = refr.Path; | ||
210 | // } | ||
211 | // } | ||
212 | // return ret; | ||
213 | //} | ||
204 | 214 | ||
205 | private static string FindFileReference(string refName, ProjectNode project) | 215 | private static string FindFileReference(string refName, ProjectNode project) |
206 | { | 216 | { |