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

Unified Diff: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PropertyManager.cs

Issue 11266051: Add PNaCl support for VS addin. (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: fix nits and tests 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 side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PropertyManager.cs
diff --git a/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PropertyManager.cs b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PropertyManager.cs
index efa26d00251e1a3cf81985ad3aedcd1f8f657ac1..86612b3e20b4ba63e81ef418fed61ffef7cb9262 100644
--- a/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PropertyManager.cs
+++ b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PropertyManager.cs
@@ -34,7 +34,7 @@ namespace NativeClientVSAddIn
/// </summary>
public PropertyManager()
{
- ProjectPlatform = ProjectPlatformType.Other;
+ PlatformType = ProjectPlatformType.Other;
}
/// <summary>
@@ -62,7 +62,12 @@ namespace NativeClientVSAddIn
/// Gets or sets the current project platform type. This indicates Pepper, NaCl, or Other type
/// of project. If this is set to Other then it is invalid to read the properties.
/// </summary>
- public ProjectPlatformType ProjectPlatform { get; protected set; }
+ public ProjectPlatformType PlatformType { get; protected set; }
+
+ /// <summary>
+ /// Gets or sets the current project platform name.
+ /// </summary>
+ public string PlatformName { get; protected set; }
/// <summary>
/// Gets or sets the full path to the output assembly.
@@ -239,7 +244,16 @@ namespace NativeClientVSAddIn
public static bool IsNaClPlatform(string platformName)
{
return platformName.Equals(Strings.NaCl32PlatformName, StringComparison.OrdinalIgnoreCase) ||
- platformName.Equals(Strings.NaCl64PlatformName, StringComparison.OrdinalIgnoreCase);
+ platformName.Equals(Strings.NaCl64PlatformName, StringComparison.OrdinalIgnoreCase) ||
+ platformName.Equals(Strings.PNaClPlatformName, StringComparison.OrdinalIgnoreCase);
+ }
+
+ /// <summary>
+ /// Return true if the given platform is the PNaCl platform.
+ /// </summary>
+ public bool IsPNaCl()
+ {
+ return PlatformName.Equals(Strings.PNaClPlatformName, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
@@ -259,24 +273,14 @@ namespace NativeClientVSAddIn
public void SetTarget(Project proj, string targetPlatformName, string targetConfigName)
{
// Set the project platform. If it is set to Other then no settings are valid to be read.
- if (IsPepperPlatform(targetPlatformName))
- {
- ProjectPlatform = ProjectPlatformType.Pepper;
- }
- else if (IsNaClPlatform(targetPlatformName))
- {
- ProjectPlatform = ProjectPlatformType.NaCl;
- }
- else
- {
- ProjectPlatform = ProjectPlatformType.Other;
+ SetPlatform(targetPlatformName);
+ if (!IsPepperPlatform(targetPlatformName) && !IsNaClPlatform(targetPlatformName))
return;
- }
// We don't support non-visual C/C++ projects.
if (!Utility.IsVisualCProject(proj))
{
- ProjectPlatform = ProjectPlatformType.Other;
+ PlatformType = ProjectPlatformType.Other;
return;
}
@@ -307,17 +311,24 @@ namespace NativeClientVSAddIn
configuration_ = config;
project_ = config.project;
- if (IsPepperPlatform(config.Platform.Name))
+ SetPlatform(config.Platform.Name);
+ }
+
+ private void SetPlatform(string platform)
+ {
+ PlatformName = platform;
+
+ if (IsPepperPlatform(PlatformName))
{
- ProjectPlatform = ProjectPlatformType.Pepper;
+ PlatformType = ProjectPlatformType.Pepper;
}
- else if (IsNaClPlatform(config.Platform.Name))
+ else if (IsNaClPlatform(PlatformName))
{
- ProjectPlatform = ProjectPlatformType.NaCl;
+ PlatformType = ProjectPlatformType.NaCl;
}
else
{
- ProjectPlatform = ProjectPlatformType.Other;
+ PlatformType = ProjectPlatformType.Other;
}
}
@@ -359,7 +370,7 @@ namespace NativeClientVSAddIn
// GetActiveVCConfiguration will return null if not a VC project.
if (activeConfig == null)
{
- ProjectPlatform = ProjectPlatformType.Other;
+ PlatformType = ProjectPlatformType.Other;
return;
}
@@ -395,7 +406,7 @@ namespace NativeClientVSAddIn
/// </summary>
private void AssertNaCl()
{
- if (ProjectPlatform != ProjectPlatformType.NaCl)
+ if (PlatformType != ProjectPlatformType.NaCl)
{
throw new Exception(string.Format(
"Cannot read NaCl only property on {0} platform", configuration_.Platform.Name));
@@ -407,7 +418,7 @@ namespace NativeClientVSAddIn
/// </summary>
private void AssertPepper()
{
- if (ProjectPlatform != ProjectPlatformType.Pepper)
+ if (PlatformType != ProjectPlatformType.Pepper)
{
throw new Exception(string.Format(
"Cannot read Pepper only property on {0} platform", configuration_.Platform.Name));
@@ -419,7 +430,7 @@ namespace NativeClientVSAddIn
/// </summary>
private void AssertValidPlatform()
{
- if (ProjectPlatform == ProjectPlatformType.Other)
+ if (PlatformType == ProjectPlatformType.Other)
{
throw new Exception(string.Format(
"Unsupported platform type: {0} platform", configuration_.Platform.Name));

Powered by Google App Engine
This is Rietveld 408576698