Skip to content

Commit

Permalink
Change generated.cs -> g.cs to make it work with coverlet [coverlet-c…
Browse files Browse the repository at this point in the history
  • Loading branch information
C0nquistadore committed Oct 20, 2022
1 parent 71d752a commit de2d797
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 17 deletions.
9 changes: 5 additions & 4 deletions src/Dibix.Generators/Dibix.Generators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>

<ItemGroup><!-- An instance of analyzer Dibix.Generators.TaskGenerator cannot be created from Dibix.Generators.dll : Exception has been thrown by the target of an invocation.. -->
<!--<ProjectReference Include="..\Dibix.Sdk.Abstractions\Dibix.Sdk.Abstractions.csproj" PrivateAssets="all" />-->

<EmbeddedResource Update="EmbeddedSources\TaskGenerator\TaskPropertySource.cs" Link="EmbeddedSources\TaskGenerator\TaskPropertySource.cs" />
<!-- An instance of analyzer Dibix.Generators.TaskGenerator cannot be created from Dibix.Generators.dll : Exception has been thrown by the target of an invocation.. -->
<!--
<ItemGroup>
<ProjectReference Include="..\Dibix.Sdk.Abstractions\Dibix.Sdk.Abstractions.csproj" PrivateAssets="all" />
</ItemGroup>
-->
</Project>
6 changes: 3 additions & 3 deletions src/Dibix.Generators/TaskGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public sealed partial class {task.ClassName} : global::Dibix.Sdk.Abstractions.IT
private partial bool Execute();
}}
}}";
context.AddSource($"{task.ClassName}.generated.cs", content);
context.AddSource($"{task.ClassName}.g.cs", content);
}

private static void GenerateTaskConfiguration(SourceProductionContext context, Task task, string? @namespace, IDictionary<string, ICollection<TaskProperty>> propertyCategoryMap)
Expand All @@ -148,7 +148,7 @@ public sealed class {className}
{{{propertiesText}
}}
}}";
context.AddSource($"{className}.generated.cs", content);
context.AddSource($"{className}.g.cs", content);
}

private static IEnumerable<string> CollectTaskConfigurationProperties(string? @namespace, IDictionary<string, ICollection<TaskProperty>> propertyCategoryMap)
Expand Down Expand Up @@ -193,7 +193,7 @@ public sealed class {className}
{{{propertiesText}
}}
}}";
context.AddSource($"{className}.generated.cs", content);
context.AddSource($"{className}.g.cs", content);
}

private static string GenerateConfigurationProperty(string categoryName, string? @namespace)
Expand Down
2 changes: 1 addition & 1 deletion src/Dibix.Generators/TestMethodGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public sealed partial class {className}
partial void Execute([global::System.Runtime.CompilerServices.CallerMemberName] string testName = null);
}}
}}";
context.AddSource($"{className}.generated.cs", source);
context.AddSource($"{className}.g.cs", source);
}

private readonly struct CodeGenerationTask
Expand Down
2 changes: 1 addition & 1 deletion src/Dibix.Generators/Utilities/GenerationUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void CollectEmbeddedSources(this IncrementalGeneratorPostInitializ
if (extensionIndex < 0)
extensionIndex = fileName.Length;

fileName = fileName.Insert(extensionIndex, ".generated");
fileName = fileName.Insert(extensionIndex, ".g");

string content;
using (Stream stream = ThisAssembly.GetManifestResourceStream(resourceName)!)
Expand Down
16 changes: 8 additions & 8 deletions tests/Dibix.Generators.Tests/GeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void TestMethodGenerator()

string[] expectedFiles =
{
"TestMethodGenerationAttribute.generated.cs",
"SqlCodeAnalysisRuleTests.generated.cs"
"TestMethodGenerationAttribute.g.cs",
"SqlCodeAnalysisRuleTests.g.cs"
};
for (int i = 1; i < syntaxTrees.Count; i++)
{
Expand Down Expand Up @@ -131,12 +131,12 @@ public sealed partial class SqlCoreTask

string[] expectedFiles =
{
"TaskPropertyAttribute.generated.cs",
"TaskPropertySource.generated.cs",
"TaskPropertyType.generated.cs",
"SqlCoreTask.generated.cs",
"SqlCoreTaskConfiguration.generated.cs",
"EndpointConfiguration.generated.cs"
"TaskPropertyAttribute.g.cs",
"TaskPropertySource.g.cs",
"TaskPropertyType.g.cs",
"SqlCoreTask.g.cs",
"SqlCoreTaskConfiguration.g.cs",
"EndpointConfiguration.g.cs"
};
for (int i = 1; i < syntaxTrees.Count; i++)
{
Expand Down

0 comments on commit de2d797

Please sign in to comment.