From 65994f6f0d5a7c1c147c3ff9b01764dded4c70f4 Mon Sep 17 00:00:00 2001 From: ankit Date: Mon, 14 Dec 2009 10:30:06 +0000 Subject: [PATCH] * Parameters.cs (TryProcessMultiOption): New. (ProcessTarget): (ProcessProperty): Refactor to use TryProcessMultiOption, and accept ":" in target name or property name/value pair. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@148376 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- tools/xbuild/ChangeLog | 7 +++++++ tools/xbuild/Parameters.cs | 29 ++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/tools/xbuild/ChangeLog b/tools/xbuild/ChangeLog index 0ea1816e31..fce7d667f5 100644 --- a/tools/xbuild/ChangeLog +++ b/tools/xbuild/ChangeLog @@ -1,5 +1,12 @@ 2009-12-14 Ankit Jain + * Parameters.cs (TryProcessMultiOption): New. + (ProcessTarget): + (ProcessProperty): Refactor to use TryProcessMultiOption, + and accept ":" in target name or property name/value pair. + +2009-12-14 Ankit Jain + Fix bug #562056. * Parameters.cs: Property name/value pairs can be separated by ':'. diff --git a/tools/xbuild/Parameters.cs b/tools/xbuild/Parameters.cs index c330e45668..af1b65fd61 100644 --- a/tools/xbuild/Parameters.cs +++ b/tools/xbuild/Parameters.cs @@ -224,20 +224,18 @@ namespace Mono.XBuild.CommandLine { internal void ProcessTarget (string s) { - string[] temp = s.Split (':'); - targets = temp [1].Split (';'); + TryProcessMultiOption (s, "Target names must be specified as /t:Target1;Target2", + out targets); } internal bool ProcessProperty (string s) { - int colon = s.IndexOf (':'); - if (colon + 1 == s.Length) { - ErrorUtilities.ReportError (5, "Property name and value expected as /p:="); + string[] splitProperties; + if (!TryProcessMultiOption (s, "Property name and value expected as /p:=", + out splitProperties)) return false; - } - string [] splittedProperties = s.Substring (colon + 1).Split (';'); - foreach (string st in splittedProperties) { + foreach (string st in splitProperties) { if (st.IndexOf ('=') < 0) { ErrorUtilities.ReportError (5, "Invalid syntax. Property name and value expected as " + @@ -250,7 +248,20 @@ namespace Mono.XBuild.CommandLine { return true; } - + + bool TryProcessMultiOption (string s, string error_message, out string[] values) + { + values = null; + int colon = s.IndexOf (':'); + if (colon + 1 == s.Length) { + ErrorUtilities.ReportError (5, error_message); + return false; + } + + values = s.Substring (colon + 1).Split (';'); + return true; + } + internal void ProcessLogger (string s) { loggers.Add (new LoggerInfo (s)); -- 2.11.4.GIT