Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/Connect.cs

Issue 11145025: Only store major version of AddIn in VS project file (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 using System.Collections.Generic; 14 using System.Collections.Generic;
15 using System.Diagnostics; 15 using System.Diagnostics;
16 using System.Reflection;
16 17
17 /// <summary>The object for implementing an Add-in.</summary> 18 /// <summary>The object for implementing an Add-in.</summary>
18 /// <seealso class='IDTExtensibility2' /> 19 /// <seealso class='IDTExtensibility2' />
19 public class Connect : IDTExtensibility2 20 public class Connect : IDTExtensibility2
20 { 21 {
21 /// <summary> 22 /// <summary>
22 /// The main Visual Studio interface. 23 /// The main Visual Studio interface.
23 /// </summary> 24 /// </summary>
24 private DTE2 dte_; 25 private DTE2 dte_;
25 26
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 161
161 /// <summary> 162 /// <summary>
162 /// Goes through all projects in the solution and updates their properties w ith necessary 163 /// Goes through all projects in the solution and updates their properties w ith necessary
163 /// modifications if they are NaCl or Pepper configurations. We add the vers ion information 164 /// modifications if they are NaCl or Pepper configurations. We add the vers ion information
164 /// here so that the version is stored directly in the project file. The cal l to 165 /// here so that the version is stored directly in the project file. The cal l to
165 /// PerformPropertyFixes() performs a work around on the property pages to f orce Visual Studio 166 /// PerformPropertyFixes() performs a work around on the property pages to f orce Visual Studio
166 /// to save some specific properties into the project file to get around iss ue 140162. 167 /// to save some specific properties into the project file to get around iss ue 140162.
167 /// </summary> 168 /// </summary>
168 private void PerformPropertyModifications() 169 private void PerformPropertyModifications()
169 { 170 {
170 string naclAddInVersion = GetAddInVersionFromDescription(); 171 string naclAddInVersion = GetAddInMajorVersion().ToString();
171 172
172 var configs = Utility.GetPlatformVCConfigurations(dte_, Strings.PepperPlat formName); 173 var configs = Utility.GetPlatformVCConfigurations(dte_, Strings.PepperPlat formName);
173 configs.AddRange(Utility.GetPlatformVCConfigurations(dte_, Strings.NaCl64P latformName)); 174 configs.AddRange(Utility.GetPlatformVCConfigurations(dte_, Strings.NaCl64P latformName));
174 configs.AddRange(Utility.GetPlatformVCConfigurations(dte_, Strings.NaCl32P latformName)); 175 configs.AddRange(Utility.GetPlatformVCConfigurations(dte_, Strings.NaCl32P latformName));
175 176
176 var properties = new PropertyManager(); 177 var properties = new PropertyManager();
177 foreach (VCConfiguration config in configs) 178 foreach (VCConfiguration config in configs)
178 { 179 {
179 properties.SetTarget(config); 180 properties.SetTarget(config);
180 if (properties.NaClAddInVersion != naclAddInVersion) 181 if (properties.NaClAddInVersion != naclAddInVersion)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 219 }
219 220
220 /// <summary> 221 /// <summary>
221 /// Takes a project configuration and sets values in the project file to wor k around some 222 /// Takes a project configuration and sets values in the project file to wor k around some
222 /// problems in Visual Studio. This is a work around for issue 140162. 223 /// problems in Visual Studio. This is a work around for issue 140162.
223 /// </summary> 224 /// </summary>
224 /// <param name="config">A configuration that needs modification.</param> 225 /// <param name="config">A configuration that needs modification.</param>
225 private void PerformPropertyFixes(VCConfiguration config) 226 private void PerformPropertyFixes(VCConfiguration config)
226 { 227 {
227 IVCRulePropertyStorage debugger = config.Rules.Item("WindowsLocalDebugger" ); 228 IVCRulePropertyStorage debugger = config.Rules.Item("WindowsLocalDebugger" );
228 string arguments = debugger.GetUnevaluatedPropertyValue("LocalDebuggerComm andArguments");
229 debugger.SetPropertyValue("LocalDebuggerCommandArguments", arguments);
230 229
binji 2012/10/15 20:00:59 Why did you remove this?
Sam Clegg 2012/10/15 20:07:51 This was here because the only way to get the args
231 // NaCl Platform Specific: 230 // NaCl Platform Specific:
232 if (PropertyManager.IsNaClPlatform(config.Platform.Name)) 231 if (PropertyManager.IsNaClPlatform(config.Platform.Name))
233 { 232 {
234 IVCRulePropertyStorage general = config.Rules.Item("ConfigurationGeneral "); 233 IVCRulePropertyStorage general = config.Rules.Item("ConfigurationGeneral ");
235 string[] keys = {"VSNaClSDKRoot"}; 234 string[] keys = {"VSNaClSDKRoot"};
236 Dictionary<string, string> values = new Dictionary<string, string>(); 235 Dictionary<string, string> values = new Dictionary<string, string>();
237 foreach (var key in keys) 236 foreach (var key in keys)
238 { 237 {
239 values[key] = general.GetUnevaluatedPropertyValue(key); 238 values[key] = general.GetUnevaluatedPropertyValue(key);
240 general.DeleteProperty(key); 239 general.DeleteProperty(key);
(...skipping 15 matching lines...) Expand all
256 255
257 // Pepper specific: 256 // Pepper specific:
258 if (config.Platform.Name == Strings.PepperPlatformName) 257 if (config.Platform.Name == Strings.PepperPlatformName)
259 { 258 {
260 string executablePath = directories.GetUnevaluatedPropertyValue("Executa blePath"); 259 string executablePath = directories.GetUnevaluatedPropertyValue("Executa blePath");
261 directories.SetPropertyValue("ExecutablePath", executablePath); 260 directories.SetPropertyValue("ExecutablePath", executablePath);
262 } 261 }
263 } 262 }
264 263
265 /// <summary> 264 /// <summary>
266 /// During the build process we dynamically put the add-in version number in to the add-in 265 /// Get the major version of the AddIn
binji 2012/10/15 20:00:59 nit: period at end of sentence.
Sam Clegg 2012/10/15 20:07:51 Done.
267 /// description. This function extracts that version number.
268 /// </summary> 266 /// </summary>
269 /// <returns>The add-in version number.</returns> 267 /// <returns>The add-in version number.</returns>
270 private string GetAddInVersionFromDescription() 268 private int GetAddInMajorVersion()
271 { 269 {
272 string naclAddinVersion = "missing"; 270 Assembly assem = Assembly.GetExecutingAssembly();
273 foreach (AddIn addin in dte_.AddIns) 271 AssemblyName assemName = assem.GetName();
274 { 272 return assemName.Version.Major;
275 if (addin.Name.Equals(Strings.AddInName))
276 {
277 string identifier = "Version: [";
278 int start = addin.Description.IndexOf(identifier) + identifier.Length;
279 int end = addin.Description.LastIndexOf(']');
280 if (start >= 0 && end >= 0)
281 {
282 naclAddinVersion = addin.Description.Substring(start, end - start);
283 break;
284 }
285 }
286 }
287
288 return naclAddinVersion;
289 } 273 }
290 274
291 /// <summary> 275 /// <summary>
292 /// Called when Visual Studio ends a debugging session. 276 /// Called when Visual Studio ends a debugging session.
293 /// Shuts down the web server and debugger. 277 /// Shuts down the web server and debugger.
294 /// </summary> 278 /// </summary>
295 /// <param name="reason">The parameter is not used.</param> 279 /// <param name="reason">The parameter is not used.</param>
296 private void DebuggerOnEnterDesignMode(dbgEventReason reason) 280 private void DebuggerOnEnterDesignMode(dbgEventReason reason)
297 { 281 {
298 if (debugger_ != null) 282 if (debugger_ != null)
(...skipping 29 matching lines...) Expand all
328 } 312 }
329 else if (properties.ProjectPlatform == PropertyManager.ProjectPlatformTy pe.Pepper) 313 else if (properties.ProjectPlatform == PropertyManager.ProjectPlatformTy pe.Pepper)
330 { 314 {
331 debugger_ = new PluginDebuggerVS(dte_, properties); 315 debugger_ = new PluginDebuggerVS(dte_, properties);
332 webServer_ = new WebServer(webServerOutputPane_, properties); 316 webServer_ = new WebServer(webServerOutputPane_, properties);
333 } 317 }
334 } 318 }
335 } 319 }
336 } 320 }
337 } 321 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698