Skip to content

Commit

Permalink
Doki.Output.ClassLibrary concept
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidVollmers committed May 3, 2024
1 parent 078de88 commit 4d71806
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Doki.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
8 changes: 8 additions & 0 deletions doki.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
}
16 changes: 16 additions & 0 deletions src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Doki.Output.ClassLibrary;

[DokiOutput("Doki.Output.ClassLibrary")]
public sealed class ClassLibraryOutput(OutputContext context) : OutputBase<ClassLibraryOutputOptions>(context)
{
public override async Task WriteAsync(ContentList contentList, CancellationToken cancellationToken = default)

Check warning on line 6 in src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 6 in src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 6 in src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
ArgumentNullException.ThrowIfNull(contentList);
}

public override async Task WriteAsync(TypeDocumentation typeDocumentation,

Check warning on line 11 in src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 11 in src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 11 in src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs

View workflow job for this annotation

GitHub Actions / Test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(typeDocumentation);
}
}
20 changes: 20 additions & 0 deletions src/Doki.Output.ClassLibrary/ClassLibraryOutputOptions.cs
Original file line number Diff line number Diff line change
@@ -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";
}
}
31 changes: 31 additions & 0 deletions src/Doki.Output.ClassLibrary/Doki.Output.ClassLibrary.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>Doki.Output.ClassLibrary</PackageId>
<Authors>david@vollmers.org</Authors>
<Copyright>David Vollmers</Copyright>
<Description>Doki Class Library Generator</Description>
<PackageProjectUrl>https://github.com/DavidVollmers/doki</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>logo-64x64.png</PackageIcon>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/DavidVollmers/doki.git</RepositoryUrl>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>12</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageOutputPath>..\..\nuget</PackageOutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Doki.Output.Abstractions\Doki.Output.Abstractions.csproj"/>
</ItemGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="\"/>
<None Include="..\..\assets\logo-64x64.png" Pack="true" PackagePath="\"/>
</ItemGroup>

</Project>

0 comments on commit 4d71806

Please sign in to comment.