Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a379a3e
#197 Produce AsyncAPI documents at build time
Jul 6, 2024
02ffbcd
#197 Produce AsyncAPI documents at build time
Jul 7, 2024
88c5caf
Merge remote-tracking branch 'remotes/smoerijf/#196-Publish-a-global-…
Jul 7, 2024
a2813e2
#197 Produce AsyncAPI documents at build time - test + setup with loc…
Jul 7, 2024
a42ab3f
#197 local nuget source folder should exist
Jul 7, 2024
d3f0472
#197 update readme's
Jul 7, 2024
e10112b
#197 set streetlights example to depend on the Generator.Build projec…
Jul 7, 2024
4741f56
#197 undo streetlights example order, use 2 step build approach
Jul 7, 2024
195dc14
#197 use better path to the dotnet dll in tools and hopefully fix the…
Jul 7, 2024
8583f08
#197 need more logging
Jul 7, 2024
2f2c172
#197 need more logging - dir logs
Jul 7, 2024
0c033f1
#197 slashes?
Jul 7, 2024
31bacc6
#197 idk
Jul 7, 2024
fbbf601
Merge branch '#197-more-logging' of https://github.com/smoerijf/saunt…
Jul 7, 2024
6cc92e3
#197 try by installing local tool
Jul 7, 2024
df5636e
#197 bump net version
Jul 7, 2024
829d5a5
#197 install dotnet in .nuget iso the csproj root
Jul 7, 2024
49fb31f
#197 use 999.* for local nuget package buils to use in tests and exam…
Jul 7, 2024
f110afe
#197 readme style
Jul 7, 2024
1b7087a
#197 pin .Cli version to beta in .Build
Jul 8, 2024
2c6e2d9
#197 formatting
Jul 11, 2024
5823431
Merge remote-tracking branch 'remotes/smoerijf/#196-Publish-a-global-…
Jul 11, 2024
38ac1eb
#197 .build nuget package
Jul 13, 2024
6099e65
#197 fix test
Jul 13, 2024
e804aaf
Merge branch '#197-more-logging' of https://github.com/smoerijf/saunt…
Jul 13, 2024
1bb7d30
#196 fix wrong ci.yml merge
Jul 13, 2024
0babe05
#196 2 phase build: first src, then the others
Jul 13, 2024
9ee1100
#196 fix formatting
Jul 13, 2024
7c5095a
#196 test after build
Jul 13, 2024
d30c503
#196 test needs build
Jul 13, 2024
e739072
#196 trying...
Jul 13, 2024
ba95b28
#196 seperate job is inpossible, giving up on it
Jul 13, 2024
a9cc0de
#197 wording
Jul 13, 2024
e16fcf1
#197 common.props
Jul 13, 2024
e937716
Merge branch '#196-Publish-a-global-dotnet-tool' into #197-more-logging
Jul 13, 2024
a2cee95
#197 cleanup csproj
Jul 13, 2024
b043a77
#197 cleanup csproj
Jul 13, 2024
68e06ca
Merge remote-tracking branch 'remotes/smoerijf/#196-Publish-a-global-…
Jul 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ jobs:
- uses: actions/checkout@v2
- name: setup build
uses: ./.github/npm
- name: Run dotnet build
- name: Run dotnet build src
run: dotnet build ./src/Saunter-src.slnf --configuration Debug
- name: Run dotnet build all
run: dotnet build --configuration Debug
- name: unit test
run: dotnet test --no-build --configuration Debug

fmt:
runs-on: ubuntu-latest
Expand All @@ -24,15 +28,6 @@ jobs:
- name: setup dotnet
uses: ./.github/dotnet
- name: dotnet format check
run: dotnet format --verify-no-changes *.sln
run: dotnet format --verify-no-changes --no-restore *.sln
env:
PATH: ${{ github.env.PATH }}:/home/runner/.dotnet/tools

unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup build
uses: ./.github/npm
- name: unit test
run: dotnet test --configuration Debug
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ PublishScripts/
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
local-nuget-source/
dotnet-tools.json

