Skip to content

Commit 88e470d

Browse files
Copilotarturcic
andcommitted
Add YamlDotNet AOT compatibility infrastructure
Co-authored-by: arturcic <[email protected]>
1 parent bc93979 commit 88e470d

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<PackageVersion Include="System.Reflection.Metadata" Version="9.0.9" />
4444
<PackageVersion Include="System.Security.Cryptography.Xml" Version="9.0.7" />
4545
<PackageVersion Include="System.Text.Json" Version="9.0.9" />
46+
<PackageVersion Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.3.0" />
4647
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
4748
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
4849
</ItemGroup>

src/GitVersion.Configuration/GitVersion.Configuration.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
</ItemGroup>
1010

1111
<ItemGroup>
12+
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator">
13+
<PrivateAssets>all</PrivateAssets>
14+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15+
</PackageReference>
1216
<PackageReference Include="YamlDotNet" />
1317
</ItemGroup>
1418

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
#nullable enable
2+
GitVersion.Configuration.YamlConfigurationContext
3+
GitVersion.Configuration.YamlConfigurationContext.YamlConfigurationContext() -> void
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using YamlDotNet.Serialization;
2+
3+
namespace GitVersion.Configuration;
4+
5+
/// <summary>
6+
/// Static context for YamlDotNet serialization/deserialization to support AOT compilation.
7+
/// This class is used by the YamlDotNet source generator to generate AOT-compatible serialization code.
8+
/// </summary>
9+
[YamlStaticContext]
10+
[YamlSerializable(typeof(GitVersionConfiguration))]
11+
[YamlSerializable(typeof(BranchConfiguration))]
12+
[YamlSerializable(typeof(IgnoreConfiguration))]
13+
[YamlSerializable(typeof(PreventIncrementConfiguration))]
14+
[YamlSerializable(typeof(Dictionary<string, string>))]
15+
[YamlSerializable(typeof(Dictionary<string, BranchConfiguration>))]
16+
[YamlSerializable(typeof(HashSet<string>))]
17+
public partial class YamlConfigurationContext : StaticContext
18+
{
19+
}

0 commit comments

Comments
 (0)