Imported Upstream version 5.18.0.142

Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-09 08:20:59 +00:00
parent e52655b4dc
commit 0abdbe5a7d
1547 changed files with 93792 additions and 47893 deletions

View File

@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Xamarin.ApiDiff
{
public class ApiChange
namespace Mono.ApiTools {
class ApiChange
{
public string Header;
public StringBuilder Member = new StringBuilder ();
@ -14,10 +14,12 @@ namespace Xamarin.ApiDiff
public bool AnyChange;
public bool HasIgnoredChanges;
public string SourceDescription;
public State State;
public ApiChange (string sourceDescription)
public ApiChange (string sourceDescription, State state)
{
SourceDescription = sourceDescription;
State = state;
}
public ApiChange Append (string text)
@ -28,7 +30,7 @@ namespace Xamarin.ApiDiff
public ApiChange AppendAdded (string text, bool breaking = false)
{
Formatter.Current.DiffAddition (Member, text, breaking);
State.Formatter.DiffAddition (Member, text, breaking);
Breaking |= breaking;
AnyChange = true;
return this;
@ -36,7 +38,7 @@ namespace Xamarin.ApiDiff
public ApiChange AppendRemoved (string text, bool breaking = true)
{
Formatter.Current.DiffRemoval (Member, text, breaking);
State.Formatter.DiffRemoval (Member, text, breaking);
Breaking |= breaking;
AnyChange = true;
return this;
@ -44,14 +46,22 @@ namespace Xamarin.ApiDiff
public ApiChange AppendModified (string old, string @new, bool breaking = true)
{
Formatter.Current.DiffModification (Member, old, @new, breaking);
State.Formatter.DiffModification (Member, old, @new, breaking);
Breaking |= breaking;
AnyChange = true;
return this;
}
}
public class ApiChanges : Dictionary<string, List<ApiChange>> {
class ApiChanges : Dictionary<string, List<ApiChange>> {
public State State;
public ApiChanges (State state)
{
State = state;
}
public void Add (XElement source, XElement target, ApiChange change)
{
if (!change.AnyChange) {
@ -59,9 +69,9 @@ namespace Xamarin.ApiDiff
if (!change.HasIgnoredChanges) {
var isField = source.Name.LocalName == "field";
if (isField) {
Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetFieldAttributes (), target.GetFieldAttributes ());
State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetFieldAttributes ()} dst: {target.GetFieldAttributes ()}) :\n{source}\n{target}\n\n");
} else {
Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetMethodAttributes (), target.GetMethodAttributes ());
State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetMethodAttributes ()} dst: {target.GetMethodAttributes ()}) :\n{source}\n{target}\n\n");
}
}
return;