From: Ankit Jain Date: Thu, 16 Feb 2017 21:56:28 +0000 (-0500) Subject: [xbuild] Don't show the deprecation notice for minimal or quiet logging X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=0d08e2b3fb2099f521285b0e8b1a24e1abdc2052 [xbuild] Don't show the deprecation notice for minimal or quiet logging .. levels. This is useful for scripts that might depend on minimal/quiet levels, to parse output of a specific target execution, eg. Xamarin.Android . --- diff --git a/mcs/tools/xbuild/Main.cs b/mcs/tools/xbuild/Main.cs index e34909337b0..e81574d2787 100644 --- a/mcs/tools/xbuild/Main.cs +++ b/mcs/tools/xbuild/Main.cs @@ -55,16 +55,8 @@ namespace Mono.XBuild.CommandLine { // this does nothing but adds strong reference to Microsoft.Build.Tasks*.dll that we need to load consistently. Microsoft.Build.Tasks.Copy dummy; #pragma warning restore - public static void Main (string[] args) { - Console.ForegroundColor = ConsoleColor.DarkRed; - Console.WriteLine (); - Console.WriteLine (">>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<"); - Console.WriteLine (); - Console.ResetColor (); - - MainClass mc = new MainClass (); mc.args = args; mc.Execute (); @@ -83,7 +75,14 @@ namespace Mono.XBuild.CommandLine { bool show_stacktrace = false; try { - parameters.ParseArguments (args); + try { + parameters.ParseArguments (args); + } catch { + ShowDeprecationNotice (); + throw; + } + + ShowDeprecationNotice (); show_stacktrace = (parameters.LoggerVerbosity == LoggerVerbosity.Detailed || parameters.LoggerVerbosity == LoggerVerbosity.Diagnostic); @@ -173,6 +172,17 @@ namespace Mono.XBuild.CommandLine { } } + + void ShowDeprecationNotice () + { + if (parameters.LoggerVerbosity != LoggerVerbosity.Minimal && parameters.LoggerVerbosity != LoggerVerbosity.Quiet) { + Console.ForegroundColor = ConsoleColor.DarkRed; + Console.WriteLine (); + Console.WriteLine (">>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<"); + Console.WriteLine (); + Console.ResetColor (); + } + } } // code from mcs/report.cs