From 25cb75126872a11f3ce42e35acfc6542ef108bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20C=C3=A1ceres?= Date: Mon, 18 Nov 2024 01:00:52 +0100 Subject: [PATCH] Save our own source generator output in git https://andrewlock.net/creating-a-source-generator-part-6-saving-source-generator-output-in-source-control/ --- .gitignore | 4 ++++ .../{ => Helpers}/IsExternalInit.cs | 0 src/Lynx.Generator/{ => Helpers}/Range.cs | 0 .../EvaluationParams.g.cs | 14 ++++++++++++++ .../GeneratedPackAttribute.g.cs | 17 +++++++++++++++++ src/Lynx/Lynx.csproj | 11 ++++++++++- 6 files changed, 45 insertions(+), 1 deletion(-) rename src/Lynx.Generator/{ => Helpers}/IsExternalInit.cs (100%) rename src/Lynx.Generator/{ => Helpers}/Range.cs (100%) create mode 100644 src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/EvaluationParams.g.cs create mode 100644 src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/GeneratedPackAttribute.g.cs diff --git a/.gitignore b/.gitignore index ee28e27fc..14f096ed0 100644 --- a/.gitignore +++ b/.gitignore @@ -380,3 +380,7 @@ tmp/ # Verify exclusions **/Snapshots/*.g.received.cs + +# Configuration binder source generator output +**/Generated/* +!**/Generated/Lynx.Generator/ diff --git a/src/Lynx.Generator/IsExternalInit.cs b/src/Lynx.Generator/Helpers/IsExternalInit.cs similarity index 100% rename from src/Lynx.Generator/IsExternalInit.cs rename to src/Lynx.Generator/Helpers/IsExternalInit.cs diff --git a/src/Lynx.Generator/Range.cs b/src/Lynx.Generator/Helpers/Range.cs similarity index 100% rename from src/Lynx.Generator/Range.cs rename to src/Lynx.Generator/Helpers/Range.cs diff --git a/src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/EvaluationParams.g.cs b/src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/EvaluationParams.g.cs new file mode 100644 index 000000000..02709d769 --- /dev/null +++ b/src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/EvaluationParams.g.cs @@ -0,0 +1,14 @@ +namespace Lynx; + +static partial class EvaluationParams +{ + public const int IsolatedPawnPenalty = -917521; + public const int OpenFileRookBonus = 131112; + public const int SemiOpenFileRookBonus = 524303; + public const int SemiOpenFileKingPenalty = 327656; + public const int OpenFileKingPenalty = 131007; + public const int KingShieldBonus = -196585; + public const int BishopPairBonus = 4718622; + public const int PieceProtectedByPawnBonus = 983052; + public const int PieceAttackedByPawnPenalty = -2162735; +} diff --git a/src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/GeneratedPackAttribute.g.cs b/src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/GeneratedPackAttribute.g.cs new file mode 100644 index 000000000..997f37d5c --- /dev/null +++ b/src/Lynx/Generated/Lynx.Generator/Lynx.Generator.GeneratedPackGenerator/GeneratedPackAttribute.g.cs @@ -0,0 +1,17 @@ +using System; + +namespace Lynx.Generator +{ + [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] + internal sealed class GeneratedPackAttribute : Attribute + { + public short MG { get; } + public short EG { get; } + + public GeneratedPackAttribute(short mg, short eg) + { + MG = mg; + EG = eg; + } + } +} \ No newline at end of file diff --git a/src/Lynx/Lynx.csproj b/src/Lynx/Lynx.csproj index 1547f8735..72850ad82 100644 --- a/src/Lynx/Lynx.csproj +++ b/src/Lynx/Lynx.csproj @@ -5,7 +5,6 @@ - true true @@ -48,6 +47,16 @@ + + true + Generated + + + + + + + true snupkg