diff options
Diffstat (limited to 'mcs/tools/corcompare/mono-api-html/MemberComparer.cs')
-rw-r--r-- | mcs/tools/corcompare/mono-api-html/MemberComparer.cs | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs index dee528ebc7a..92e36e8fd79 100644 --- a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs +++ b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs @@ -41,6 +41,11 @@ namespace Xamarin.ApiDiff { public abstract string GroupName { get; } public abstract string ElementName { get; } + protected virtual bool IsBreakingRemoval (XElement e) + { + return true; + } + public void Compare (XElement source, XElement target) { var s = source.Element (GroupName); @@ -136,8 +141,10 @@ namespace Xamarin.ApiDiff { Output.WriteLine ("<p>{0}:</p>", changes.Key); Output.WriteLine ("<pre>"); foreach (var element in changes.Value) { + Output.Write ("<div {0}>", element.Breaking ? "data-is-breaking" : "data-is-non-breaking"); foreach (var line in element.Member.ToString ().Split ('\n')) Output.WriteLine ("\t{0}", line); + Output.Write ("</div>"); } Output.WriteLine ("</pre>"); @@ -192,10 +199,10 @@ namespace Xamarin.ApiDiff { public virtual void BeforeAdding (IEnumerable<XElement> list) { first = true; - Output.WriteLine ("<p>Added {0}:</p>", list.Count () > 1 ? GroupName : ElementName); - bool isInterface = list.Count () > 0 && IsInInterface (list.First ()); - Output.WriteLine (State.Colorize ? string.Format ("<pre style='color: {0}'>", isInterface ? "red" : "green") : "<pre>"); + Output.WriteLine ("<div>"); + Output.WriteLine ("<p>Added {0}:</p>", list.Count () > 1 ? GroupName : ElementName); + Output.WriteLine ("<pre>"); } public override void Added (XElement target) @@ -203,13 +210,18 @@ namespace Xamarin.ApiDiff { var o = GetObsoleteMessage (target); if (!first && (o.Length > 0)) Output.WriteLine (); - Indent ().WriteLine ("\t{0}{1}", o, GetDescription (target)); + Indent (); + bool isInterface = IsInInterface (target); + Output.Write ("\t<span class='added added-{0} {1}' {2}>", ElementName, isInterface ? "breaking" : string.Empty, isInterface ? "data-is-breaking" : "data-is-non-breaking"); + Output.Write ("{0}{1}", o, GetDescription (target)); + Output.WriteLine ("</span>"); first = false; } public virtual void AfterAdding () { - Output.WriteLine ("</pre>");; + Output.WriteLine ("</pre>"); + Output.WriteLine ("</div>"); } public override void Modified (XElement source, XElement target, ApiChanges change) @@ -220,7 +232,7 @@ namespace Xamarin.ApiDiff { { first = true; Output.WriteLine ("<p>Removed {0}:</p>\n", list.Count () > 1 ? GroupName : ElementName); - Output.WriteLine (State.Colorize ? "<pre style='color: red'>" : "<pre>"); + Output.WriteLine ("<pre>"); } public override void Removed (XElement source) @@ -228,7 +240,13 @@ namespace Xamarin.ApiDiff { var o = GetObsoleteMessage (source); if (!first && (o.Length > 0)) Output.WriteLine (); - Indent ().WriteLine ("\t{0}{1}", o, GetDescription (source)); + + bool is_breaking = IsBreakingRemoval (source); + + Indent (); + Output.Write ("\t<span class='removed removed-{0} {2}' {1}>", ElementName, is_breaking ? "data-is-breaking" : "data-is-non-breaking", is_breaking ? "breaking" : string.Empty); + Output.Write ("{0}{1}", o, GetDescription (source)); + Output.WriteLine ("</span>"); first = false; } @@ -558,15 +576,13 @@ namespace Xamarin.ApiDiff { return; // neither is obsolete var change = new ApiChange (); change.Header = "Obsoleted " + GroupName; - if (State.Colorize) - change.Append ("<span style='color:gray'>"); + change.Append (string.Format ("<span class='obsolete obsolete-{0}' data-is-non-breaking>", ElementName)); change.Append ("[Obsolete ("); if (tgtObsolete != string.Empty) change.Append ("\"").Append (tgtObsolete).Append ("\""); change.Append (")]\n"); change.Append (GetDescription (target)); - if (State.Colorize) - change.Append ("</span>"); + change.Append ("</span>"); change.AnyChange = true; changes.Add (source, target, change); } else if (tgtObsolete == null) { |