Skip to content

Conversation

@smitpatel
Copy link
Contributor

@smitpatel smitpatel commented Apr 21, 2017

  • Remove concept of modification
  • Print out breaking changes to be added as exceptions
  • Change format of exception files
  • Use word breaking changes instead of exceptions/exclusions
  • Upgrade to net46
  • Remove compact output option
  • Make netframework & netcore specific baseline/breaking change.

Resolves #154 #163

Sample output:

C:\Users\smpatel\.nuget\packages\internal.aspnetcore.sdk\2.0.0-rc2-t00459e38b\build\ApiCheck.targets(19,5): error : ERROR: Verifying breaking changes for framework net451 failed. [D:\Universe\.r\Microsoft.Data.Sqlite\src\Microsoft.Data.Sqlite.Core\Microsoft.Data.Sqlite.Core.csproj]


  The following types/interfaces have one or more members removed from them.

      public class Microsoft.Data.Sqlite.SqliteDataReader : System.Data.Common.DbDataReader
          public override System.Data.DataTable GetSchemaTable()

      public class Microsoft.Data.Sqlite.SqliteParameter : System.Data.Common.DbParameter
          public override System.Void set_SourceVersion(System.Data.DataRowVersion value)

C:\Users\smpatel\.nuget\packages\internal.aspnetcore.sdk\2.0.0-rc2-t00459e38b\build\ApiCheck.targets(19,5): error : ERROR: The following exclusion is in the exclusion file, but is no longer necessary: [D:\Universe\.r\Microsoft.Data.Sqlite\src\Microsoft.Data.Sqlite.Core\Microsoft.Data.Sqlite.Core.csproj]
  {
    "TypeId": "public class Microsoft.Data.Sqlite.SqliteParameter : System.Data.Common.DbParameter",
    "MemberId": "public override System.Void setfsdf_SourceVersion(System.Data.DataRowVersion value)",
    "Kind": "Removal"
  }

C:\Users\smpatel\.nuget\packages\internal.aspnetcore.sdk\2.0.0-rc2-t00459e38b\build\ApiCheck.targets(19,5): error : ERROR: The following exclusion is in the exclusion file, but is no longer necessary: [D:\Universe\.r\Microsoft.Data.Sqlite\src\Microsoft.Data.Sqlite.Core\Microsoft.Data.Sqlite.Core.csproj]
  {
    "TypeId": "public class Microsoft.Data.Sqlite.SqliteDataReader : System.Data.Common.DbDataReader",
    "MemberId": "public override System.Data.DatfsdaTable GetSchemaTable()",
    "Kind": "Removal"
  }



  Following is the list of exclusions that either need to be added to the list of breaking changes, or the breaking changes themselves need to be reverted:
  [
    {
      "TypeId": "public class Microsoft.Data.Sqlite.SqliteDataReader : System.Data.Common.DbDataReader",
      "MemberId": "public override System.Data.DataTable GetSchemaTable()",
      "Kind": "Removal"
    },
    {
      "TypeId": "public class Microsoft.Data.Sqlite.SqliteParameter : System.Data.Common.DbParameter",
      "MemberId": "public override System.Void set_SourceVersion(System.Data.DataRowVersion value)",
      "Kind": "Removal"
    }
  ]

  The process for breaking changes is described in: https://github.com/aspnet/Home/wiki/Engineering-guidelines#breaking-changes
  The process to add an exclusion to this tool is described in: https://github.com/aspnet/BuildTools/wiki/Api-Check#apicheck-exceptions

Build FAILED.

TODO: update wiki files.

Reaction PRs:

@dnfclas
Copy link

dnfclas commented Apr 21, 2017

@smitpatel,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@smitpatel smitpatel force-pushed the exceptionPrettyPrinter branch 3 times, most recently from c581f07 to a7afff3 Compare April 21, 2017 01:11
<_ApiListingFileSuffix Condition=" '$(_ApiListingFileSuffix)' == '' ">netcore.json</_ApiListingFileSuffix>
<_ApiListingFilePath>$(MSBuildProjectDirectory)\baseline.$(_ApiListingFileSuffix)</_ApiListingFilePath>
<_ApiExclusionsFilePath>$(MSBuildProjectDirectory)\exceptions.$(_ApiListingFileSuffix)</_ApiExclusionsFilePath>
<_ApiExclusionsFilePath>$(MSBuildProjectDirectory)\breakingchanges.$(_ApiListingFileSuffix)</_ApiExclusionsFilePath>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eilon - Though not necessary, we should change the name of exception files. We call it "exception" file at the same time we call them "exclusion" in ApiCheck source code. They are neither exception/exclusion, more like known breaking changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this sounds reasonable to me.

}

