[mono-api-html] Allow ignoring addition of property setters.
authorJonathan Pryor <jonpryor@vt.edu>
Thu, 13 Nov 2014 18:18:49 +0000 (13:18 -0500)
committerJonathan Pryor <jonpryor@vt.edu>
Thu, 13 Nov 2014 18:36:45 +0000 (13:36 -0500)
As mentioned in commit 789517f8, I'm trying to compare inter-API level
differences in Mono.Android.dll, and want to reduce as much
"meaningless noise" as possible -- changes which don't meaningfully
break API or ABI.

Among those "meaningless" changes are the addition of property setters
to properties. Adding a setter doesn't break API or ABI.

Add a `mono-api-html --ignore-changes-property-setters` option.

  --ignore-changes-property-setters:
      Ignore the addition of property setters.

      If a source property contains a getter and the target property
      contains both a getter and a setter, do not flag this as a
      change.

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

index 4bbebf576248071b8bcfb580ae49c37ab3a26adc..fb326624ba5dfe312dd8fc557b53e6cf7a836285 100644 (file)
@@ -76,6 +76,7 @@ namespace Xamarin.ApiDiff {
 
                public  static  bool    IgnoreParameterNameChanges  { get; set; }
                public  static  bool    IgnoreVirtualChanges        { get; set; }
+               public  static  bool    IgnoreAddedPropertySetters  { get; set; }
 
                public static bool Lax;
        }
@@ -111,6 +112,9 @@ namespace Xamarin.ApiDiff {
                                { "ignore-changes-parameter-names", "Ignore changes to parameter names for identically prototyped methods.",
                                        v => State.IgnoreParameterNameChanges   = v != null
                                },
+                               { "ignore-changes-property-setters", "Ignore adding setters to properties.",
+                                       v => State.IgnoreAddedPropertySetters = v != null
+                               },
                                { "ignore-changes-virtual", "Ignore changing non-`virtual` to `virtual` or adding `override`.",
                                        v => State.IgnoreVirtualChanges = v != null
                                },
index cc2e944fc010092d4de29b75e4bf84ae9644e3ef..839de88a4a2698620c7ab4102d77a74878728682 100644 (file)
@@ -180,6 +180,13 @@ namespace Xamarin.ApiDiff {
                        string sourceDescription = GetDescription (source);
                        string targetDescription = GetDescription (target);
 
+                       return CheckVirtualChanges (sourceDescription, targetDescription) ||
+                               (State.IgnoreAddedPropertySetters &&
+                                       CheckVirtualChanges (sourceDescription, targetDescription.Replace (" set; ", " ")));
+               }
+
+               static bool CheckVirtualChanges (string sourceDescription, string targetDescription)
+               {
                        return (sourceDescription == targetDescription) ||
                                // *adding* virtual or override to target is acceptable; *removing* them is NOT
                                (State.IgnoreVirtualChanges &&