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

Experimental new tracing #286

Merged
merged 10 commits into from
Nov 12, 2024
Merged

Experimental new tracing #286

merged 10 commits into from
Nov 12, 2024

Conversation

Corniel
Copy link
Contributor

@Corniel Corniel commented Sep 7, 2024

The current way of logging/tracing the build results feel not right. This PR is way to improve on that. The idea is that a (extremely lightweight) BuildEventArgsCollector that has only one purpose; to collect all BuildEventArgs that are produced during the build.

private IAnalyzerResults BuildTargets(
    BuildEnvironment buildEnvironment, string targetFramework, string[] targetsToBuild, AnalyzerResults results)
{
    using var pipeLogger = new AnonymousPipeLoggerServer(cancellation.Token);
    using var collector = new BuildEventArgsCollector(pipeLogger);

    // ..
    var events = collector.ToImmutableArray();

    // Some mechanism to create analyzer results based on the created events
    return AnalyzerResults.FromEvents(events);
}

The idea is - and I've tested this already a bit - is that it is easier to create analyzer results based all collected events afterwards then during the process. On top of that, it also separates the code: there is code that collects, and there is code that processes the events.

Finally it makes it even easier to address the request of #278 because supporting additional languages is just a matter of registering some code that can create its own output based on the events collected.

@Corniel Corniel marked this pull request as ready for review September 8, 2024 09:44
@phmonte phmonte merged commit 2248a7a into phmonte:main Nov 12, 2024
6 checks passed
@Corniel Corniel deleted the tracer branch November 13, 2024 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants