WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 0cef701

Browse files
authored
feature: Add the ability to get compilation out (#15)
Add logo for RxMarbles
1 parent 2dc457d commit 0cef701

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

.github/workflows/ci-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
uses: actions/[email protected]
2222
with:
2323
fetch-depth: 0
24+
lfs: true
2425

2526
- name: Install .NET Core
2627
uses: actions/[email protected]

images/logo.png

46.1 KB
Loading

src/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1111
<PackageProjectUrl>https://github.com/reactivemarbles/SourceGenerator.TestNuGetHelper</PackageProjectUrl>
1212
<PackageDescription>Helpers for dealing with NuGet packages.</PackageDescription>
13+
<PackageIcon>logo.png</PackageIcon>
1314
<Owners>glennawatson</Owners>
1415
<PackageReleaseNotes>https://github.com/reactivemarbles/SourceGenerator.TestNuGetHelper/releases</PackageReleaseNotes>
1516
<RepositoryUrl>https://github.com/reactivemarbles/SourceGenerator.TestNuGetHelper</RepositoryUrl>
@@ -32,6 +33,7 @@
3233
</PropertyGroup>
3334

3435
<ItemGroup>
36+
<None Include="$(MSBuildThisFileDirectory)..\images\logo.png" Pack="true" PackagePath="\"/>
3537
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="LICENSE" />
3638
</ItemGroup>
3739

src/ReactiveMarbles.SourceGenerator.TestNuGetHelper/Compilation/SourceGeneratorUtility.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Collections.Immutable;
88
using System.IO;
99
using System.Linq;
10+
1011
using Microsoft.CodeAnalysis;
1112
using Microsoft.CodeAnalysis.CSharp;
1213

@@ -64,18 +65,33 @@ static SourceGeneratorUtility()
6465
/// <param name="sources">The source code files.</param>
6566
/// <returns>The source generator instance.</returns>
6667
public T RunGenerator<T>(EventBuilderCompiler compiler, out ImmutableArray<Diagnostic> compilationDiagnostics, out ImmutableArray<Diagnostic> generatorDiagnostics, out GeneratorDriver generatorDriver, params string[] sources)
68+
where T : ISourceGenerator, new() => RunGenerator<T>(compiler, out compilationDiagnostics, out generatorDiagnostics, out generatorDriver, out _, out _, sources);
69+
70+
/// <summary>
71+
/// Runs the generator.
72+
/// </summary>
73+
/// <typeparam name="T">The type of generator.</typeparam>
74+
/// <param name="compiler">The compiler.</param>
75+
/// <param name="compilationDiagnostics">The diagnostics which are produced from the compiler.</param>
76+
/// <param name="generatorDiagnostics">The diagnostics which are produced from the generator.</param>
77+
/// <param name="generatorDriver">Output value for the driver.</param>
78+
/// <param name="beforeCompilation">The compilation before the generator has run.</param>
79+
/// <param name="afterGeneratorCompilation">The compilation after the generator has run.</param>
80+
/// <param name="sources">The source code files.</param>
81+
/// <returns>The source generator instance.</returns>
82+
public T RunGenerator<T>(EventBuilderCompiler compiler, out ImmutableArray<Diagnostic> compilationDiagnostics, out ImmutableArray<Diagnostic> generatorDiagnostics, out GeneratorDriver generatorDriver, out Microsoft.CodeAnalysis.Compilation beforeCompilation, out Microsoft.CodeAnalysis.Compilation afterGeneratorCompilation, params string[] sources)
6783
where T : ISourceGenerator, new()
6884
{
69-
var compilation = CreateCompilation(compiler, sources);
85+
beforeCompilation = CreateCompilation(compiler, sources);
7086

7187
var generator = new T();
7288

73-
var newCompilation = RunGenerators(compilation, out generatorDiagnostics, out generatorDriver, generator);
89+
afterGeneratorCompilation = RunGenerators(beforeCompilation, out generatorDiagnostics, out generatorDriver, generator);
7490

75-
compilationDiagnostics = newCompilation.GetDiagnostics();
91+
compilationDiagnostics = afterGeneratorCompilation.GetDiagnostics();
7692

77-
ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, newCompilation, compilationDiagnostics);
78-
ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, compilation, generatorDiagnostics);
93+
ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, afterGeneratorCompilation, compilationDiagnostics);
94+
ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, beforeCompilation, generatorDiagnostics);
7995

8096
return generator;
8197
}

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0",
2+
"version": "1.1",
33
"publicReleaseRefSpec": [
44
"^refs/heads/master$",
55
"^refs/heads/main$"

0 commit comments

Comments
 (0)