public ApiComparisonResult GetDifferences()
public IList<BreakingChange> GetDifferences()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sole task or ApiListingComparer is to find differences between 2 ApiListing, removing known breaking changes should not be part of its tasks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eilon I asked @javiercn about the errors output for extraneous exceptions. He said you had wanted that feature and considered the extra exceptions errors. IIRC the purpose was to make sure we'd reported all real breaking changes at the end of a milestone. Has something changed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I now see the feature remains. Only change is that this class isn't involved.

{
breakingChanges.Add(new BreakingChange(type, "New members were added to the following interface"));
}
breakingChanges.AddRange(newMembers.Select(member => new BreakingChange(newType.Id, member.Id, ChangeKind.Addition)));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part finds actually newly added members on interface (or renamed ones because they are remove/add)


<PropertyGroup>
<VersionPrefix>1.0.2</VersionPrefix>
<VersionPrefix>1.0.3</VersionPrefix>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pranavkm - This version to bump?

@smitpatel smitpatel requested a review from Eilon April 21, 2017 01:48
@Eilon Eilon requested a review from javiercn April 22, 2017 00:54
Copy link
Contributor

@Eilon Eilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice! Just a few misc comments.

<_ApiListingFileSuffix Condition=" '$(_ApiListingFileSuffix)' == '' ">netcore.json</_ApiListingFileSuffix>
<_ApiListingFilePath>$(MSBuildProjectDirectory)\baseline.$(_ApiListingFileSuffix)</_ApiListingFilePath>
<_ApiExclusionsFilePath>$(MSBuildProjectDirectory)\exceptions.$(_ApiListingFileSuffix)</_ApiExclusionsFilePath>
<_ApiExclusionsFilePath>$(MSBuildProjectDirectory)\breakingchanges.$(_ApiListingFileSuffix)</_ApiExclusionsFilePath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this sounds reasonable to me.

{
breakingChanges.Add(typeChange);
}
breakingChanges.Add(new BreakingChange(type.Id, /*memberId:*/ null, ChangeKind.Removal));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can still use a named param! And then use a named param for the last param too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. in EF we use commented out if its in middle and non-commented if its last. I will change this.

