Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
lfs: true

- name: Install .NET Core
uses: actions/setup-dotnet@v1.8.0
Expand Down
Binary file added images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/reactivemarbles/SourceGenerator.TestNuGetHelper</PackageProjectUrl>
<PackageDescription>Helpers for dealing with NuGet packages.</PackageDescription>
<PackageIcon>logo.png</PackageIcon>
<Owners>glennawatson</Owners>
<PackageReleaseNotes>https://github.com/reactivemarbles/SourceGenerator.TestNuGetHelper/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/reactivemarbles/SourceGenerator.TestNuGetHelper</RepositoryUrl>
Expand All @@ -32,6 +33,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\images\logo.png" Pack="true" PackagePath="\"/>
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="LICENSE" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Immutable;
using System.IO;
using System.Linq;

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;

Expand Down Expand Up @@ -64,18 +65,33 @@ static SourceGeneratorUtility()
/// <param name="sources">The source code files.</param>
/// <returns>The source generator instance.</returns>
public T RunGenerator<T>(EventBuilderCompiler compiler, out ImmutableArray<Diagnostic> compilationDiagnostics, out ImmutableArray<Diagnostic> generatorDiagnostics, out GeneratorDriver generatorDriver, params string[] sources)
where T : ISourceGenerator, new() => RunGenerator<T>(compiler, out compilationDiagnostics, out generatorDiagnostics, out generatorDriver, out _, out _, sources);

/// <summary>
/// Runs the generator.
/// </summary>
/// <typeparam name="T">The type of generator.</typeparam>
/// <param name="compiler">The compiler.</param>
/// <param name="compilationDiagnostics">The diagnostics which are produced from the compiler.</param>
/// <param name="generatorDiagnostics">The diagnostics which are produced from the generator.</param>
/// <param name="generatorDriver">Output value for the driver.</param>
/// <param name="beforeCompilation">The compilation before the generator has run.</param>
/// <param name="afterGeneratorCompilation">The compilation after the generator has run.</param>
/// <param name="sources">The source code files.</param>
/// <returns>The source generator instance.</returns>
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)
where T : ISourceGenerator, new()
{
var compilation = CreateCompilation(compiler, sources);
beforeCompilation = CreateCompilation(compiler, sources);

var generator = new T();

var newCompilation = RunGenerators(compilation, out generatorDiagnostics, out generatorDriver, generator);
afterGeneratorCompilation = RunGenerators(beforeCompilation, out generatorDiagnostics, out generatorDriver, generator);

compilationDiagnostics = newCompilation.GetDiagnostics();
compilationDiagnostics = afterGeneratorCompilation.GetDiagnostics();

ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, newCompilation, compilationDiagnostics);
ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, compilation, generatorDiagnostics);
ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, afterGeneratorCompilation, compilationDiagnostics);
ShouldHaveNoCompilerDiagnosticsWarningOrAbove(_writeOutput, beforeCompilation, generatorDiagnostics);

return generator;
}
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0",
"version": "1.1",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/main$"
Expand Down