Skip to content

Cleaning up compiler server interface#52805

Merged
jaredpar merged 13 commits intodotnet:mainfrom
jaredpar:fixup
Aug 2, 2021
Merged

Cleaning up compiler server interface#52805
jaredpar merged 13 commits intodotnet:mainfrom
jaredpar:fixup

Conversation

@jaredpar
Copy link
Copy Markdown
Member

@jaredpar jaredpar commented Apr 21, 2021

The logic for how to communicate with the compiler server was spread out amongst a number of types in the code and it was causing a few problems:

  1. Made the server protocol hard to understand because you had to dig through 3-4 different types to understand the interactions.
  2. Made testing real scenarios difficult because the logic was in the wrong places (why should the csc.exe know anything about how connections are managed?)
  3. Lead to too many knobs being put into the APIs that created scenarios that needed to be tested that never actually occurred in production code.

This change was mostly spurred by (2) above. In a recent bug fix I ended up spending far too much time trying to write a very simple test. It motivated me to finally fix this up.

The bulk of the change is in BuildServerConnection.cs. That is now the central point for all logic around how the server is started, build requests are processed and how the server is shut down. All logic for that set of interaction should now be centralized here.

@jaredpar jaredpar marked this pull request as ready for review July 14, 2021 00:37
@jaredpar jaredpar requested a review from a team as a code owner July 14, 2021 00:37
@jaredpar
Copy link
Copy Markdown
Member Author

@dotnet/roslyn-compiler PTAL

@RikkiGibson RikkiGibson self-assigned this Jul 16, 2021
jaredpar and others added 2 commits July 21, 2021 16:47
Co-authored-by: Rikki Gibson <rikkigibson@gmail.com>
@jaredpar
Copy link
Copy Markdown
Member Author

jaredpar commented Aug 2, 2021

@RikkiGibson feedback addressed 😄

try
{
var process = Process.GetProcessById(shutdownBuildResponse.ServerProcessId);
#if NET50_OR_GREATER
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wasn't sure when we actually target net5.0 currently.

@jaredpar jaredpar merged commit a07c7ff into dotnet:main Aug 2, 2021
@ghost ghost added this to the Next milestone Aug 2, 2021
@jaredpar jaredpar deleted the fixup branch August 2, 2021 22:32
@dibarbet dibarbet modified the milestones: Next, 17.0.P4 Aug 31, 2021
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.

4 participants