Add compiler log (.complog) support as a website generation input - #279
Open
jaredpar wants to merge 1 commit into
Open
Add compiler log (.complog) support as a website generation input#279jaredpar wants to merge 1 commit into
jaredpar wants to merge 1 commit into
Conversation
Compiler logs (.complog, from jaredpar/complog) carry a fully-resolved Roslyn compilation per project, so they can drive the source browser the same way .sln inputs do without any MSBuild evaluation. This wires them in alongside the existing binlog/.sln inputs. - HtmlGenerator: route .complog through the SolutionGenerator/workspace path via Basic.CompilerLog.Util.SolutionReader (BasicAnalyzerKind.None so generators/analyzers are not re-run); read assembly names with the lighter-weight CompilerLogReader; derive type forwards by emitting each project's assembly (metadata only) in memory instead of reading build outputs off disk. - Normalize complog assembly names (strip extension) so output folders match the extension-less global assembly list. - CommandLineOptions/README: accept and document .complog inputs. - index.proj: discover and index *.complog in the pipeline. - Tests: cover assembly-name normalization. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8ccbc0b2-2195-4ecb-b61c-372cddc4afe4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The indexer currently accepts MSBuild binlogs and
.sln/.slnxfiles as inputs. Compiler logs (.complog, from jaredpar/complog) are a compact, self-contained format that captures a fully-resolved Roslyn compilation per project. Supporting them lets repos feed the source browser without needing MSBuild evaluation at index time.Approach
A
.complogbehaves like a workspace-producing input (similar to.sln), not like the binlog invocation-extraction path, so it is routed throughSolutionGenerator/the Roslyn workspace rather thanIndexSolutionsAsync's binlog branch.SolutionGenerator):Basic.CompilerLog.Util.SolutionReadermaterializes aSolutionInfodirectly. It is created withBasicAnalyzerKind.Noneso originally-generated files are added inline and analyzers/source generators are not re-run. The reader is kept alive for the duration of Pass1 because document source text is loaded lazily from it, and is disposed inDispose().Program.GetAssemblyNamesAsync): read via the lighter-weightCompilerLogReader(ReadCompilerCallData(cc).AssemblyFileNameforRegularcalls) instead of building a full solution.Program.GetTypeForwards): a compiler log does not ship emitted binaries, so each project's assembly is re-emitted to memory (EmitToMemory(EmitFlags.MetadataOnly)) from the persisted compilation and the forwards are read from those bytes.TypeForwardReadergained aStreamoverload for this, sharing the metadata walk with the existing file-based path.AssemblyNamewith the file extension (e.g.HelloLib.dll), unlike the binlog/Roslyn path.NormalizeCompilerLogAssemblyNamesstrips it so Pass1 output folders line up with the extension-less global assembly list.CommandLineOptions.IsSupportedProjectand the README accept/document.complog;index.projdiscovers and indexes*.complogin the pipeline.Notes for reviewers
IOExceptionon itslocks\*.lockfiles; it is handled internally and generation completes fine.Microsoft.CodeAnalysis.SolutionInfois referenced fully-qualified in a couple of spots on purpose: HtmlGenerator has its ownMicrosoft.SourceBrowser.HtmlGenerator.SolutionInfotype that otherwise makes the short name ambiguous.Validation
.complog, ran HtmlGenerator on it. Source is indexed and the output structure matches the equivalent binlog run (extension-lessHelloLibfolder).