fix(codegen): Creates multiple steps for serialization source generator (#628)

Roslyn Source generators are not supposed to access I/O. To get around this we have to use `AdditionalFiles` to give the analyzer access to read/load the schema files.
To write the schema files we have to use a separate program altogether.

- [X] Adds SerializationSchemaGenerator
- [X] Splits out the SerializationGenerator code
This commit is contained in:
Kamron Batman 2021-05-31 11:54:59 -07:00 committed by GitHub
parent f2d44e0283
commit b6779a7c09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 641 additions and 297 deletions

View file

@ -41,32 +41,26 @@
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Zlib.Bindings" Version="1.5.0" />
</ItemGroup>
<!-- <ItemGroup>-->
<!-- <ProjectReference Include="..\SerializationGenerator\SerializationGenerator.csproj">-->
<!-- <SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>-->
<!-- <OutputItemType>Analyzer</OutputItemType>-->
<!-- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>-->
<!-- <PrivateAssets>all</PrivateAssets>-->
<!-- </ProjectReference>-->
<!-- </ItemGroup>-->
<!-- <Target Name="AddSourceGeneratedFiles" AfterTargets="CoreCompile">-->
<!-- <ItemGroup>-->
<!-- <Compile Include="Generated\**" />-->
<!-- </ItemGroup>-->
<!-- </Target>-->
<!-- <Target Name="RemoveSourceGeneratedFiles" BeforeTargets="CoreCompile">-->
<!-- <ItemGroup>-->
<!-- <Compile Remove="Generated\**" />-->
<!-- </ItemGroup>-->
<!-- <RemoveDir Directories="Generated" />-->
<!-- </Target>-->
<!-- <ItemGroup>-->
<!-- <CompilerVisibleProperty Include="SerializableMigrationPath" />-->
<!-- </ItemGroup>-->
<!-- <ItemGroup>-->
<!-- <Folder Include="Migrations" />-->
<!-- </ItemGroup>-->
<!-- <PropertyGroup>-->
<!-- <SerializableMigrationPath>.\Migrations\</SerializableMigrationPath>-->
<!-- </PropertyGroup>-->
<ItemGroup>
<ProjectReference Include="..\SerializationGenerator\SerializationGenerator.csproj">
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
<OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
<Target Name="AddSourceGeneratedFiles" AfterTargets="CoreCompile">
<ItemGroup>
<Compile Include="Generated\**" />
</ItemGroup>
</Target>
<Target Name="RemoveSourceGeneratedFiles" BeforeTargets="CoreCompile">
<ItemGroup>
<Compile Remove="Generated\**" />
</ItemGroup>
<RemoveDir Directories="Generated" />
</Target>
<ItemGroup>
<AdditionalFiles Include="Migrations/*.v*.json" />
</ItemGroup>
</Project>