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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public sealed record SourceGeneratorResult
public static class CompilationHelper
{
private static readonly Assembly SystemRuntimeAssembly = Assembly.Load(new AssemblyName("System.Runtime"));
private static readonly Assembly CompositeKeyAssembly = Assembly.Load(new AssemblyName("CompositeKey"));

private static readonly CSharpParseOptions DefaultParseOptions = CreateParseOptions();

Expand All @@ -33,7 +34,7 @@ public static Compilation CreateCompilation(string source, string assemblyName =
MetadataReference.CreateFromFile(typeof(Console).Assembly.Location),
MetadataReference.CreateFromFile(SystemRuntimeAssembly.Location),

MetadataReference.CreateFromFile(typeof(CompositeKeyAttribute).Assembly.Location),
MetadataReference.CreateFromFile(CompositeKeyAssembly.Location),
];

return CSharpCompilation.Create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>

<DefineConstants>$(DefineConstants);BUILDING_SOURCE_GENERATOR</DefineConstants>

<!-- Exclude PolySharp polyfills that conflict with runtime types when exposed via InternalsVisibleTo -->
<PolySharpExcludeGeneratedTypes>System.Runtime.CompilerServices.ModuleInitializerAttribute</PolySharpExcludeGeneratedTypes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,6 +29,10 @@
<ProjectReference Include="..\CompositeKey.Analyzers.Common\CompositeKey.Analyzers.Common.csproj" PrivateAssets="all" ReferenceOutputAssembly="true" GlobalPropertiesToRemove="TargetFramework" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="CompositeKey.SourceGeneration.UnitTests" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\CompositeKey\CompositeKeyAttribute.cs" Link="Common\CompositeKey\CompositeKeyAttribute.cs" />
<Compile Include="..\CompositeKey\CompositeKeyConstructorAttribute.cs" Link="Common\CompositeKey\CompositeKeyConstructorAttribute.cs" />
Expand Down
1,071 changes: 1,071 additions & 0 deletions src/CompositeKey.SourceGeneration/Emitter.cs

Large diffs are not rendered by default.

625 changes: 625 additions & 0 deletions src/CompositeKey.SourceGeneration/Parser.cs

Large diffs are not rendered by default.

1,074 changes: 0 additions & 1,074 deletions src/CompositeKey.SourceGeneration/SourceGenerator.Emitter.cs

This file was deleted.

631 changes: 0 additions & 631 deletions src/CompositeKey.SourceGeneration/SourceGenerator.Parser.cs

This file was deleted.

4 changes: 3 additions & 1 deletion src/CompositeKey.SourceGeneration/SourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
namespace CompositeKey.SourceGeneration;

[Generator]
public sealed partial class SourceGenerator : IIncrementalGenerator
public sealed class SourceGenerator : IIncrementalGenerator
{
private const string CompositeKeyAttributeFullName = "CompositeKey.CompositeKeyAttribute";

public const string GenerationSpecTrackingName = nameof(GenerationSpec);

public void Initialize(IncrementalGeneratorInitializationContext context)
Expand Down
Loading