Skip to content

[ApiDiff] Implementation of the new ApiDiff that reuses GenAPI features #46425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 71 commits into from
Apr 28, 2025

Conversation

carlossanlop
Copy link
Member

@carlossanlop carlossanlop commented Jan 30, 2025

Follow up of #46424

This PR is part of the work needed to create an ApiDiff tool that reuses some of the code from Microsoft.DotNet.GenAPI. The idea is to make the larger PR smaller and make it easier to review: #45389

The proposed changes in this PR include:

  • Full implementation of the tool that can generate an API diff from two assemblies.

@carlossanlop
Copy link
Member Author

I added a very simple test that verifies the contents of a basic DLL before and after adding one API.
Unfortunately the DLLs triggered the error below, so I might have to add the DLL as an actual pair of projects (before and after), compile them as part of the SDK repo build, and then I hope the two DLLs can be compared (the restriction is that they need to have the same assembly name).

expand to see the full error
repo-projects\Directory.Build.targets(504,5): error MSB3073: The command "D:\a\_work\1\vmr\src\sdk\eng\common\build.cmd -restore -build -pack -publish -sign -ci -configuration Release -bl /p:DotNetBuildRepo=true /p:DotNetBuildOrchestrator=true /p:TargetRid=win-x64 /p:RestoreConfigFile=D:\a\_work\1\vmr\artifacts\obj\sdk\NuGet.config /p:ForceDryRunSigning=true /p:SourceBuiltAssetsDir=D:\a\_work\1\vmr\artifacts\assets\Release\ /p:SourceBuiltAssetManifestsDir=D:\a\_work\1\vmr\artifacts\obj\manifests\Release\sdk\ -nativeToolsOnMachine /p:PackageProjectUrl=https://github.com/dotnet/sdk /p:PortableRid=win-x64 -v minimal /p:NETCoreAppMaximumVersion=99.9 /p:PortableOSName= /p:Rid=win-x64 /p:Architecture=x64 /p:DOTNET_INSTALL_DIR=D:\a\_work\1\vmr\.dotnet\ /p:SkipBuildingInstallers=true /p:SkipBuildingSdkBundle=true /p:PublicBaseURL=file://D:\a\_work\1\vmr\artifacts\assets\Release\ /p:FallbackPublicBaseURL=https://dotnetbuilds.blob.core.windows.net/public/ /p:UsePortableLinuxSharedFramework=false
❌artifacts\source-built-sdks\Microsoft.DotNet.Arcade.Sdk\tools\Sign.proj(75,5): error SIGN004: Signing 3rd party library 'D:\a\_work\1\vmr\src\sdk\artifacts\tmp\Release\ContainerSigning\339\tools/net8.0/any/Argon.dll' with Microsoft certificate 'MicrosoftDotNet500'. The library is considered 3rd party library due to its copyright: 'Copyright 2024. All rights reserved'.
❌artifacts\source-built-sdks\Microsoft.DotNet.Arcade.Sdk\tools\Sign.proj(75,5): error SIGN004: Signing 3rd party library 'D:\a\_work\1\vmr\src\sdk\artifacts\tmp\Release\ContainerSigning\340\tools/net8.0/any/DiffEngine.dll' with Microsoft certificate 'MicrosoftDotNet500'. The library is considered 3rd party library due to its copyright: 'Copyright 2024. All rights reserved'.

@carlossanlop
Copy link
Member Author

carlossanlop commented Feb 4, 2025

I just noticed I didn't implement the addition of the table of contents file. Working on that.

@carlossanlop carlossanlop removed the untriaged Request triage from a team member label Feb 4, 2025
Add tests to verify interface members get included.
Add test for interface type constraints, but needs more investigation.
@carlossanlop
Copy link
Member Author

@Rob-Hague I fixed the bug preventing interface members from getting added.

The interface type constraints does seem to work but it's adding more than expected: each of the inherited interfaces is 'exploded' into all the interfaces each one of them inherits. This is probably not an issue but I think the preference would be to only include what the user intended to include explicitly. Also, the nullability constraint is not showing up, so for that reason I marked the test as skipped. I'll have to investigate later (preferrably after I merge this PR).

I can also investigate further the problem you reported with the constructor, but does not seem to be a common case. So if you don't mind, I'd also like to investigate it later.

@ericstj I addressed all your feedback.

@carlossanlop
Copy link
Member Author

carlossanlop commented Apr 8, 2025

Second time I see a bunch of duplicate license/cla legs here in the sdk repo. This time I got a screenshot @Forgind:
image

@Forgind
Copy link
Member

Forgind commented Apr 8, 2025

Second time I see a bunch of duplicate license/cla legs here in the sdk repo. This time I got a screenshot @Forgind: image

Very strange. It looks like it disappeared again. I'm split between "it resolves itself, so it isn't a big deal" and "definitely a bug; we should ping first responders"

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

Please consider feedback and address or file follow-up. This can merge when you're happy with it as it is non-shipping tool at the moment.

{
Description = "The title of the markdown table of contents file that is placed in the output folder.",
Arity = ArgumentArity.ExactlyOne,
IsRequired = true
Copy link
Member

Choose a reason for hiding this comment

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

Parameter is still marked as required.

@carlossanlop carlossanlop enabled auto-merge April 28, 2025 17:49
@carlossanlop carlossanlop merged commit 291eea7 into dotnet:main Apr 28, 2025
30 checks passed
@carlossanlop carlossanlop deleted the ApiDiff branch April 28, 2025 22:04
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.

7 participants