From 54c0c51795028f1df2d46858f2cbe4cff92d6b7d Mon Sep 17 00:00:00 2001 From: "Xamarin Public Jenkins (auto-signing)" Date: Sat, 2 Jun 2018 08:53:49 +0000 Subject: [PATCH] Imported Upstream version 5.14.0.121 Former-commit-id: 86f238de2954f615a08dc4afc175bee032151a5a --- configure.REMOVED.git-id | 2 +- configure.ac.REMOVED.git-id | 2 +- mcs/build/common/Consts.cs | 2 +- .../Mono.Security.dll.REMOVED.git-id | 2 +- .../System.Configuration.dll.REMOVED.git-id | 2 +- .../System.Numerics.dll.REMOVED.git-id | 2 +- .../System.Security.dll.REMOVED.git-id | 2 +- .../1051400003/System.Xml.dll.REMOVED.git-id | 2 +- .../1051400003/mcs.exe.REMOVED.git-id | 2 +- .../1051400003/mscorlib.dll.REMOVED.git-id | 2 +- .../Mono.Security.dll.REMOVED.git-id | 2 +- .../System.Configuration.dll.REMOVED.git-id | 2 +- .../System.Numerics.dll.REMOVED.git-id | 2 +- .../System.Security.dll.REMOVED.git-id | 2 +- .../1051400003/System.Xml.dll.REMOVED.git-id | 2 +- .../1051400003/mcs.exe.REMOVED.git-id | 2 +- .../1051400003/mscorlib.dll.REMOVED.git-id | 2 +- .../Mono.Security.dll.REMOVED.git-id | 2 +- .../System.Configuration.dll.REMOVED.git-id | 2 +- .../System.Numerics.dll.REMOVED.git-id | 2 +- .../System.Security.dll.REMOVED.git-id | 2 +- .../1051400003/System.Xml.dll.REMOVED.git-id | 2 +- .../1051400003/mcs.exe.REMOVED.git-id | 2 +- .../1051400003/mscorlib.dll.REMOVED.git-id | 2 +- mcs/tools/mono-api-html/ApiChange.cs | 15 +- mcs/tools/mono-api-html/ApiDiff.cs | 109 +------ mcs/tools/mono-api-html/ClassComparer.cs | 55 ++-- mcs/tools/mono-api-html/Comparer.cs | 4 + .../mono-api-html/ConstructorComparer.cs | 2 +- mcs/tools/mono-api-html/FieldComparer.cs | 23 -- mcs/tools/mono-api-html/Formatter.cs | 88 +++++ mcs/tools/mono-api-html/Helpers.cs | 2 +- mcs/tools/mono-api-html/HtmlFormatter.cs | 308 ++++++++++++++++++ mcs/tools/mono-api-html/MarkdownFormatter.cs | 199 +++++++++++ mcs/tools/mono-api-html/MemberComparer.cs | 69 +--- mcs/tools/mono-api-html/NamespaceComparer.cs | 29 +- .../mono-api-html/mono-api-html.exe.sources | 3 + mono/mini/mini-llvm.c.REMOVED.git-id | 2 +- mono/mini/version.h | 2 +- po/mcs/de.gmo | Bin 5406 -> 5406 bytes po/mcs/de.po.REMOVED.git-id | 2 +- po/mcs/es.gmo | Bin 16329 -> 16329 bytes po/mcs/es.po.REMOVED.git-id | 2 +- po/mcs/ja.gmo | Bin 20863 -> 20863 bytes po/mcs/ja.po.REMOVED.git-id | 2 +- po/mcs/mcs.pot | 4 +- po/mcs/pt_BR.gmo | Bin 72806 -> 72806 bytes po/mcs/pt_BR.po.REMOVED.git-id | 2 +- 48 files changed, 710 insertions(+), 260 deletions(-) create mode 100644 mcs/tools/mono-api-html/Formatter.cs create mode 100644 mcs/tools/mono-api-html/HtmlFormatter.cs create mode 100644 mcs/tools/mono-api-html/MarkdownFormatter.cs diff --git a/configure.REMOVED.git-id b/configure.REMOVED.git-id index 120ff61a1a..ca15d65fd6 100644 --- a/configure.REMOVED.git-id +++ b/configure.REMOVED.git-id @@ -1 +1 @@ -f2975e434fb9a78dbc5f2ccc946c7cbf285a3a46 \ No newline at end of file +9c6dc460572d6a61d53cad8962f5f2cbc2bf2744 \ No newline at end of file diff --git a/configure.ac.REMOVED.git-id b/configure.ac.REMOVED.git-id index 402e850e30..72cfec1a8d 100644 --- a/configure.ac.REMOVED.git-id +++ b/configure.ac.REMOVED.git-id @@ -1 +1 @@ -71862039cdd700167d24ff50835960834c3faaf5 \ No newline at end of file +de061369386bf75c7f5de5d21bc81daffaac357e \ No newline at end of file diff --git a/mcs/build/common/Consts.cs b/mcs/build/common/Consts.cs index 96156283a9..2da40f2fb6 100644 --- a/mcs/build/common/Consts.cs +++ b/mcs/build/common/Consts.cs @@ -34,7 +34,7 @@ static class Consts // Use these assembly version constants to make code more maintainable. // - public const string MonoVersion = "5.14.0.116"; + public const string MonoVersion = "5.14.0.121"; public const string MonoCompany = "Mono development team"; public const string MonoProduct = "Mono Common Language Infrastructure"; public const string MonoCopyright = "(c) Various Mono authors"; diff --git a/mcs/class/lib/monolite-darwin/1051400003/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051400003/Mono.Security.dll.REMOVED.git-id index a74d31204c..b9068cada5 100644 --- a/mcs/class/lib/monolite-darwin/1051400003/Mono.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-darwin/1051400003/Mono.Security.dll.REMOVED.git-id @@ -1 +1 @@ -88463079f1bc9e293ff4eeffc52b8fe7ddb4b61d \ No newline at end of file +09ec0df8466f5935dd3109d5702a6e5a0e7d11cc \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051400003/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051400003/System.Configuration.dll.REMOVED.git-id index 56000f86f8..2852954eb0 100644 --- a/mcs/class/lib/monolite-darwin/1051400003/System.Configuration.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-darwin/1051400003/System.Configuration.dll.REMOVED.git-id @@ -1 +1 @@ -69022cbbe03b81539b541184bb204f1027e88e47 \ No newline at end of file +a5407a65a42139eac82ff8531f3941a3c30b3c6e \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051400003/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051400003/System.Numerics.dll.REMOVED.git-id index 03c43ab446..2a0290cb23 100644 --- a/mcs/class/lib/monolite-darwin/1051400003/System.Numerics.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-darwin/1051400003/System.Numerics.dll.REMOVED.git-id @@ -1 +1 @@ -abf20bddd551faa4c03903b90d5ef125923a6a58 \ No newline at end of file +f1e8c1f280e9ff9af702f512cdbca81dc786a827 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051400003/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051400003/System.Security.dll.REMOVED.git-id index 46e3b6a586..2017daeda1 100644 --- a/mcs/class/lib/monolite-darwin/1051400003/System.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-darwin/1051400003/System.Security.dll.REMOVED.git-id @@ -1 +1 @@ -3a253a3488929d890119bb844ed58e36e6a9b20d \ No newline at end of file +edaf454cb91d45a177854f2fb969577a7dd2e73e \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051400003/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051400003/System.Xml.dll.REMOVED.git-id index da8809f50a..be62c63d1a 100644 --- a/mcs/class/lib/monolite-darwin/1051400003/System.Xml.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-darwin/1051400003/System.Xml.dll.REMOVED.git-id @@ -1 +1 @@ -f9d99688c9ea9c2a3c6d751ebcc47a65e35f4cd1 \ No newline at end of file +c30b91929a614ec4b2e8d7c5e1450292ad0e927d \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051400003/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051400003/mcs.exe.REMOVED.git-id index e484f7173c..c90b4edd1f 100644 --- a/mcs/class/lib/monolite-darwin/1051400003/mcs.exe.REMOVED.git-id +++ b/mcs/class/lib/monolite-darwin/1051400003/mcs.exe.REMOVED.git-id @@ -1 +1 @@ -d5beee2f9672bee46acd54553c2a6cf4f66d4a57 \ No newline at end of file +a256efa8af047b3a388540cf6f2c6d89220b2907 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051400003/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051400003/mscorlib.dll.REMOVED.git-id index 11ef5b9aac..9c30264a78 100644 --- a/mcs/class/lib/monolite-darwin/1051400003/mscorlib.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-darwin/1051400003/mscorlib.dll.REMOVED.git-id @@ -1 +1 @@ -fccf96191cc72249f43f2d18d25931f1aba8b06b \ No newline at end of file +c6ad5451a7b726d21eed3052d4f9ec42d4ebf2ad \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051400003/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051400003/Mono.Security.dll.REMOVED.git-id index a74d31204c..b9068cada5 100644 --- a/mcs/class/lib/monolite-linux/1051400003/Mono.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-linux/1051400003/Mono.Security.dll.REMOVED.git-id @@ -1 +1 @@ -88463079f1bc9e293ff4eeffc52b8fe7ddb4b61d \ No newline at end of file +09ec0df8466f5935dd3109d5702a6e5a0e7d11cc \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051400003/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051400003/System.Configuration.dll.REMOVED.git-id index 56000f86f8..2852954eb0 100644 --- a/mcs/class/lib/monolite-linux/1051400003/System.Configuration.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-linux/1051400003/System.Configuration.dll.REMOVED.git-id @@ -1 +1 @@ -69022cbbe03b81539b541184bb204f1027e88e47 \ No newline at end of file +a5407a65a42139eac82ff8531f3941a3c30b3c6e \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051400003/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051400003/System.Numerics.dll.REMOVED.git-id index 03c43ab446..2a0290cb23 100644 --- a/mcs/class/lib/monolite-linux/1051400003/System.Numerics.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-linux/1051400003/System.Numerics.dll.REMOVED.git-id @@ -1 +1 @@ -abf20bddd551faa4c03903b90d5ef125923a6a58 \ No newline at end of file +f1e8c1f280e9ff9af702f512cdbca81dc786a827 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051400003/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051400003/System.Security.dll.REMOVED.git-id index 46e3b6a586..2017daeda1 100644 --- a/mcs/class/lib/monolite-linux/1051400003/System.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-linux/1051400003/System.Security.dll.REMOVED.git-id @@ -1 +1 @@ -3a253a3488929d890119bb844ed58e36e6a9b20d \ No newline at end of file +edaf454cb91d45a177854f2fb969577a7dd2e73e \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051400003/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051400003/System.Xml.dll.REMOVED.git-id index da8809f50a..be62c63d1a 100644 --- a/mcs/class/lib/monolite-linux/1051400003/System.Xml.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-linux/1051400003/System.Xml.dll.REMOVED.git-id @@ -1 +1 @@ -f9d99688c9ea9c2a3c6d751ebcc47a65e35f4cd1 \ No newline at end of file +c30b91929a614ec4b2e8d7c5e1450292ad0e927d \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051400003/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051400003/mcs.exe.REMOVED.git-id index e484f7173c..c90b4edd1f 100644 --- a/mcs/class/lib/monolite-linux/1051400003/mcs.exe.REMOVED.git-id +++ b/mcs/class/lib/monolite-linux/1051400003/mcs.exe.REMOVED.git-id @@ -1 +1 @@ -d5beee2f9672bee46acd54553c2a6cf4f66d4a57 \ No newline at end of file +a256efa8af047b3a388540cf6f2c6d89220b2907 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051400003/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051400003/mscorlib.dll.REMOVED.git-id index 11ef5b9aac..9c30264a78 100644 --- a/mcs/class/lib/monolite-linux/1051400003/mscorlib.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-linux/1051400003/mscorlib.dll.REMOVED.git-id @@ -1 +1 @@ -fccf96191cc72249f43f2d18d25931f1aba8b06b \ No newline at end of file +c6ad5451a7b726d21eed3052d4f9ec42d4ebf2ad \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051400003/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051400003/Mono.Security.dll.REMOVED.git-id index a74d31204c..b9068cada5 100644 --- a/mcs/class/lib/monolite-win32/1051400003/Mono.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-win32/1051400003/Mono.Security.dll.REMOVED.git-id @@ -1 +1 @@ -88463079f1bc9e293ff4eeffc52b8fe7ddb4b61d \ No newline at end of file +09ec0df8466f5935dd3109d5702a6e5a0e7d11cc \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051400003/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051400003/System.Configuration.dll.REMOVED.git-id index 56000f86f8..2852954eb0 100644 --- a/mcs/class/lib/monolite-win32/1051400003/System.Configuration.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-win32/1051400003/System.Configuration.dll.REMOVED.git-id @@ -1 +1 @@ -69022cbbe03b81539b541184bb204f1027e88e47 \ No newline at end of file +a5407a65a42139eac82ff8531f3941a3c30b3c6e \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051400003/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051400003/System.Numerics.dll.REMOVED.git-id index 03c43ab446..2a0290cb23 100644 --- a/mcs/class/lib/monolite-win32/1051400003/System.Numerics.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-win32/1051400003/System.Numerics.dll.REMOVED.git-id @@ -1 +1 @@ -abf20bddd551faa4c03903b90d5ef125923a6a58 \ No newline at end of file +f1e8c1f280e9ff9af702f512cdbca81dc786a827 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051400003/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051400003/System.Security.dll.REMOVED.git-id index 46e3b6a586..2017daeda1 100644 --- a/mcs/class/lib/monolite-win32/1051400003/System.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-win32/1051400003/System.Security.dll.REMOVED.git-id @@ -1 +1 @@ -3a253a3488929d890119bb844ed58e36e6a9b20d \ No newline at end of file +edaf454cb91d45a177854f2fb969577a7dd2e73e \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051400003/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051400003/System.Xml.dll.REMOVED.git-id index da8809f50a..be62c63d1a 100644 --- a/mcs/class/lib/monolite-win32/1051400003/System.Xml.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-win32/1051400003/System.Xml.dll.REMOVED.git-id @@ -1 +1 @@ -f9d99688c9ea9c2a3c6d751ebcc47a65e35f4cd1 \ No newline at end of file +c30b91929a614ec4b2e8d7c5e1450292ad0e927d \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051400003/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051400003/mcs.exe.REMOVED.git-id index e484f7173c..c90b4edd1f 100644 --- a/mcs/class/lib/monolite-win32/1051400003/mcs.exe.REMOVED.git-id +++ b/mcs/class/lib/monolite-win32/1051400003/mcs.exe.REMOVED.git-id @@ -1 +1 @@ -d5beee2f9672bee46acd54553c2a6cf4f66d4a57 \ No newline at end of file +a256efa8af047b3a388540cf6f2c6d89220b2907 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051400003/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051400003/mscorlib.dll.REMOVED.git-id index 11ef5b9aac..9c30264a78 100644 --- a/mcs/class/lib/monolite-win32/1051400003/mscorlib.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite-win32/1051400003/mscorlib.dll.REMOVED.git-id @@ -1 +1 @@ -fccf96191cc72249f43f2d18d25931f1aba8b06b \ No newline at end of file +c6ad5451a7b726d21eed3052d4f9ec42d4ebf2ad \ No newline at end of file diff --git a/mcs/tools/mono-api-html/ApiChange.cs b/mcs/tools/mono-api-html/ApiChange.cs index 6573f08099..a7e802d85e 100644 --- a/mcs/tools/mono-api-html/ApiChange.cs +++ b/mcs/tools/mono-api-html/ApiChange.cs @@ -28,9 +28,7 @@ namespace Xamarin.ApiDiff public ApiChange AppendAdded (string text, bool breaking = false) { - Member.Append (""); - Member.Append (text); - Member.Append (""); + Formatter.Current.DiffAddition (Member, text, breaking); Breaking |= breaking; AnyChange = true; return this; @@ -38,9 +36,7 @@ namespace Xamarin.ApiDiff public ApiChange AppendRemoved (string text, bool breaking = true) { - Member.Append (""); - Member.Append (text); - Member.Append (""); + Formatter.Current.DiffRemoval (Member, text, breaking); Breaking |= breaking; AnyChange = true; return this; @@ -48,12 +44,7 @@ namespace Xamarin.ApiDiff public ApiChange AppendModified (string old, string @new, bool breaking = true) { - if (old.Length > 0) - AppendRemoved (old, breaking); - if (old.Length > 0 && @new.Length > 0) - Append (" "); - if (@new.Length > 0) - AppendAdded (@new); + Formatter.Current.DiffModification (Member, old, @new, breaking); Breaking |= breaking; AnyChange = true; return this; diff --git a/mcs/tools/mono-api-html/ApiDiff.cs b/mcs/tools/mono-api-html/ApiDiff.cs index 1304184251..a895cfd332 100644 --- a/mcs/tools/mono-api-html/ApiDiff.cs +++ b/mcs/tools/mono-api-html/ApiDiff.cs @@ -7,9 +7,10 @@ // that gdiff.sh produced // // Authors -// Sebastien Pouliot +// Sebastien Pouliot // // Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com +// Copyright 2018 Microsoft Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -56,6 +57,7 @@ namespace Xamarin.ApiDiff { public static string Namespace { get; set; } public static string Type { get; set; } public static string BaseType { get; set; } + public static string Parent { get; set; } public static int Indent { get; set; } @@ -134,6 +136,7 @@ namespace Xamarin.ApiDiff { { "ignore-nonbreaking", "Ignore all nonbreaking changes", v => State.IgnoreNonbreaking = true }, { "v|verbose:", "Verbosity level; when set, will print debug messages", (int? v) => State.Verbosity = v ?? (State.Verbosity + 1)}, + { "md|markdown", "Output markdown instead of HTML", v => Formatter.Current = new MarkdownFormatter () }, new ResponseFileSource (), }; @@ -144,6 +147,10 @@ namespace Xamarin.ApiDiff { showHelp = true; } + // unless specified default to HTML + if (Formatter.Current == null) + Formatter.Current = new HtmlFormatter (); + if (State.IgnoreNonbreaking) { State.IgnoreAddedPropertySetters = true; State.IgnoreVirtualChanges = true; @@ -189,100 +196,14 @@ namespace Xamarin.ApiDiff { } if (diffHtml.Length > 0) { using (var file = new StreamWriter (diff)) { - file.WriteLine ("
"); - if (State.Colorize) { - file.WriteLine (""); - } - file.WriteLine ( -@""); - if (ac.SourceAssembly == ac.TargetAssembly) { - file.WriteLine ("

