Skip to content
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

Remove dependency on all Roslyn assemblies from build host #73497

Merged
merged 4 commits into from
May 20, 2024

Conversation

tmat
Copy link
Member

@tmat tmat commented May 15, 2024

Implements #70945

Reduces size of the Workspace.MSBuild package from 33.5MB down to 4.3MB.
This in turn reduces the size of the .NET SDK and the VS Code Extension by the same amount.

net472:
image

netcore:
image

As noted in #70945, the build host only used a handful of compiler types. These types can be easily avoided. The build host also uses quite a few extensions and utilities, which can be linked instead of referenced. To make the linking cleaner this change moves a few types defined in the compiler InternalUtilities that had dependencies on non-utility Roslyn types elsewhere. This allows the host to simply link to all internal utilities.

As a follow up, I believe it would be useful to rename InternalUtilities to FrameworkUtilities and treat this code as a layer below the compiler (on the same level as PooledObjects and Collections).

@tmat tmat requested review from a team as code owners May 15, 2024 22:17
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 15, 2024
@tmat tmat marked this pull request as draft May 15, 2024 22:22
@@ -1034,8 +1021,8 @@ public static int Sum<T>(this ImmutableArray<T> items, Func<T, int, int> selecto
where TNamedTypeSymbol : class, TNamespaceOrTypeSymbol
where TNamespaceSymbol : class, TNamespaceOrTypeSymbol
{
foreach (var (name, value) in dictionary)
result.Add(name, createMembers(value));
foreach (var entry in dictionary)
Copy link
Member Author

Choose a reason for hiding this comment

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

Avoid dependency on KeyValuePair deconstructor extension

@tmat tmat marked this pull request as ready for review May 16, 2024 00:07
@tmat
Copy link
Member Author

tmat commented May 16, 2024

@jasonmalinowski @dibarbet @dotnet/roslyn-ide @dotnet/roslyn-compiler ptal

@@ -11,45 +11,6 @@ namespace Roslyn.Utilities
{
internal static class EnumUtilities
{
/// <summary>
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved, renamed and simplified

using System.Text;

namespace Microsoft.CodeAnalysis
{
internal static partial class EncodingExtensions
{
/// <summary>
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved and simplified

@@ -764,19 +764,6 @@ public static ImmutableArray<T> Distinct<T>(this ImmutableArray<T> array, IEqual
return result;
}

internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved

Copy link
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

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

seems reasonable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants