-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIncrementalCacheResult.cs
More file actions
40 lines (36 loc) · 1.77 KB
/
Copy pathIncrementalCacheResult.cs
File metadata and controls
40 lines (36 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
namespace Purview.SourceGeneratorFramework.Testing;
/// <summary>
/// The sources and optional analyzer-config overrides for a single run of an incremental cache test.
/// </summary>
/// <param name="Sources">The source files for this run.</param>
/// <param name="AnalyzerConfig">
/// Optional analyzer-config (MSBuild property) overrides applied only for this run. Keys are used verbatim.
/// </param>
public sealed record IncrementalRunInput(
IEnumerable<string> Sources,
IEnumerable<(string Key, string Value)>? AnalyzerConfig = null
);
/// <summary>
/// A single run of an incremental cache test: the generator run result and its tracked pipeline steps.
/// </summary>
/// <param name="RunResult">The generator run result for this run.</param>
/// <param name="Steps">
/// The tracked incremental steps keyed by their tracking name (for example
/// <c>GetGenerationConfiguration</c>, <c>ForAttribute_MyAttribute</c>). Each step's
/// <c>IncrementalGeneratorRunStep.Outputs</c> carry an <c>IncrementalStepRunReason</c>
/// (<c>New</c>, <c>Modified</c>, <c>Cached</c>, <c>Unchanged</c>) proving whether that pipeline stage was
/// recomputed or reused.
/// </param>
public sealed record IncrementalCacheRun(
GeneratorRunResult RunResult,
ImmutableDictionary<string, ImmutableArray<IncrementalGeneratorRunStep>> Steps
);
/// <summary>
/// The result of an incremental cache test run: one <see cref="IncrementalCacheRun"/> per input, produced by a
/// single shared <see cref="GeneratorDriver"/> so each run's step reasons reflect what changed since the
/// previous run.
/// </summary>
/// <param name="Runs">The per-run results, in input order.</param>
public sealed record IncrementalCacheResult(ImmutableArray<IncrementalCacheRun> Runs);