From 494b4d639564169ce587dcae7d37e6b79ad4f639 Mon Sep 17 00:00:00 2001 From: Aaron Bockover Date: Wed, 19 Feb 2014 14:22:01 -0500 Subject: [PATCH] mono-api-html: ignore members using regex, add detailed help --- mcs/tools/corcompare/mono-api-html/ApiDiff.cs | 24 +++++++++++++++---- .../mono-api-html/MemberComparer.cs | 4 ++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/mcs/tools/corcompare/mono-api-html/ApiDiff.cs b/mcs/tools/corcompare/mono-api-html/ApiDiff.cs index cd66e9ecd9d..8065019935b 100644 --- a/mcs/tools/corcompare/mono-api-html/ApiDiff.cs +++ b/mcs/tools/corcompare/mono-api-html/ApiDiff.cs @@ -34,6 +34,7 @@ using System; using System.IO; using System.Collections.Generic; +using System.Text.RegularExpressions; using Mono.Options; @@ -58,8 +59,8 @@ namespace Xamarin.ApiDiff { public static int Indent { get; set; } - static List ignoreAdded = new List (); - public static List IgnoreAdded { + static List ignoreAdded = new List (); + public static List IgnoreAdded { get { return ignoreAdded; } } } @@ -75,7 +76,9 @@ namespace Xamarin.ApiDiff { var options = new OptionSet { { "h|help", "Show this help", v => showHelp = true }, { "d|diff=", "HTML diff file out output (omit for stdout)", v => diff = v }, - { "i|ignore-added=", "Ignore added members with a given name", v => State.IgnoreAdded.Add (v) } + { "i|ignore-added=", "Ignore added members whose description matches a given C# regular expression (see below).", + v => State.IgnoreAdded.Add (new Regex (v)) + } }; try { @@ -91,6 +94,19 @@ namespace Xamarin.ApiDiff { Console.WriteLine ("Available options:"); options.WriteOptionDescriptions (Console.Out); Console.WriteLine (); + Console.WriteLine ("Ignoring Members:"); + Console.WriteLine (); + Console.WriteLine (" Members that were added can be filtered out of the diff by using the"); + Console.WriteLine (" -i, --ignore-added option. The option takes a C# regular expression"); + Console.WriteLine (" to match against member descriptions. For example, to ignore the"); + Console.WriteLine (" introduction of the interfaces 'INSCopying' and 'INSCoding' on types"); + Console.WriteLine (" pass the following to mono-api-html:"); + Console.WriteLine (); + Console.WriteLine (" mono-api-html ... -i 'INSCopying$' -i 'INSCoding$'"); + Console.WriteLine (); + Console.WriteLine (" The regular expressions will match any member description ending with"); + Console.WriteLine (" 'INSCopying' or 'INSCoding'."); + Console.WriteLine (); return 1; } @@ -130,4 +146,4 @@ namespace Xamarin.ApiDiff { return 0; } } -} \ No newline at end of file +} diff --git a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs index 1c9ceef5e4c..1045206de91 100644 --- a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs +++ b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs @@ -109,7 +109,7 @@ namespace Xamarin.ApiDiff { bool a = false; foreach (var item in target) { SetContext (item); - if (State.IgnoreAdded.Contains (GetDescription (item))) + if (State.IgnoreAdded.Any (re => re.IsMatch (GetDescription (item)))) continue; if (!a) { BeforeAdding (); @@ -177,4 +177,4 @@ namespace Xamarin.ApiDiff { Output.WriteLine (""); } } -} \ No newline at end of file +} -- 2.25.1