{
unchecked
{
var hashCode = TypeId.GetHashCode();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps use https://github.com/aspnet/Common/tree/dev/shared/Microsoft.Extensions.HashCodeCombiner.Sources instead so we don't have random/arbitrary hash code combiners scattered in teh codez.

public enum ChangeKind
{
Removal,
Modification,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+💯

private const int Error = 1;

public static int Main(string[] args)
public static int Main(string [] args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢 🐼

{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Error: Following types/interfaces have one or more members removed from them.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following ...

{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Error: Following interfaces have one or more members added from them.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... added *to* them.

{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Following is the list of exclusions which are needed to be added.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following is the list of exclusions that either need to be added to the list of breaking changes, or the breaking changes themselves need to be reverted:

Console.WriteLine(
"The process for breaking changes is described in: https://github.com/aspnet/Home/wiki/Engineering-guidelines#breaking-changes");
Console.WriteLine(
"For how to add an exclusion to Api-check go to: https://github.com/aspnet/BuildTools/wiki/Api-Check#apicheck-exceptions");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The process to add an exclusion to this tool is described in: ...

var change = Assert.Single(changes.BreakingChanges, bc => bc.Item.Id == "public class ComparisonScenarios.PublicToInternalClass");
var expected = new BreakingChange(
"public class ComparisonScenarios.PublicToInternalClass",
/*memberId:*/ null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use named params instead of comments. See my earlier comment.

@smitpatel smitpatel force-pushed the exceptionPrettyPrinter branch from a7afff3 to aff63c0 Compare April 24, 2017 17:44
@smitpatel
Copy link
Contributor Author

Updated.

@smitpatel smitpatel force-pushed the exceptionPrettyPrinter branch 2 times, most recently from dca2620 to ce7960e Compare April 24, 2017 20:14
@smitpatel
Copy link
Contributor Author

Removed compact output

<Target Name="ApiCheck" Condition=" '$(EnableApiCheck)' == 'true' ">
<PropertyGroup>
<_ApiListingFileSuffix Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">net45.json</_ApiListingFileSuffix>
<_ApiListingFileSuffix Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">net46.json</_ApiListingFileSuffix>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eilon - This one is bit interesting.
for .NETFramework tfm we used to use net45.json which is inconsistent now because we upgraded to net46. Though all our baselines say, net45 only. On the other side of world (in netcore/standard) anything non-net framework we used netcore (without exact version) as suffix. Should we change this one to something other than net46? Like netframework & netcore baselines?

@smitpatel smitpatel force-pushed the exceptionPrettyPrinter branch from ce7960e to f198dcb Compare April 24, 2017 21:38
smitpatel added a commit to aspnet/Microsoft.Data.Sqlite that referenced this pull request Apr 24, 2017
@smitpatel smitpatel force-pushed the exceptionPrettyPrinter branch from f198dcb to 0e914ea Compare April 24, 2017 21:46
smitpatel added a commit to aspnet/Microsoft.Data.Sqlite that referenced this pull request Apr 24, 2017
smitpatel added a commit to aspnet/DependencyInjection that referenced this pull request Apr 24, 2017
smitpatel added a commit to aspnet/FileSystem that referenced this pull request Apr 24, 2017
smitpatel added a commit to aspnet/Configuration that referenced this pull request Apr 24, 2017
smitpatel added a commit to aspnet/Logging that referenced this pull request Apr 24, 2017
<Target Name="ApiCheck" Condition=" '$(EnableApiCheck)' == 'true' ">
<PropertyGroup>
<_ApiListingFileSuffix Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">net45.json</_ApiListingFileSuffix>
<_ApiListingFileSuffix Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">netframework.json</_ApiListingFileSuffix>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 😄

Copy link
Contributor

@Eilon Eilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some teeny-tiny comments, then :shipit: !

{
if (string.IsNullOrEmpty(singleLine) || singleLine.StartsWith(" ", StringComparison.Ordinal))
// Since tool prints out formatted list of breaking changes,
// anything that starts with Error will be considered error rest is user information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change comment: ... considered an error; the rest is ...

if (removedTypes.Count > 0)
{
Console.WriteLine();
Console.WriteLine("The following types/interfaces have been removed.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW types/interfaces is redundant. All interfaces are types. Can clear this up in other messages below as well.

Print out breaking changes to be added as exceptions
Change format of exception files
Use word breaking changes instead of exceptions/exclusions
Upgrade to net46
Remove unused option of compact output.
@smitpatel smitpatel force-pushed the exceptionPrettyPrinter branch from b89e192 to 7e7ac94 Compare April 25, 2017 13:51
smitpatel added a commit to aspnet/Configuration that referenced this pull request Apr 25, 2017
smitpatel added a commit to dotnet/efcore that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Hosting that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/HttpAbstractions that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Mvc that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Mvc that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Hosting that referenced this pull request Apr 25, 2017
@smitpatel smitpatel merged commit 7e7ac94 into dev Apr 25, 2017
@smitpatel smitpatel deleted the exceptionPrettyPrinter branch April 25, 2017 15:02
smitpatel added a commit to aspnet/Antiforgery that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Caching that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Configuration that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/DependencyInjection that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Diagnostics that referenced this pull request Apr 25, 2017
smitpatel added a commit to dotnet/efcore that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/FileSystem that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Hosting that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/HttpAbstractions that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Identity that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Logging that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Microsoft.Data.Sqlite that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Mvc that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Routing that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/Security that referenced this pull request Apr 25, 2017
smitpatel added a commit to aspnet/DataProtection that referenced this pull request Apr 25, 2017
{
NullValueHandling = NullValueHandling.Ignore
}));
Console.WriteLine();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smitpatel why write anything but this block and the bit about no-longer-necessary exclusions? Everything else written to the console in this method is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is intentionally redundant.
The main task of tool is to inform the developer about breaking changes so that it can be determined if the breaking change is desired or was by mistake. We print out the list of breaking changes in a human readable format first.
The rest of parts, no-longer-necessary exceptions & json-to-add is to help user update the breaking changes file. Those JSON are not so easily readable hence redundancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants