From 4d71806e51d50b5bb889d0fd5f87e7c6f2c8ec3f Mon Sep 17 00:00:00 2001 From: dvolper Date: Fri, 3 May 2024 20:42:01 +0200 Subject: [PATCH] Doki.Output.ClassLibrary concept --- Doki.sln | 11 +++++++ doki.config.json | 8 +++++ .../ClassLibraryOutput.cs | 16 ++++++++++ .../ClassLibraryOutputOptions.cs | 20 ++++++++++++ .../Doki.Output.ClassLibrary.csproj | 31 +++++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs create mode 100644 src/Doki.Output.ClassLibrary/ClassLibraryOutputOptions.cs create mode 100644 src/Doki.Output.ClassLibrary/Doki.Output.ClassLibrary.csproj diff --git a/Doki.sln b/Doki.sln index 2487361..7958782 100644 --- a/Doki.sln +++ b/Doki.sln @@ -22,6 +22,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doki.TestAssembly.Inheritan EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doki.TestAssembly.InheritanceChain.Abstractions", "tests\assemblies\Doki.TestAssembly.InheritanceChain.Abstractions\Doki.TestAssembly.InheritanceChain.Abstractions.csproj", "{200E8D34-D772-4D46-A87C-6AD84F8AE731}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Output", "Output", "{568576F3-3D48-459E-B4D2-1790DAE80E7A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doki.Output.ClassLibrary", "src\Doki.Output.ClassLibrary\Doki.Output.ClassLibrary.csproj", "{9619825A-9DD5-4D82-9BBA-6747A8313275}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +37,9 @@ Global {2DD37B99-1A80-4F0E-B817-BA277DFC6454} = {08041208-BE3D-4BE8-9AF7-806B73985275} {4ED3E654-E076-463C-B744-A1F5111820E3} = {08041208-BE3D-4BE8-9AF7-806B73985275} {200E8D34-D772-4D46-A87C-6AD84F8AE731} = {08041208-BE3D-4BE8-9AF7-806B73985275} + {57EF4554-C84D-4988-94CF-9D6E908BE10C} = {568576F3-3D48-459E-B4D2-1790DAE80E7A} + {33DFFEBE-DB9E-4960-BB4E-3B58399E132C} = {568576F3-3D48-459E-B4D2-1790DAE80E7A} + {9619825A-9DD5-4D82-9BBA-6747A8313275} = {568576F3-3D48-459E-B4D2-1790DAE80E7A} EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {6F31B87A-2BD3-4FB4-8C08-7E059A338D4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -71,5 +78,9 @@ Global {200E8D34-D772-4D46-A87C-6AD84F8AE731}.Debug|Any CPU.Build.0 = Debug|Any CPU {200E8D34-D772-4D46-A87C-6AD84F8AE731}.Release|Any CPU.ActiveCfg = Release|Any CPU {200E8D34-D772-4D46-A87C-6AD84F8AE731}.Release|Any CPU.Build.0 = Release|Any CPU + {9619825A-9DD5-4D82-9BBA-6747A8313275}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9619825A-9DD5-4D82-9BBA-6747A8313275}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9619825A-9DD5-4D82-9BBA-6747A8313275}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9619825A-9DD5-4D82-9BBA-6747A8313275}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/doki.config.json b/doki.config.json index 5d5bef3..dbd079e 100644 --- a/doki.config.json +++ b/doki.config.json @@ -11,6 +11,14 @@ "options": { "outputPath": "docs/api" } + }, + { + "type": "Doki.Output.ClassLibrary", + "from": "src/Doki.Output.ClassLibrary/Doki.Output.ClassLibrary.csproj", + "options": { + "outputPath": "src", + "namespace": "Doki.Documentation.Content" + } } ] } \ No newline at end of file diff --git a/src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs b/src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs new file mode 100644 index 0000000..6432357 --- /dev/null +++ b/src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs @@ -0,0 +1,16 @@ +namespace Doki.Output.ClassLibrary; + +[DokiOutput("Doki.Output.ClassLibrary")] +public sealed class ClassLibraryOutput(OutputContext context) : OutputBase(context) +{ + public override async Task WriteAsync(ContentList contentList, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(contentList); + } + + public override async Task WriteAsync(TypeDocumentation typeDocumentation, + CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(typeDocumentation); + } +} \ No newline at end of file diff --git a/src/Doki.Output.ClassLibrary/ClassLibraryOutputOptions.cs b/src/Doki.Output.ClassLibrary/ClassLibraryOutputOptions.cs new file mode 100644 index 0000000..befea3d --- /dev/null +++ b/src/Doki.Output.ClassLibrary/ClassLibraryOutputOptions.cs @@ -0,0 +1,20 @@ +using System.Text.Json.Serialization; + +namespace Doki.Output.ClassLibrary; + +public sealed record ClassLibraryOutputOptions : OutputOptions +{ + [JsonPropertyName("namespace")] public string Namespace { get; init; } + + [JsonPropertyName("projectName")] public string? ProjectName { get; init; } + + [JsonPropertyName("targetFramework")] public string TargetFramework { get; init; } + + [JsonPropertyName("targetFrameworks")] public string[]? TargetFrameworks { get; init; } + + public ClassLibraryOutputOptions() + { + Namespace = "Doki.Content"; + TargetFramework = "net8.0"; + } +} \ No newline at end of file diff --git a/src/Doki.Output.ClassLibrary/Doki.Output.ClassLibrary.csproj b/src/Doki.Output.ClassLibrary/Doki.Output.ClassLibrary.csproj new file mode 100644 index 0000000..aeb7cd6 --- /dev/null +++ b/src/Doki.Output.ClassLibrary/Doki.Output.ClassLibrary.csproj @@ -0,0 +1,31 @@ + + + + Doki.Output.ClassLibrary + david@vollmers.org + David Vollmers + Doki Class Library Generator + https://github.com/DavidVollmers/doki + MIT + README.md + logo-64x64.png + git + https://github.com/DavidVollmers/doki.git + net6.0;net7.0;net8.0 + 12 + enable + enable + ..\..\nuget + + + + + + + + + + + + +