{0}.dll

", ac.SourceAssembly); - } else { - file.WriteLine ("

{0}.dll vs {1}.dll

", ac.SourceAssembly, ac.TargetAssembly); - } - if (!State.IgnoreNonbreaking) { - file.WriteLine ("Hide non-breaking changes"); - file.WriteLine (""); - file.WriteLine ("
"); - } - file.WriteLine ("
"); + var title = $"{ac.SourceAssembly}.dll"; + if (ac.SourceAssembly != ac.TargetAssembly) + title += $" vs {ac.TargetAssembly}.dll"; + Formatter.Current.BeginDocument (file, $"API diff: {title}"); + Formatter.Current.BeginAssembly (file); file.Write (diffHtml); - file.WriteLine ("
"); - file.WriteLine ("
"); + Formatter.Current.EndAssembly (file); + Formatter.Current.EndDocument (file); } } } else { diff --git a/mcs/tools/mono-api-html/ClassComparer.cs b/mcs/tools/mono-api-html/ClassComparer.cs index 887a5dddfb..cf05a95049 100644 --- a/mcs/tools/mono-api-html/ClassComparer.cs +++ b/mcs/tools/mono-api-html/ClassComparer.cs @@ -69,18 +69,15 @@ namespace Xamarin.ApiDiff { public override void Added (XElement target, bool wasParentAdded) { - string name = target.Attribute ("name").Value; - var addedDescription = $"{State.Namespace}.{name}: Added type"; + var addedDescription = $"{State.Namespace}.{State.Type}: Added type"; State.LogDebugMessage ($"Possible -n value: {addedDescription}"); if (State.IgnoreNew.Any (re => re.IsMatch (addedDescription))) return; - Output.WriteLine ("
", name); - Output.WriteLine ("

