8000 Prepare GenAPI so it can be used for a new assembly diff generator by carlossanlop · Pull Request #45389 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

Prepare GenAPI so it can be used for a new assembly diff generator #45389

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

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" Version="$(MicrosoftCodeAnalysisPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Features" Version="$(MicrosoftCodeAnalysisPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="$(MicrosoftCodeAnalysisPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisWorkspacesCommonPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="$(MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion)" />
<PackageVersion Include="Microsoft.Css.Parser" Version="$(MicrosoftCssParserVersion)" />
<PackageVersion Include="Microsoft.DiaSymReader" Version="$(MicrosoftDiaSymReaderVersion)" />
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>d7b0a8c4b320a592e6b81dc5a40bc724cd8b71ba</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.13.0-3.25056.21">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>d7b0a8c4b320a592e6b81dc5a40bc724cd8b71ba</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.13.0-3.25056.21">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>d7b0a8c4b320a592e6b81dc5a40bc724cd8b71ba</Sha>
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
<MicrosoftCodeAnalysisCSharpPackageVersion>4.13.0-3.25056.21</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpCodeStylePackageVersion>4.13.0-3.25056.21</MicrosoftCodeAnalysisCSharpCodeStylePackageVersion>
<MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>4.13.0-3.25056.21</MicrosoftCodeAnalysisCSharpFeaturesPackageVersion>
<MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>4.13.0-3.25056.21</MicrosoftCodeAnalysisWorkspacesCommonPackageVersion>
<MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>4.13.0-3.25056.21</MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>4.13.0-3.25056.21</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ApiCompatServiceProvider(Func<ISuppressionEngine, ISuppressibleLog> logFa
CompositeSymbolFilter attributeDataSymbolFilter = new(accessibilitySymbolFilter);
if (excludeAttributesFiles is not null)
{
attributeDataSymbolFilter.Add(new DocIdSymbolFilter(excludeAttributesFiles));
attributeDataSymbolFilter.Add(DocIdSymbolFilter.CreateFromFiles(excludeAttributesFiles));
}

ApiComparerSettings apiComparerSettings = new(
Expand All @@ -49,7 +49,7 @@ public ApiCompatServiceProvider(Func<ISuppressionEngine, ISuppressibleLog> logFa
return new ApiCompatRunner(SuppressibleLog,
SuppressionEngine,
new ApiComparerFactory(ruleFactory(SuppressibleLog), apiComparerSettings),
new AssemblySymbolLoaderFactory(respectInternals));
new AssemblySymbolLoaderFactory(SuppressibleLog, respectInternals));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Build.Framework;
using Microsoft.CodeAnalysis;
using Microsoft.DotNet.ApiSymbolExtensions;
using Microsoft.DotNet.ApiSymbolExtensions.Logging;
using Microsoft.NET.Build.Tasks;

Expand Down Expand Up @@ -62,17 +64,23 @@ public class GenAPITask : TaskBase
/// <inheritdoc />
protected override void ExecuteCore()
{
GenAPIApp.Run(new MSBuildLog(Log),
Assemblies!,
AssemblyReferences,
OutputPath,
HeaderFile,
ExceptionMessage,
ExcludeApiFiles,
ExcludeAttributesFiles,
RespectInternals,
IncludeAssemblyAttributes
);
ILog logger = new MSBuildLog(Log);
(IAssemblySymbolLoader loader, Dictionary<string, IAssemblySymbol> assemblySymbols) = AssemblySymbolLoader.CreateFromFiles(
logger,
assembliesPaths: Assemblies ?? throw new NullReferenceException("Assemblies cannot be null."),
assemblyReferencesPaths: AssemblyReferences,
RespectInternals);

GenAPIApp.Run(logger,
loader,
assemblySymbols,
OutputPath,
HeaderFile,
ExceptionMessage,
ExcludeApiFiles,
ExcludeAttributesFiles,
RespectInternals,
IncludeAssemblyAttributes);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using System.CommandLine.Parsing;
using System.Diagnostics;
using System.Reflection;
using Microsoft.CodeAnalysis;
using Microsoft.DotNet.ApiSymbolExtensions;
using Microsoft.DotNet.ApiSymbolExtensions.Logging;

namespace Microsoft.DotNet.GenAPI.Tool
Expand Down Expand Up @@ -97,15 +99,25 @@ static int Main(string[] args)

rootCommand.SetAction((ParseResult parseResult) =>
{
GenAPIApp.Run(new ConsoleLog(MessageImportance.Normal),
parseResult.GetValue(assembliesOption)!,
parseResult.GetValue(assemblyReferencesOption),
bool respectInternals = parseResult.GetValue(respectInternalsOption);

ILog logger = new ConsoleLog(MessageImportance.Normal);

(IAssemblySymbolLoader loader, Dictionary<string, IAssemblySymbol> assemblySymbols) = AssemblySymbolLoader.CreateFromFiles(
logger,
assembliesPaths: parseResult.GetValue(assembliesOption) ?? throw new NullReferenceException("No assemblies provided."),
assemblyReferencesPaths: parseResult.GetValue(assemblyReferencesOption),
respectInternals);

GenAPIApp.Run(logger,
loader,
assemblySymbols,
parseResult.GetValue(outputPathOption),
parseResult.GetValue(headerFileOption),
parseResult.GetValue(exceptionMessageOption),
parseResult.GetValue(excludeApiFilesOption),
parseResult.GetValue(excludeAttributesFilesOption),
parseResult.GetValue(respectInternalsOption),
respectInternals,
parseResult.GetValue(includeAssemblyAttributesOption)
);
});
Expand Down
Loading
0