# Microsoft Azure Build Output
Expand Down
39 changes: 39 additions & 0 deletions Saunter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.0.31919.166
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{28D4C365-FDED-49AE-A97D-36202E24A55A}"
ProjectSection(SolutionItems) = preProject
src\Saunter-src.slnf = src\Saunter-src.slnf
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Saunter", "src\Saunter\Saunter.csproj", "{240F263C-4F9B-40E0-8392-1FDB324153F6}"
EndProject
Expand All @@ -17,13 +20,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{6A
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StreetlightsAPI", "examples\StreetlightsAPI\StreetlightsAPI.csproj", "{F188D4A7-BBCB-464F-A370-2BD84D18EA79}"
ProjectSection(ProjectDependencies) = postProject
{A320E670-5CB0-4815-AF67-D8D09FC92A2A} = {A320E670-5CB0-4815-AF67-D8D09FC92A2A}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{E0D34C77-924E-4F6B-9289-5A2F07D125A8}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
CHANGELOG.md = CHANGELOG.md
src\Common.NugetPackage.props = src\Common.NugetPackage.props
Directory.Build.props = Directory.Build.props
nuget.config = nuget.config
README.md = README.md
EndProjectSection
EndProject
Expand Down Expand Up @@ -53,6 +62,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncAPI.Saunter.Generator.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StreetlightsAPI.TopLevelStatement", "examples\StreetlightsAPI.TopLevelStatement\StreetlightsAPI.TopLevelStatement.csproj", "{6F6B8B03-9045-46EC-AE12-E7ADA492F9FA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncAPI.Saunter.Generator.Build", "src\AsyncAPI.Saunter.Generator.Build\AsyncAPI.Saunter.Generator.Build.csproj", "{A320E670-5CB0-4815-AF67-D8D09FC92A2A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncAPI.Saunter.Generator.Build.Tests", "test\AsyncAPI.Saunter.Generator.Build.Tests\AsyncAPI.Saunter.Generator.Build.Tests.csproj", "{61142B10-7B49-436E-AE32-2737658BD1E5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -159,6 +172,30 @@ Global
{6F6B8B03-9045-46EC-AE12-E7ADA492F9FA}.Release|x64.Build.0 = Release|Any CPU
{6F6B8B03-9045-46EC-AE12-E7ADA492F9FA}.Release|x86.ActiveCfg = Release|Any CPU
{6F6B8B03-9045-46EC-AE12-E7ADA492F9FA}.Release|x86.Build.0 = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Debug|x64.ActiveCfg = Debug|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Debug|x64.Build.0 = Debug|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Debug|x86.ActiveCfg = Debug|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Debug|x86.Build.0 = Debug|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|Any CPU.Build.0 = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|x64.ActiveCfg = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|x64.Build.0 = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|x86.ActiveCfg = Release|Any CPU
{A320E670-5CB0-4815-AF67-D8D09FC92A2A}.Release|x86.Build.0 = Release|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x64.ActiveCfg = Debug|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x64.Build.0 = Debug|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x86.ActiveCfg = Debug|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Debug|x86.Build.0 = Debug|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Release|Any CPU.Build.0 = Release|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x64.ActiveCfg = Release|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x64.Build.0 = Release|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x86.ActiveCfg = Release|Any CPU
{61142B10-7B49-436E-AE32-2737658BD1E5}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -174,6 +211,8 @@ Global
{6C102D4D-3DA4-4763-B75E-C15E33E7E94A} = {28D4C365-FDED-49AE-A97D-36202E24A55A}
{18AD0249-0436-4A26-9972-B97BA6905A54} = {6491E321-2D02-44AB-9116-D722FE169595}
{6F6B8B03-9045-46EC-AE12-E7ADA492F9FA} = {6ABD4842-47AF-49A5-B057-0EBA64416789}
{A320E670-5CB0-4815-AF67-D8D09FC92A2A} = {28D4C365-FDED-49AE-A97D-36202E24A55A}
{61142B10-7B49-436E-AE32-2737658BD1E5} = {6491E321-2D02-44AB-9116-D722FE169595}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2F85D9DA-DBCF-4F13-8C42-5719F1469B2E}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>

<!-- Get the latest local build nuget package from source code, from the local nuget packages source as configured in nuget.config
999.* are the 'special' version number for local builds -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="AsyncAPI.Saunter.Generator.Build" Version="999.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<!-- For release: use a real published nuget package -->
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<PackageReference Include="AsyncAPI.Saunter.Generator.Build" Version="*-*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Saunter\Saunter.csproj" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions examples/StreetlightsAPI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
specs/
23 changes: 23 additions & 0 deletions examples/StreetlightsAPI/StreetlightsAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
the AsyncAPI.Saunter.Generator.Cli tool can generate specs for projects targetting .NET6 and .NET8. -->
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>

<!-- Example settings for "AsyncAPI.Saunter.Generator.Build", they are all option though -->
<AsyncAPIGenerateDocumentsOnBuild>true</AsyncAPIGenerateDocumentsOnBuild>
<AsyncAPIDocumentFormats>json,yml</AsyncAPIDocumentFormats>
<AsyncAPIDocumentFilename>streetlights.{extension}</AsyncAPIDocumentFilename>
<AsyncAPIDocumentOutputPath>specs</AsyncAPIDocumentOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
Expand All @@ -17,6 +23,23 @@
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>

<!-- Get the latest local build nuget package from source code, from the local nuget packages source as configured in nuget.config
999.* are the 'special' version number for local builds -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="AsyncAPI.Saunter.Generator.Build" Version="999.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<!-- For release: use a real published nuget package -->
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<PackageReference Include="AsyncAPI.Saunter.Generator.Build" Version="*-*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Saunter\Saunter.csproj" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions local-nuget-source/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Place holder, so the local-nuget-source exists.
11 changes: 11 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<!-- Adds the folder "local-nuget-source" in root of the project as a nuget source.
Projects that build a nuget package publish in this folder so dependent projects can use the local build packages -->
<add key="Local-sauter" value="local-nuget-source" />

<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../Common.NugetPackage.props" />

<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12</LangVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>$(NoWarn);NU5128</NoWarn>

<Description>AsyncAPI Build Tools: Generate AsyncAPI spec file(s) during build from a startup project.</Description>
<Authors>AsyncAPI Initiative</Authors>
<IsTool>true</IsTool>
<PackageId>AsyncAPI.Saunter.Generator.Build</PackageId>
<PackageTags>asyncapi;aspnetcore;openapi;documentation;amqp;generator;build;tool</PackageTags>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<PackageIcon>logo.png</PackageIcon>
<RepositoryUrl>https://github.com/asyncapi/saunter</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
<PackageProjectUrl>https://github.com/asyncapi/saunter</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<DevelopmentDependency>true</DevelopmentDependency>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<!-- Development Dependencies -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Update="@(PackageReference)" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath="/" />
<None Include="../../assets/logo.png" Pack="true" PackagePath="/" />
<None Include="build/*" Pack="true" PackagePath="/build" />
<None Include="bin/$(Configuration)/$(TargetFramework)" Pack="true" PackagePath="/tools" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AsyncAPI.Saunter.Generator.Cli\AsyncAPI.Saunter.Generator.Cli.csproj" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project>

<!-- List all available properties to customize the AsyncAPI.Generator.Build package -->
<PropertyGroup>
<AsyncAPIGenerateDocumentsOnBuild Condition=" '$(AsyncAPIGenerateDocumentsOnBuild)' == '' ">true</AsyncAPIGenerateDocumentsOnBuild>
<AsyncAPIDocumentFormats Condition=" '$(AsyncAPIDocumentFormats)' == '' ">json</AsyncAPIDocumentFormats>
<AsyncAPIDocumentOutputPath Condition=" '$(AsyncAPIDocumentOutputPath)' == '' ">./</AsyncAPIDocumentOutputPath>
<AsyncAPIDocumentFilename Condition=" '$(AsyncAPIDocumentFilename)' == '' "></AsyncAPIDocumentFilename>
<AsyncAPIDocumentNames Condition=" '$(AsyncAPIDocumentNames)' == '' "></AsyncAPIDocumentNames>
<AsyncAPIDocumentEnvVars Condition=" '$(AsyncAPIDocumentEnvVars)' == '' "></AsyncAPIDocumentEnvVars>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project>

<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition=" '$(AsyncAPIGenerateDocumentsOnBuild)' == 'true' ">
<!-- Calculate some paths -->
<PropertyGroup>
<AsyncAPIBuildToolBuildDir>$([System.IO.Path]::GetDirectoryName($(MSBuildThisFileDirectory)))</AsyncAPIBuildToolBuildDir>
<AsyncAPIBuildToolRoot>$([System.IO.Path]::GetDirectoryName($(AsyncAPIBuildToolBuildDir)))</AsyncAPIBuildToolRoot>
<AsyncAPICliToolPath>$([System.IO.Path]::Combine($(AsyncAPIBuildToolRoot), tools, net8.0, AsyncAPI.Saunter.Generator.Cli.dll))</AsyncAPICliToolPath>
<AsyncAPICliToolStartupAssembly>$([System.IO.Path]::Combine($(MSBuildProjectDirectory), $(OutputPath), $(AssemblyTitle).dll))</AsyncAPICliToolStartupAssembly>
<AsyncAPICliToolOutputPath>$([System.IO.Path]::Combine($(MSBuildProjectDirectory), $(AsyncAPIDocumentOutputPath)))</AsyncAPICliToolOutputPath>
</PropertyGroup>

<!-- Debug output: print some paths, set -v flag (verbosity) at least to [n]ormal to show in build output -->
<Message Text="AsyncAPI.Generator.Build; AsyncAPICliToolPath: $(AsyncAPICliToolPath)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPICliToolStartupAssembly: $(AsyncAPICliToolStartupAssembly)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPICliToolOutputPath: $(AsyncAPICliToolOutputPath)" />

<Message Text="AsyncAPI.Generator.Build; AsyncAPIDocumentFormats: $(AsyncAPIDocumentFormats)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPIDocumentOutputPath: $(AsyncAPIDocumentOutputPath)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPIDocumentNames: $(AsyncAPIDocumentNames)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPIDocumentFilename: $(AsyncAPIDocumentFilename)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPIDocumentEnvVars: $(AsyncAPIDocumentEnvVars)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPIBuildToolBuildDir: $(AsyncAPIBuildToolBuildDir)" />
<Message Text="AsyncAPI.Generator.Build; AsyncAPIBuildToolRoot: $(AsyncAPIBuildToolRoot)" />
<Message Text="AsyncAPI.Generator.Build; MSBuildThisFile: $(MSBuildThisFile)" />
<Message Text="AsyncAPI.Generator.Build; MSBuildThisFileDirectory: $(MSBuildThisFileDirectory)" />
<Message Text="AsyncAPI.Generator.Build; MSBuildProjectFullPath: $(MSBuildProjectFullPath)" />
<Message Text="AsyncAPI.Generator.Build; MSBuildProjectDirectory: $(MSBuildProjectDirectory)" />

<Exec Command="dotnet &quot;$(AsyncAPICliToolPath)&quot; tofile &quot;$(AsyncAPICliToolStartupAssembly)&quot; --output &quot;$(AsyncAPICliToolOutputPath)&quot; --format &quot;$(AsyncAPIDocumentFormats)&quot; --doc &quot;$(AsyncAPIDocumentNames)&quot; --filename &quot;$(AsyncAPIDocumentFilename)&quot; --env &quot;$(AsyncAPIDocumentEnvVars)&quot;"
WorkingDirectory="$(AsyncAPIBuildToolRoot)" />
</Target>

</Project>
30 changes: 30 additions & 0 deletions src/AsyncAPI.Saunter.Generator.Build/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# AsyncApi Generator.Build Nuget Package
A nuget package to generate AsyncAPI specification files at build time, based on code-first attributes. This nuget package requires .NET8.0 runtime in order to work. The consuming csproj doesn't need to target .NET8.0.

This nuget packages can help to better control API changes by commiting the AsyncAPI spec to source control. By always generating spec files at build, it will be clear when the api changes.

# Customization Properties
The AsyncAPI spec generation can be configured through project properties in the csproj-file (or included via [.props files](https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build)):
```
<PropertyGroup>
<AsyncAPIGenerateDocumentsOnBuild></AsyncAPIGenerateDocumentsOnBuild>
<AsyncAPIDocumentFormats></AsyncAPIDocumentFormats>
<AsyncAPIDocumentOutputPath></AsyncAPIDocumentOutputPath>
<AsyncAPIDocumentNames></AsyncAPIDocumentNames>
<AsyncAPIDocumentFilename></AsyncAPIDocumentFilename>
<AsyncAPIDocumentEnvVars></AsyncAPIDocumentEnvVars>
</PropertyGroup>
```

Defaults are the same as the underlying [Generator.Cli tool](https://www.nuget.org/packages/AsyncAPI.Saunter.Generator.Cli).

If the ```AsyncAPI.Saunter.Generator.Build``` Nuget package is referenced, the default is to generate AsyncAPI spec files at build time.

- _AsyncAPIGenerateDocumentsOnBuild_: Whether to actually generate AsyncAPI spec files on build (true or false, default: true)
- _AsyncAPIDocumentFormats_: the output formats to generate, can be a combination of json, yml and/or yaml.
- _AsyncAPIDocumentOutputPath_: relative path where the AsyncAPI will be output (default is the csproj root path: ./)
- _AsyncAPIDocumentNames_: The AsyncAPI documents to generate. (default: generate all known documents)
- _AsyncAPIDocumentFilename_: the template for the outputted file names. Default: "{document}_asyncapi.{extension}"
- _AsyncAPIDocumentEnvVars_: define environment variable(s) for the application. Formatted as a comma separated list of _key=value_ pairs, example: ```ASPNETCORE_ENVIRONMENT=AsyncAPI,CONNECT_TO_DATABASE=false```.

None of these properties are mandatory. Only referencing the [AsyncAPI.Saunter.Generator.Build](https://www.nuget.org/packages/AsyncAPI.Saunter.Generator.Build) Nuget package will generate a json AsyncAPI spec file for all AsyncAPI documents.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../Common.NugetPackage.props" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
Expand Down
3 changes: 3 additions & 0 deletions src/AsyncAPI.Saunter.Generator.Cli/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# AsyncApi Generator.Cli Tool
A dotnet tool to generate AsyncAPI specification files based of a dotnet assembly (The application itself).

This tool can used to manually generate spec files from a startup assembly or to setup a custom build pipeline.
If you are intressed in always generating spec files at build time, see [AsyncAPI.Saunter.Generator.Build](https://www.nuget.org/packages/AsyncAPI.Saunter.Generator.Build).

## Tool usage
```
dotnet asyncapi tofile [startup-assembly] --output [output-path] --format [json,yml,yaml] --doc [asyncapi-document-name]
Expand Down
10 changes: 10 additions & 0 deletions src/Common.NugetPackage.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<!-- 999.* are local builds numbers, they must be unique each build to bypass all nuget caching -->
<Version>999.$([System.DateTime]::Now.ToString("yy"))$([System.DateTime]::Now.DayOfYear).$([System.DateTime]::Now.ToString("HHmm"))</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>../../local-nuget-source</PackageOutputPath>
</PropertyGroup>

</Project>
10 changes: 10 additions & 0 deletions src/Saunter-src.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"solution": {
"path": "..\\Saunter.sln",
"projects": [
"src\\AsyncAPI.Saunter.Generator.Build\\AsyncAPI.Saunter.Generator.Build.csproj",
"src\\AsyncAPI.Saunter.Generator.Cli\\AsyncAPI.Saunter.Generator.Cli.csproj",
"src\\Saunter\\Saunter.csproj"
]
}
}
Loading