New Type {0}.{1}

", State.Namespace, name); - Output.WriteLine ("
");
+
+			Formatter.BeginTypeAddition (Output);
 			State.Indent = 0;
 			AddedInner (target);
-			Output.WriteLine ("
"); - Output.WriteLine ("
", name); + Formatter.EndTypeAddition (Output); } public void AddedInner (XElement target) @@ -149,9 +146,10 @@ namespace Xamarin.ApiDiff { Output.WriteLine (" {"); + State.Indent++; var t = target.Element ("constructors"); if (t != null) { - Indent ().WriteLine ("\t// constructors"); + Indent ().WriteLine ("// constructors"); foreach (var ctor in t.Elements ("constructor")) ccomparer.Added (ctor, true); } @@ -159,7 +157,7 @@ namespace Xamarin.ApiDiff { t = target.Element ("fields"); if (t != null) { if (type != "enum") - Indent ().WriteLine ("\t// fields"); + Indent ().WriteLine ("// fields"); else SetContext (target); foreach (var field in t.Elements ("field")) @@ -168,21 +166,21 @@ namespace Xamarin.ApiDiff { t = target.Element ("properties"); if (t != null) { - Indent ().WriteLine ("\t// properties"); + Indent ().WriteLine ("// properties"); foreach (var property in t.Elements ("property")) pcomparer.Added (property, true); } t = target.Element ("events"); if (t != null) { - Indent ().WriteLine ("\t// events"); + Indent ().WriteLine ("// events"); foreach (var evnt in t.Elements ("event")) ecomparer.Added (evnt, true); } t = target.Element ("methods"); if (t != null) { - Indent ().WriteLine ("\t// methods"); + Indent ().WriteLine ("// methods"); foreach (var method in t.Elements ("method")) mcomparer.Added (method, true); } @@ -190,13 +188,14 @@ namespace Xamarin.ApiDiff { t = target.Element ("classes"); if (t != null) { Output.WriteLine (); - Indent ().WriteLine ("\t// inner types"); + Indent ().WriteLine ("// inner types"); + State.Parent = State.Type; kcomparer = new NestedClassComparer (); - State.Indent++; foreach (var inner in t.Elements ("class")) kcomparer.AddedInner (inner); - State.Indent--; + State.Type = State.Parent; } + State.Indent--; Indent ().WriteLine ("}"); } @@ -227,8 +226,10 @@ namespace Xamarin.ApiDiff { if (sb != tb && !State.IgnoreRemoved.Any (re => re.IsMatch (rm)) && !(State.IgnoreNonbreaking && IsBaseChangeCompatible (sb, tb))) { - Output.Write ("Modified base type: "); - Output.WriteLine (new ApiChange ($"{State.Namespace}.{State.Type}").AppendModified (sb, tb, true).Member.ToString ()); + Formatter.BeginMemberModification (Output, "Modified base type"); + var apichange = new ApiChange ($"{State.Namespace}.{State.Type}").AppendModified (sb, tb, true); + Formatter.Diff (Output, apichange); + Formatter.EndMemberModification (Output); } ccomparer.Compare (source, target); @@ -242,17 +243,18 @@ namespace Xamarin.ApiDiff { if (si != null) { var ti = target.Element ("classes"); kcomparer = new NestedClassComparer (); + State.Parent = State.Type; kcomparer.Compare (si.Elements ("class"), ti == null ? null : ti.Elements ("class")); + State.Type = State.Parent; } var s = (Output as StringWriter).ToString (); State.Output = output; if (s.Length > 0) { - var tn = GetTypeName (target); - Output.WriteLine ("
", tn); - Output.WriteLine ("

Type Changed: {0}.{1}

", State.Namespace, GetTypeName (target)); + SetContext (target); + Formatter.BeginTypeModification (Output); Output.WriteLine (s); - Output.WriteLine ("
", tn); + Formatter.EndTypeModification (Output); } } @@ -261,14 +263,15 @@ namespace Xamarin.ApiDiff { if (source.Elements ("attributes").SelectMany (a => a.Elements ("attribute")).Any (c => c.Attribute ("name")?.Value == "System.ObsoleteAttribute")) return; - string name = State.Namespace + "." + GetTypeName (source); + string name = State.Namespace + "." + State.Type; var memberDescription = $"{name}: Removed type"; State.LogDebugMessage ($"Possible -r value: {memberDescription}"); if (State.IgnoreRemoved.Any (re => re.IsMatch (name))) return; - Output.Write ("

Removed Type {0}

", name); + Formatter.BeginTypeRemoval (Output); + Formatter.EndTypeRemoval (Output); } public virtual string GetTypeName (XElement type) @@ -281,11 +284,13 @@ namespace Xamarin.ApiDiff { public override void SetContext (XElement current) { + State.Type = State.Parent + "." + current.GetAttribute ("name"); + State.BaseType = current.GetAttribute ("base"); } public override string GetTypeName (XElement type) { - return State.Type + "." + base.GetTypeName (type); + return State.Parent + "." + base.GetTypeName (type); } } -} +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/Comparer.cs b/mcs/tools/mono-api-html/Comparer.cs index 4210b9b95f..ddd4a4615e 100644 --- a/mcs/tools/mono-api-html/Comparer.cs +++ b/mcs/tools/mono-api-html/Comparer.cs @@ -41,6 +41,10 @@ namespace Xamarin.ApiDiff { get { return State.Output; } } + public Formatter Formatter { + get { return Formatter.Current; } + } + protected TextWriter Indent () { for (int i = 0; i < State.Indent; i++) diff --git a/mcs/tools/mono-api-html/ConstructorComparer.cs b/mcs/tools/mono-api-html/ConstructorComparer.cs index a265c569cd..0fd136af5b 100644 --- a/mcs/tools/mono-api-html/ConstructorComparer.cs +++ b/mcs/tools/mono-api-html/ConstructorComparer.cs @@ -125,7 +125,7 @@ namespace Xamarin.ApiDiff { foreach (var p in genericp.Elements ("generic-parameter")) { list.Add (p.GetTypeName ("name")); } - sb.Append ("<").Append (String.Join (", ", list)).Append (">"); + sb.Append (Formatter.LesserThan).Append (String.Join (", ", list)).Append (Formatter.GreaterThan); } sb.Append (" ("); diff --git a/mcs/tools/mono-api-html/FieldComparer.cs b/mcs/tools/mono-api-html/FieldComparer.cs index 221c684dc9..535205b235 100644 --- a/mcs/tools/mono-api-html/FieldComparer.cs +++ b/mcs/tools/mono-api-html/FieldComparer.cs @@ -186,28 +186,5 @@ namespace Xamarin.ApiDiff { return sb.ToString (); } - - public override void BeforeAdding (IEnumerable list) - { - first = true; - if (State.BaseType == "System.Enum") { - Output.WriteLine ("
"); - Output.WriteLine ("

Added value{0}:

", list.Count () > 1 ? "s" : String.Empty); - Output.WriteLine ("
");
-			} else {
-				base.BeforeAdding (list);
-			}
-		}
-
-		public override void BeforeRemoving (IEnumerable list)
-		{
-			first = true;
-			if (State.BaseType == "System.Enum") {
-				Output.WriteLine ("

Removed value{0}:

", list.Count () > 1 ? "s" : String.Empty); - Output.WriteLine ("
");
-			} else {
-				base.BeforeRemoving (list);
-			}
-		}
 	}
 }
