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

Unified Diff: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/XamlParser.cs

Issue 11046011: fix processing of non-switch arguments (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/XamlParser.cs
diff --git a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/XamlParser.cs b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/XamlParser.cs
index 8acbc5fb2a87eb54af8b6f6780127acf8bd68a24..190963a538de365ff18db95194bbd4d978412af7 100644
--- a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/XamlParser.cs
+++ b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/XamlParser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,13 +17,13 @@ namespace NaCl.Build.CPPTasks
// load and store properties from xaml file
m_parsedBuildRule = (Rule)XamlServices.Load(path);
- // NOTE:
- // There are MSBuild classes which support command line building,
- // argument switch encapsulation and more. Code within VCToolTask,
- // a hidden interface, uses some these classes to generate command line
- // switches given project settings. As the VCToolTask class is a hidden
- // class and the MSBuild documentation is very sparse, we are going
- // with a small custom solution. For reference see the
+ // NOTE:
+ // There are MSBuild classes which support command line building,
+ // argument switch encapsulation and more. Code within VCToolTask,
+ // a hidden interface, uses some these classes to generate command line
+ // switches given project settings. As the VCToolTask class is a hidden
+ // class and the MSBuild documentation is very sparse, we are going
+ // with a small custom solution. For reference see the
// Microsoft.Build.Tasks.Xaml, Microsoft.Build.Framework.XamlTypes namespaces.
// move the properties to a property name keyed dictionary for faster lookup
@@ -87,19 +87,26 @@ namespace NaCl.Build.CPPTasks
value = value.Trim();
// could cache this SubType test off in property wrapper or somewhere if performance were an issue
+ string switchName = m_parsedBuildRule.SwitchPrefix + property.Switch + property.Separator;
binji 2012/10/02 23:43:47 nit: wrap at 100
if (subtype == "file" || subtype == "folder")
{
- builder.AppendSwitchIfNotNull(m_parsedBuildRule.SwitchPrefix + property.Switch + property.Separator, value);
+ // for switches that contains files or folders we need quoting
+ builder.AppendSwitchIfNotNull(switchName, value);
}
- else
+ else if (!string.IsNullOrEmpty(property.Switch))
{
- builder.AppendSwitchUnquotedIfNotNull(m_parsedBuildRule.SwitchPrefix + property.Switch + property.Separator, value);
+ builder.AppendSwitchUnquotedIfNotNull(switchName, value);
+ }
+ else if (!string.IsNullOrEmpty(value))
+ {
+ // for non-switchs such as AdditionalOpions we just append the value
binji 2012/10/02 23:43:47 nit: s/switchs/switches/ s/Opions/Options/
+ builder.AppendTextUnquoted(" " + value);
}
}
private void GenerateArgumentStringList(CommandLineBuilder builder, BaseProperty property, string value)
{
- string [] arguments = value.Split(';');
+ string[] arguments = value.Split(';');
foreach (string argument in arguments)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698