OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 namespace NativeClientVSAddIn | 5 namespace NativeClientVSAddIn |
6 { | 6 { |
7 using System; | 7 using System; |
8 | 8 |
9 using EnvDTE; | 9 using EnvDTE; |
10 using EnvDTE80; | 10 using EnvDTE80; |
11 using Extensibility; | 11 using Extensibility; |
12 using Microsoft.VisualStudio; | 12 using Microsoft.VisualStudio; |
13 using Microsoft.VisualStudio.VCProjectEngine; | 13 using Microsoft.VisualStudio.VCProjectEngine; |
14 | 14 using System.Collections.Generic; |
| 15 using System.Diagnostics; |
| 16 |
15 /// <summary>The object for implementing an Add-in.</summary> | 17 /// <summary>The object for implementing an Add-in.</summary> |
16 /// <seealso class='IDTExtensibility2' /> | 18 /// <seealso class='IDTExtensibility2' /> |
17 public class Connect : IDTExtensibility2 | 19 public class Connect : IDTExtensibility2 |
18 { | 20 { |
19 /// <summary> | 21 /// <summary> |
20 /// The main Visual Studio interface. | 22 /// The main Visual Studio interface. |
21 /// </summary> | 23 /// </summary> |
22 private DTE2 dte_; | 24 private DTE2 dte_; |
23 | 25 |
24 /// <summary> | 26 /// <summary> |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 { | 170 { |
169 string naclAddInVersion = GetAddInVersionFromDescription(); | 171 string naclAddInVersion = GetAddInVersionFromDescription(); |
170 | 172 |
171 var configs = Utility.GetPlatformVCConfigurations(dte_, Strings.PepperPlat
formName); | 173 var configs = Utility.GetPlatformVCConfigurations(dte_, Strings.PepperPlat
formName); |
172 configs.AddRange(Utility.GetPlatformVCConfigurations(dte_, Strings.NaClPla
tformName)); | 174 configs.AddRange(Utility.GetPlatformVCConfigurations(dte_, Strings.NaClPla
tformName)); |
173 | 175 |
174 var properties = new PropertyManager(); | 176 var properties = new PropertyManager(); |
175 foreach (VCConfiguration config in configs) | 177 foreach (VCConfiguration config in configs) |
176 { | 178 { |
177 properties.SetTarget(config); | 179 properties.SetTarget(config); |
178 if (string.IsNullOrEmpty(properties.NaClAddInVersion)) | 180 if (properties.NaClAddInVersion != naclAddInVersion) |
179 { | 181 { |
| 182 Debug.WriteLine("Modifying Config: " + config.Name); |
| 183 |
180 // Set the NaCl add-in version so that it is stored in the project fil
e. | 184 // Set the NaCl add-in version so that it is stored in the project fil
e. |
181 properties.SetProperty("ConfigurationGeneral", "NaClAddInVersion", nac
lAddInVersion); | 185 properties.SetProperty("ConfigurationGeneral", "NaClAddInVersion", nac
lAddInVersion); |
182 | 186 |
183 // Expand the CHROME_PATH variable to its full path. | 187 // Expand the CHROME_PATH variable to its full path. |
184 string expandedChrome = properties.GetProperty( | 188 string expandedChrome = properties.GetProperty( |
185 "WindowsLocalDebugger", "LocalDebuggerCommand"); | 189 "WindowsLocalDebugger", "LocalDebuggerCommand"); |
186 properties.SetProperty("WindowsLocalDebugger", "LocalDebuggerCommand",
expandedChrome); | 190 properties.SetProperty("WindowsLocalDebugger", "LocalDebuggerCommand",
expandedChrome); |
187 | 191 |
188 // Change the library includes to have the appropriate extension. | 192 // Change the library includes to have the appropriate extension. |
189 string libs = properties.GetProperty("Link", "AdditionalDependencies")
; | 193 string libs = properties.GetProperty("Link", "AdditionalDependencies")
; |
190 if (properties.ProjectPlatform == PropertyManager.ProjectPlatformType.
NaCl) | 194 if (properties.ProjectPlatform == PropertyManager.ProjectPlatformType.
NaCl) |
191 { | 195 { |
192 libs = libs.Replace(".lib", string.Empty); | 196 libs = libs.Replace(".lib", string.Empty); |
(...skipping 24 matching lines...) Expand all Loading... |
217 /// Takes a project configuration and sets values in the project file to wor
k around some | 221 /// Takes a project configuration and sets values in the project file to wor
k around some |
218 /// problems in Visual Studio. This is a work around for issue 140162. | 222 /// problems in Visual Studio. This is a work around for issue 140162. |
219 /// </summary> | 223 /// </summary> |
220 /// <param name="config">A configuration that needs modification.</param> | 224 /// <param name="config">A configuration that needs modification.</param> |
221 private void PerformPropertyFixes(VCConfiguration config) | 225 private void PerformPropertyFixes(VCConfiguration config) |
222 { | 226 { |
223 IVCRulePropertyStorage debugger = config.Rules.Item("WindowsLocalDebugger"
); | 227 IVCRulePropertyStorage debugger = config.Rules.Item("WindowsLocalDebugger"
); |
224 string arguments = debugger.GetUnevaluatedPropertyValue("LocalDebuggerComm
andArguments"); | 228 string arguments = debugger.GetUnevaluatedPropertyValue("LocalDebuggerComm
andArguments"); |
225 debugger.SetPropertyValue("LocalDebuggerCommandArguments", arguments); | 229 debugger.SetPropertyValue("LocalDebuggerCommandArguments", arguments); |
226 | 230 |
| 231 // NaCl Platform Specific: |
| 232 if (config.Platform.Name == Strings.NaClPlatformName) |
| 233 { |
| 234 IVCRulePropertyStorage general = config.Rules.Item("ConfigurationGeneral
"); |
| 235 string[] keys = {"VSNaClSDKRoot", "OutDir", "IntDir"}; |
| 236 Dictionary<string, string> values = new Dictionary<string, string>(); |
| 237 foreach (var key in keys) |
| 238 { |
| 239 values[key] = general.GetUnevaluatedPropertyValue(key); |
| 240 general.DeleteProperty(key); |
| 241 } |
| 242 |
| 243 foreach (var key in keys) |
| 244 { |
| 245 general.SetPropertyValue(key, values[key]); |
| 246 } |
| 247 } |
| 248 |
227 IVCRulePropertyStorage directories = config.Rules.Item("ConfigurationDirec
tories"); | 249 IVCRulePropertyStorage directories = config.Rules.Item("ConfigurationDirec
tories"); |
228 string includePath = directories.GetUnevaluatedPropertyValue("IncludePath"
); | 250 string includePath = directories.GetUnevaluatedPropertyValue("IncludePath"
); |
229 string libraryPath = directories.GetUnevaluatedPropertyValue("LibraryPath"
); | 251 string libraryPath = directories.GetUnevaluatedPropertyValue("LibraryPath"
); |
| 252 directories.DeleteProperty("IncludePath"); |
| 253 directories.DeleteProperty("LibraryPath"); |
230 directories.SetPropertyValue("IncludePath", includePath); | 254 directories.SetPropertyValue("IncludePath", includePath); |
231 directories.SetPropertyValue("LibraryPath", libraryPath); | 255 directories.SetPropertyValue("LibraryPath", libraryPath); |
232 | 256 |
233 // Pepper specific: | 257 // Pepper specific: |
234 if (config.Platform.Name == Strings.PepperPlatformName) | 258 if (config.Platform.Name == Strings.PepperPlatformName) |
235 { | 259 { |
236 string executablePath = directories.GetUnevaluatedPropertyValue("Executa
blePath"); | 260 string executablePath = directories.GetUnevaluatedPropertyValue("Executa
blePath"); |
237 directories.SetPropertyValue("ExecutablePath", executablePath); | 261 directories.SetPropertyValue("ExecutablePath", executablePath); |
238 } | 262 } |
239 | 263 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 338 } |
315 else if (properties.ProjectPlatform == PropertyManager.ProjectPlatformTy
pe.Pepper) | 339 else if (properties.ProjectPlatform == PropertyManager.ProjectPlatformTy
pe.Pepper) |
316 { | 340 { |
317 debugger_ = new PluginDebuggerVS(dte_, properties); | 341 debugger_ = new PluginDebuggerVS(dte_, properties); |
318 webServer_ = new WebServer(webServerOutputPane_, properties); | 342 webServer_ = new WebServer(webServerOutputPane_, properties); |
319 } | 343 } |
320 } | 344 } |
321 } | 345 } |
322 } | 346 } |
323 } | 347 } |
OLD | NEW |