\ No newline at end of file
diff --git a/mcs/tools/mono-api-html/Formatter.cs b/mcs/tools/mono-api-html/Formatter.cs
new file mode 100644
index 0000000000..88318600d8
--- /dev/null
+++ b/mcs/tools/mono-api-html/Formatter.cs
@@ -0,0 +1,88 @@
+// 
+// Authors
+//    Sebastien Pouliot  
+//
+// Copyright 2018 Microsoft Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Xml.Linq;
+using System.Text;
+
+namespace Xamarin.ApiDiff {
+
+	public abstract class Formatter {
+
+		public static Formatter Current { get; set; }
+
+		public abstract string LesserThan { get; }
+		public abstract string GreaterThan { get; }
+
+		public abstract void BeginDocument (TextWriter output, string title);
+		public virtual void EndDocument (TextWriter output)
+		{
+		}
+
+		public abstract void BeginAssembly (TextWriter output);
+		public virtual void EndAssembly (TextWriter output)
+		{
+		}
+
+		public abstract void BeginNamespace (TextWriter output, string action = "");
+		public virtual void EndNamespace (TextWriter output)
+		{
+		}
+
+		public abstract void BeginTypeAddition (TextWriter output);
+		public abstract void EndTypeAddition (TextWriter output);
+
+		public abstract void BeginTypeModification (TextWriter output);
+		public virtual void EndTypeModification (TextWriter output)
+		{
+		}
+
+		public abstract void BeginTypeRemoval (TextWriter output);
+		public virtual void EndTypeRemoval (TextWriter output)
+		{
+		}
+
+		public abstract void BeginMemberAddition (TextWriter output, IEnumerable list, MemberComparer member);
+		public abstract void AddMember (TextWriter output, MemberComparer member, bool isInterfaceBreakingChange, string obsolete, string description);
+		public abstract void EndMemberAddition (TextWriter output);
+
+		public abstract void BeginMemberModification (TextWriter output, string sectionName);
+		public abstract void EndMemberModification (TextWriter output);
+
+		public abstract void BeginMemberRemoval (TextWriter output, IEnumerable list, MemberComparer member);
+		public abstract void RemoveMember (TextWriter output, MemberComparer member, bool breaking, string obsolete, string description);
+		public abstract void EndMemberRemoval (TextWriter output);
+
+		public abstract void RenderObsoleteMessage (StringBuilder output, MemberComparer member, string description, string optionalObsoleteMessage);
+
+		public abstract void DiffAddition (StringBuilder output, string text, bool breaking);
+		public abstract void DiffModification (StringBuilder output, string old, string @new, bool breaking);
+		public abstract void DiffRemoval (StringBuilder output, string text, bool breaking);
+		public abstract void Diff (TextWriter output, ApiChange apichange);
+	}
+}
diff --git a/mcs/tools/mono-api-html/Helpers.cs b/mcs/tools/mono-api-html/Helpers.cs
index 8769785c47..854c1b2938 100644
--- a/mcs/tools/mono-api-html/Helpers.cs
+++ b/mcs/tools/mono-api-html/Helpers.cs
@@ -143,7 +143,7 @@ namespace Xamarin.ApiDiff {
 			if (pos >= 0) {
 				int end = type.LastIndexOf (']');
 				string subtype = type.Substring (pos + 3, end - pos - 3);
-				return type.Substring (0, pos) + "<" + GetTypeName (subtype) + ">";
+				return type.Substring (0, pos) + Formatter.Current.LesserThan + GetTypeName (subtype) + Formatter.Current.GreaterThan;
 			}
 
 			switch (type) {
diff --git a/mcs/tools/mono-api-html/HtmlFormatter.cs b/mcs/tools/mono-api-html/HtmlFormatter.cs
new file mode 100644
index 0000000000..55fd4f4ba6
--- /dev/null
+++ b/mcs/tools/mono-api-html/HtmlFormatter.cs
@@ -0,0 +1,308 @@
+// 
+// Authors
+//    Sebastien Pouliot  
+//
+// Copyright 2013 Xamarin Inc. http://www.xamarin.com
+// Copyright 2018 Microsoft Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml.Linq;
+using System.Text;
+
+namespace Xamarin.ApiDiff {
+
+	public class HtmlFormatter : Formatter {
+
+		public override string LesserThan => "<";
+		public override string GreaterThan => ">";
+
+		protected void Indent (TextWriter output)
+		{
+			 for (int i = 0; i < State.Indent; i++)
+			 	output.Write ("\t");
+		}
+
+		public override void BeginDocument (TextWriter output, string title)
+		{
+			output.WriteLine ("
"); + if (State.Colorize) { + output.WriteLine (""); + } + output.WriteLine ( + @""); + } + + public override void BeginAssembly (TextWriter output) + { + output.WriteLine ($"

{State.Assembly}.dll

"); + if (!State.IgnoreNonbreaking) { + output.WriteLine ("Hide non-breaking changes"); + output.WriteLine (""); + output.WriteLine ("
"); + } + output.WriteLine ("
"); + } + + public override void EndAssembly (TextWriter output) + { + output.WriteLine ("
"); + output.WriteLine ("
"); + } + + public override void BeginNamespace (TextWriter output, string action) + { + output.WriteLine ($"
"); + output.WriteLine ($"

{action}Namespace {State.Namespace}

"); + } + + public override void EndNamespace (TextWriter output) + { + output.WriteLine ($"
"); + } + + public override void BeginTypeAddition (TextWriter output) + { + output.WriteLine ($"
"); + output.WriteLine ($"

New Type {State.Namespace}.{State.Type}

"); + output.WriteLine ("
");
+		}
+
+		public override void EndTypeAddition (TextWriter output)
+		{
+			output.WriteLine ("
"); + output.WriteLine ($"
"); + } + + public override void BeginTypeModification (TextWriter output) + { + output.WriteLine ($"
"); + output.WriteLine ($"

Type Changed: {State.Namespace}.{State.Type}

"); + } + + public override void EndTypeModification (TextWriter output) + { + output.WriteLine ($"
"); + } + + public override void BeginTypeRemoval (TextWriter output) + { + output.Write ($"

Removed Type {State.Namespace}.{State.Type}

"); + } + + public override void BeginMemberAddition (TextWriter output, IEnumerable list, MemberComparer member) + { + output.WriteLine ("
"); + if (State.BaseType == "System.Enum") { + output.WriteLine ("

Added value{0}:

", list.Count () > 1 ? "s" : String.Empty); + output.WriteLine ("
");
+			} else {
+				output.WriteLine ("

Added {0}:

", list.Count () > 1 ? member.GroupName : member.ElementName); + output.WriteLine ("
");
+			}
+			State.Indent++;
+		}
+
+		public override void AddMember (TextWriter output, MemberComparer member, bool isInterfaceBreakingChange, string obsolete, string description)
+		{
+			output.Write ("", member.ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
+			output.Write ($"{obsolete}{description}");
+			output.WriteLine ("");
+		}
+
+		public override void EndMemberAddition (TextWriter output)
+		{
+			State.Indent--;
+			output.WriteLine ("
"); + output.WriteLine ("
"); + } + + public override void BeginMemberModification (TextWriter output, string sectionName) + { + output.WriteLine ($"

{sectionName}:

"); + output.WriteLine ("
");
+		}
+
+		public override void EndMemberModification (TextWriter output)
+		{
+			output.WriteLine ("
"); + } + + public override void BeginMemberRemoval (TextWriter output, IEnumerable list, MemberComparer member) + { + if (State.BaseType == "System.Enum") { + output.WriteLine ("

Removed value{0}:

", list.Count () > 1 ? "s" : String.Empty); + output.WriteLine ("
");
+			} else {
+				output.WriteLine ("

Removed {0}:

\n", list.Count () > 1 ? member.GroupName : member.ElementName); + output.WriteLine ("
");
+			}
+			State.Indent++;
+		}
+
+		public override void RemoveMember (TextWriter output, MemberComparer member, bool breaking, string obsolete, string description)
+		{
+			Indent (output);
+			output.Write ("", member.ElementName, breaking ? "data-is-breaking" : "data-is-non-breaking", breaking ? "breaking" : string.Empty);
+			if (obsolete.Length > 0) {
+				output.Write (obsolete);
+				Indent (output);
+			}
+			output.Write (description);
+			output.WriteLine ("");
+		}
+
+		public override void RenderObsoleteMessage (StringBuilder output, MemberComparer member, string description, string optionalObsoleteMessage)
+		{
+			output.Append ($"");
+			output.Append ("[Obsolete (");
+			if (!String.IsNullOrEmpty (optionalObsoleteMessage))
+				output.Append ('"').Append (optionalObsoleteMessage).Append ('"');
+			output.AppendLine (")]");
+			output.Append (description);
+			output.Append ("");
+		}
+
+		public override void EndMemberRemoval (TextWriter output)
+		{
+			State.Indent--;
+			output.WriteLine ("
");; + } + + public override void DiffAddition (StringBuilder output, string text, bool breaking) + { + output.Append (""); + output.Append (text); + output.Append (""); + } + + public override void DiffModification (StringBuilder output, string old, string @new, bool breaking) + { + if (old.Length > 0) + DiffRemoval (output, old, breaking); + if (old.Length > 0 && @new.Length > 0) + output.Append (' '); + if (@new.Length > 0) + DiffAddition (output, @new, false); + } + + public override void DiffRemoval (StringBuilder output, string text, bool breaking) + { + output.Append (""); + output.Append (text); + output.Append (""); + } + + public override void Diff (TextWriter output, ApiChange apichange) + { + output.Write ("
", apichange.Breaking ? "data-is-breaking" : "data-is-non-breaking"); + foreach (var line in apichange.Member.ToString ().Split ('\n')) { + output.Write ('\t'); + output.WriteLine (line); + } + output.Write ("
"); + } + } +} diff --git a/mcs/tools/mono-api-html/MarkdownFormatter.cs b/mcs/tools/mono-api-html/MarkdownFormatter.cs new file mode 100644 index 0000000000..9b8b65dd10 --- /dev/null +++ b/mcs/tools/mono-api-html/MarkdownFormatter.cs @@ -0,0 +1,199 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2018 Microsoft Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using System.Text; + +namespace Xamarin.ApiDiff { + + public class MarkdownFormatter : Formatter { + + public override string LesserThan => "<"; + public override string GreaterThan => ">"; + + public override void BeginDocument (TextWriter output, string title) + { + output.WriteLine ($"# {title}"); + output.WriteLine (); + } + + public override void BeginAssembly (TextWriter output) + { + // this serves as ToC (table of content) entries so we skip the "Assembly: " prefix + output.WriteLine ($"## {State.Assembly}.dll"); + output.WriteLine (); + } + + public override void BeginNamespace (TextWriter output, string action) + { + output.WriteLine ($"### {action}Namespace {State.Namespace}"); + output.WriteLine (); + } + + public override void BeginTypeAddition (TextWriter output) + { + output.WriteLine ($"#### New Type: {@State.Namespace}.{State.Type}"); + output.WriteLine (); + output.WriteLine ("```csharp"); + } + + public override void EndTypeAddition (TextWriter output) + { + output.WriteLine ("```"); + output.WriteLine (); + } + + public override void BeginTypeModification (TextWriter output) + { + output.WriteLine ($"#### Type Changed: {State.Namespace}.{State.Type}"); + output.WriteLine (); + } + + public override void BeginTypeRemoval (TextWriter output) + { + output.WriteLine ($"#### Removed Type {State.Namespace}.{State.Type}"); + } + + public override void BeginMemberAddition (TextWriter output, IEnumerable list, MemberComparer member) + { + if (State.BaseType == "System.Enum") { + output.WriteLine ("Added value{0}:", list.Count () > 1 ? "s" : String.Empty); + } else { + output.WriteLine ("Added {0}:", list.Count () > 1 ? member.GroupName : member.ElementName); + } + output.WriteLine (); + output.WriteLine ("```csharp"); + } + + public override void AddMember (TextWriter output, MemberComparer member, bool isInterfaceBreakingChange, string obsolete, string description) + { + output.Write (obsolete); + output.WriteLine (description); + } + + public override void EndMemberAddition (TextWriter output) + { + output.WriteLine ("```"); + output.WriteLine (); + } + + public override void BeginMemberModification (TextWriter output, string sectionName) + { + output.WriteLine ($"{sectionName}:"); + output.WriteLine (); + output.WriteLine ("```diff"); + } + + public override void EndMemberModification (TextWriter output) + { + output.WriteLine ("```"); + output.WriteLine (); + } + + public override void BeginMemberRemoval (TextWriter output, IEnumerable list, MemberComparer member) + { + if (State.BaseType == "System.Enum") { + output.WriteLine ("Removed value{0}:", list.Count () > 1 ? "s" : String.Empty); + } else { + output.WriteLine ("Removed {0}:", list.Count () > 1 ? member.GroupName : member.ElementName); + } + output.WriteLine (); + output.WriteLine ("```csharp"); + } + + public override void RemoveMember (TextWriter output, MemberComparer member, bool is_breaking, string obsolete, string description) + { + output.Write (obsolete); + output.WriteLine (description); + } + + public override void EndMemberRemoval (TextWriter output) + { + output.WriteLine ("```"); + output.WriteLine (); + } + + public override void RenderObsoleteMessage (StringBuilder output, MemberComparer member, string description, string optionalObsoleteMessage) + { + output.Append ("[Obsolete ("); + if (!String.IsNullOrEmpty (optionalObsoleteMessage)) + output.Append ('"').Append (optionalObsoleteMessage).Append ('"'); + output.AppendLine (")]"); + output.Append (description); + } + + string Clean (string line, string remove, string keep) + { + var cleaned = line.Replace (remove, String.Empty); + int s = cleaned.IndexOf (keep, StringComparison.Ordinal); + if (s != -1) { + int e = cleaned.IndexOf (keep, s + keep.Length, StringComparison.Ordinal); + cleaned = cleaned.Remove (s, e - s + keep.Length); + } + while (cleaned.Contains (" ")) + cleaned = cleaned.Replace (" ", " "); + return cleaned; + } + + public override void DiffAddition (StringBuilder output, string text, bool breaking) + { + output.Append ("+++"); + output.Append (text); + output.Append ("+++"); + } + + public override void DiffModification (StringBuilder output, string old, string @new, bool breaking) + { + if (old.Length > 0) + DiffAddition (output, old, breaking); + if (@new.Length > 0) + DiffRemoval (output, @new, true); + } + + public override void DiffRemoval (StringBuilder output, string text, bool breaking) + { + output.Append ("---"); + output.Append (text); + output.Append ("---"); + } + + public override void Diff (TextWriter output, ApiChange apichange) + { + foreach (var line in apichange.Member.ToString ().Split ('\n')) { + if (line.Contains ("+++")) { + output.WriteLine ("-{0}", Clean (line, "+++", "---")); + output.WriteLine ("+{0}", Clean (line, "---", "+++")); + } else { + output.WriteLine (" {0}", line); + } + } + } + } +} diff --git a/mcs/tools/mono-api-html/MemberComparer.cs b/mcs/tools/mono-api-html/MemberComparer.cs index b32e17e343..413be610ea 100644 --- a/mcs/tools/mono-api-html/MemberComparer.cs +++ b/mcs/tools/mono-api-html/MemberComparer.cs @@ -128,13 +128,13 @@ namespace Xamarin.ApiDiff { if (State.IgnoreAdded.Any (re => re.IsMatch (memberDescription))) continue; if (!a) { - BeforeAdding (elements); + Formatter.BeginMemberAddition (Output, elements, this); a = true; } Added (item, false); } if (a) - AfterAdding (); + Formatter.EndMemberAddition (Output); } void Modify (ApiChanges modified) @@ -142,18 +142,13 @@ namespace Xamarin.ApiDiff { foreach (var changes in modified) { if (State.IgnoreNonbreaking && changes.Value.All (c => !c.Breaking)) continue; - Output.WriteLine ("

{0}:

", changes.Key); - Output.WriteLine ("
");
+				Formatter.BeginMemberModification (Output, changes.Key);
 				foreach (var element in changes.Value) {
 					if (State.IgnoreNonbreaking && !element.Breaking)
 						continue;
-					Output.Write ("
", 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 ("
"); - + Formatter.Diff (Output, element); } - Output.WriteLine ("
"); + Formatter.EndMemberModification (Output); } } @@ -169,13 +164,14 @@ namespace Xamarin.ApiDiff { if (State.IgnoreNonbreaking && !IsBreakingRemoval (item)) continue; if (!r) { - BeforeRemoving (elements); + Formatter.BeginMemberRemoval (Output, elements, this); + first = true; r = true; } Removed (item); } if (r) - AfterRemoving (); + Formatter.EndMemberRemoval (Output); } public abstract string GetDescription (XElement e); @@ -189,8 +185,6 @@ namespace Xamarin.ApiDiff { if (o.Length > 0) sb.Append (" (\"").Append (o).Append ("\")"); sb.AppendLine ("]"); - for (int i = 0; i < State.Indent + 1; i++) - sb.Append ('\t'); } return sb; } @@ -206,14 +200,6 @@ namespace Xamarin.ApiDiff { return base.Equals (source, target, changes); } - public virtual void BeforeAdding (IEnumerable list) - { - first = true; - Output.WriteLine ("
"); - Output.WriteLine ("

Added {0}:

", list.Count () > 1 ? GroupName : ElementName); - Output.WriteLine ("
");
-		}
-
 		public override void Added (XElement target, bool wasParentAdded)
 		{
 			var o = GetObsoleteMessage (target);
@@ -221,29 +207,14 @@ namespace Xamarin.ApiDiff {
 				Output.WriteLine ();
 			Indent ();
 			bool isInterfaceBreakingChange = !wasParentAdded && IsInInterface (target);
-			Output.Write ("\t", ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
-			Output.Write ("{0}{1}", o, GetDescription (target));
-			Output.WriteLine ("");
+			Formatter.AddMember (Output, this, isInterfaceBreakingChange, o.ToString (), GetDescription (target));
 			first = false;
 		}
 
-		public virtual void AfterAdding ()
-		{
-			Output.WriteLine ("
"); - Output.WriteLine ("
"); - } - public override void Modified (XElement source, XElement target, ApiChanges change) { } - public virtual void BeforeRemoving (IEnumerable list) - { - first = true; - Output.WriteLine ("

Removed {0}:

\n", list.Count () > 1 ? GroupName : ElementName); - Output.WriteLine ("
");
-		}
-
 		public override void Removed (XElement source)
 		{
 			var o = GetObsoleteMessage (source);
@@ -252,18 +223,10 @@ namespace Xamarin.ApiDiff {
 
 			bool is_breaking = IsBreakingRemoval (source);
 
-			Indent ();
-			Output.Write ("\t", ElementName, is_breaking ? "data-is-breaking" : "data-is-non-breaking", is_breaking ? "breaking" : string.Empty);
-			Output.Write ("{0}{1}", o, GetDescription (source));
-			Output.WriteLine ("");
+			Formatter.RemoveMember (Output, this, is_breaking, o.ToString (), GetDescription (source));
 			first = false;
 		}
 
-		public virtual void AfterRemoving ()
-		{
-			Output.WriteLine ("
");; - } - string RenderGenericParameter (XElement gp) { var sb = new StringBuilder (); @@ -291,7 +254,7 @@ namespace Xamarin.ApiDiff { if (srcCount == 0 && tgtCount == 0) return; - change.Append ("<"); + change.Append (Formatter.LesserThan); for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) { if (i > 0) change.Append (", "); @@ -310,7 +273,7 @@ namespace Xamarin.ApiDiff { } } } - change.Append (">"); + change.Append (Formatter.GreaterThan); } protected string FormatValue (string type, string value) @@ -603,13 +566,7 @@ namespace Xamarin.ApiDiff { return; // neither is obsolete var change = new ApiChange (GetDescription (source)); change.Header = "Obsoleted " + GroupName; - change.Append (string.Format ("", ElementName)); - change.Append ("[Obsolete ("); - if (tgtObsolete != string.Empty) - change.Append ("\"").Append (tgtObsolete).Append ("\""); - change.Append (")]\n"); - change.Append (GetDescription (target)); - change.Append (""); + Formatter.RenderObsoleteMessage (change.Member, this, GetDescription (target), tgtObsolete); change.AnyChange = true; changes.Add (source, target, change); } else if (tgtObsolete == null) { diff --git a/mcs/tools/mono-api-html/NamespaceComparer.cs b/mcs/tools/mono-api-html/NamespaceComparer.cs index 65b802ebbe..b509eb5424 100644 --- a/mcs/tools/mono-api-html/NamespaceComparer.cs +++ b/mcs/tools/mono-api-html/NamespaceComparer.cs @@ -57,20 +57,18 @@ namespace Xamarin.ApiDiff { public override void Added (XElement target, bool wasParentAdded) { - string name = target.Attribute ("name").Value; - var namespaceDescription = $"{name}: Added namespace"; + var namespaceDescription = $"{State.Namespace}: Added namespace"; State.LogDebugMessage ($"Possible -n value: {namespaceDescription}"); if (State.IgnoreNew.Any (re => re.IsMatch (namespaceDescription))) return; - Output.WriteLine ("
", name); - Output.WriteLine ("

New Namespace {0}

", name); - Output.WriteLine (); + Formatter.BeginNamespace (Output, "New "); // list all new types - foreach (var addedType in target.Element ("classes").Elements ("class")) + foreach (var addedType in target.Element ("classes").Elements ("class")) { + State.Type = addedType.Attribute ("name").Value; comparer.Added (addedType, true); - Output.WriteLine ("
", name); - Output.WriteLine (); + } + Formatter.EndNamespace (Output); } public override void Modified (XElement source, XElement target, ApiChanges differences) @@ -83,10 +81,9 @@ namespace Xamarin.ApiDiff { State.Output = output; if (s.Length > 0) { var name = target.Attribute ("name").Value; - Output.WriteLine ("
", name); - Output.WriteLine ("

Namespace {0}

", name); + Formatter.BeginNamespace (Output); Output.WriteLine (s); - Output.WriteLine ("
", name); + Formatter.EndNamespace (Output); } } @@ -99,14 +96,14 @@ namespace Xamarin.ApiDiff { if (State.IgnoreRemoved.Any (re => re.IsMatch (namespaceDescription))) return; - Output.WriteLine ("
", name); - Output.WriteLine ("

Removed Namespace {0}

", name); + Formatter.BeginNamespace (Output, "Removed "); Output.WriteLine (); // list all removed types - foreach (var removedType in source.Element ("classes").Elements ("class")) + foreach (var removedType in source.Element ("classes").Elements ("class")) { + State.Type = comparer.GetTypeName (removedType); comparer.Removed (removedType); - Output.WriteLine ("
", name); - Output.WriteLine (); + } + Formatter.EndNamespace (Output); } } } \ No newline at end of file diff --git a/mcs/tools/mono-api-html/mono-api-html.exe.sources b/mcs/tools/mono-api-html/mono-api-html.exe.sources index 69a26798db..f196dd3cd7 100644 --- a/mcs/tools/mono-api-html/mono-api-html.exe.sources +++ b/mcs/tools/mono-api-html/mono-api-html.exe.sources @@ -6,8 +6,11 @@ Comparer.cs ConstructorComparer.cs EventComparer.cs FieldComparer.cs +Formatter.cs Helpers.cs +HtmlFormatter.cs InterfaceComparer.cs +MarkdownFormatter.cs MemberComparer.cs MethodComparer.cs NamespaceComparer.cs diff --git a/mono/mini/mini-llvm.c.REMOVED.git-id b/mono/mini/mini-llvm.c.REMOVED.git-id index 536fa39a8a..c3a9f3902a 100644 --- a/mono/mini/mini-llvm.c.REMOVED.git-id +++ b/mono/mini/mini-llvm.c.REMOVED.git-id @@ -1 +1 @@ -741e2651dcdcdecf5ac93994dfb77b53acf446ba \ No newline at end of file +e6b7b70a3ecfdc193c1fee5bb30558e4224252c8 \ No newline at end of file diff --git a/mono/mini/version.h b/mono/mini/version.h index 92466c122c..20c53f4da9 100644 --- a/mono/mini/version.h +++ b/mono/mini/version.h @@ -1 +1 @@ -#define FULL_VERSION "explicit/1f3334f" +#define FULL_VERSION "explicit/33a9dca" diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo index 15b2e7643af9bb37c2717e9e629a2f8fde38e791..f58d716fe279212846650f58901e3bbbc5db87a3 100644 GIT binary patch delta 20 bcmbQIHBW29Q!aKR1p^B!W5dmFxQw^}N@xaj delta 20 bcmbQIHBW29Q!aKx1p^B!L-WmVxQw^}N^%Bw diff --git a/po/mcs/de.po.REMOVED.git-id b/po/mcs/de.po.REMOVED.git-id index 4f8ab21246..942c643ec5 100644 --- a/po/mcs/de.po.REMOVED.git-id +++ b/po/mcs/de.po.REMOVED.git-id @@ -1 +1 @@ -a5b96637c3a14d3ff54d08a69b9be2dab301459a \ No newline at end of file +d41d73147f2851a5a673fd18b45fceaae78e3025 \ No newline at end of file diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo index b810450541f9ae3b6ba6a30f08558d9c16bccd07..6c7fb28a17afe5eb91f24c4d655cb6c6625b43fd 100644 GIT binary patch delta 20 bcmX?Ef3kjqo+7)Ef`NsVvEgP@#VK+CQHTbr delta 20 bcmX?Ef3kjqo+7)Uf`NsVq4{Q0#VK+CQIZC& diff --git a/po/mcs/es.po.REMOVED.git-id b/po/mcs/es.po.REMOVED.git-id index 6cd4e4ff42..64424bb659 100644 --- a/po/mcs/es.po.REMOVED.git-id +++ b/po/mcs/es.po.REMOVED.git-id @@ -1 +1 @@ -a62d543177eb487ce400a5c919cfc87a7c4b3880 \ No newline at end of file +144a82c66e1f0499961ff7c2fbfbd42f298b91db \ No newline at end of file diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo index 0b3ada0dbfe1b3ba2796bea45f0e7bacafd4e2db..6455e38579baefeb58273122c0eb8b19a44a7c97 100644 GIT binary patch delta 22 dcmeyri1Gg-#tj_m>_!R(7FNcFoB7oXv;bh*2L=ED delta 22 dcmeyri1Gg-#tj_m?1l;k7FLGloB7oXv;bh_2MGWG diff --git a/po/mcs/ja.po.REMOVED.git-id b/po/mcs/ja.po.REMOVED.git-id index a43e96359b..0f134599ea 100644 --- a/po/mcs/ja.po.REMOVED.git-id +++ b/po/mcs/ja.po.REMOVED.git-id @@ -1 +1 @@ -04ee6e6515a55fe2f33a80529c0c3ebab18fc86a \ No newline at end of file +c8f9a61d85ec94cf5bb390a5dfe4cddc3a17b314 \ No newline at end of file diff --git a/po/mcs/mcs.pot b/po/mcs/mcs.pot index 0092baa378..35912285e7 100644 --- a/po/mcs/mcs.pot +++ b/po/mcs/mcs.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: mono 5.14.0.116\n" +"Project-Id-Version: mono 5.14.0.121\n" "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n" -"POT-Creation-Date: 2018-06-01 08:17+0000\n" +"POT-Creation-Date: 2018-06-02 08:31+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo index d9037a68df321d57531b22e7637e972106ae5ad0..d4219a4c83aad8834bb20e43c5e2ed490190d801 100644 GIT binary patch delta 22 ecmaF1gXP%{mJM-J*^LwoEUb(TH>XZzYzF{s(FlA1 delta 22 ecmaF1gXP%{mJM-J*$ov8EUXO8H>XZzYzF{s+X#OE diff --git a/po/mcs/pt_BR.po.REMOVED.git-id b/po/mcs/pt_BR.po.REMOVED.git-id index cd9d18c50f..ba00e1e1b4 100644 --- a/po/mcs/pt_BR.po.REMOVED.git-id +++ b/po/mcs/pt_BR.po.REMOVED.git-id @@ -1 +1 @@ -da5743e70ab27b9dae6a254153bd1ac41d49b5bf \ No newline at end of file +d9b795430351c1d58879bde8bd04efcf57186470 \ No newline at end of file