[mono-api-html] Add the [Obsolete] message for API additions and removals
authorSebastien Pouliot <sebastien@xamarin.com>
Fri, 9 May 2014 00:17:39 +0000 (20:17 -0400)
committerSebastien Pouliot <sebastien@xamarin.com>
Fri, 9 May 2014 00:18:02 +0000 (20:18 -0400)
Less common case - unless the API difference has a large delta.

Some additional spacing is added to ease readability: if an entry takes two line then it needs a empty line.

mcs/tools/corcompare/mono-api-html/FieldComparer.cs
mcs/tools/corcompare/mono-api-html/MemberComparer.cs

index 3f34c4e859d561e6d0ef21a6eb67bb78011dcfbb..0916ed5396386d4d323d55acbe90e1534599744b 100644 (file)
@@ -86,6 +86,7 @@ namespace Xamarin.ApiDiff {
 
                public override void BeforeAdding (IEnumerable<XElement> list)
                {
+                       first = true;
                        if (State.BaseType == "System.Enum")
                                Output.WriteLine ("<p>Added value{0}:</p><pre>", list.Count () > 1 ? "s" : String.Empty);
                        else
@@ -94,6 +95,7 @@ namespace Xamarin.ApiDiff {
 
                public override void BeforeRemoving (IEnumerable<XElement> list)
                {
+                       first = true;
                        if (State.BaseType == "System.Enum")
                                Output.WriteLine ("<p>Removed value{0}:</p><pre>", list.Count () > 1 ? "s" : String.Empty);
                        else
index d13f2193023d807e27737d3bb1a6bf1e09009988..0a646c7a2a26f392cacef89ef548c252f4aa28c1 100644 (file)
@@ -34,6 +34,9 @@ namespace Xamarin.ApiDiff {
 
        public abstract class MemberComparer : Comparer {
 
+               // true if this is the first element being added or removed in the group being rendered
+               protected bool first;
+
                public abstract string GroupName { get; }
                public abstract string ElementName { get; }
 
@@ -187,12 +190,17 @@ namespace Xamarin.ApiDiff {
 
                public virtual void BeforeAdding (IEnumerable<XElement> list)
                {
+                       first = true;
                        Output.WriteLine ("<p>Added {0}:</p><pre>", list.Count () > 1 ? GroupName : ElementName);
                }
 
                public override void Added (XElement target)
                {
-                       Indent ().WriteLine ("\t{0}", GetDescription (target));
+                       var o = GetObsoleteMessage (target);
+                       if (!first && (o.Length > 0))
+                               Output.WriteLine ();
+                       Indent ().WriteLine ("\t{0}{1}", o, GetDescription (target));
+                       first = false;
                }
 
                public virtual void AfterAdding ()
@@ -221,12 +229,17 @@ namespace Xamarin.ApiDiff {
 
                public virtual void BeforeRemoving (IEnumerable<XElement> list)
                {
+                       first = true;
                        Output.WriteLine ("<p>Removed {0}:</p><pre>", list.Count () > 1 ? GroupName : ElementName);
                }
 
                public override void Removed (XElement source)
                {
-                       Indent ().WriteLine ("\t{0}", GetDescription (source));
+                       var o = GetObsoleteMessage (source);
+                       if (!first && (o.Length > 0))
+                               Output.WriteLine ();
+                       Indent ().WriteLine ("\t{0}{1}", o, GetDescription (source));
+                       first = false;
                }
 
                public virtual void AfterRemoving ()