Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#197 Produce AsyncAPI documents at build time (AsyncAPI.Saunter.Generator.Build) #219

Draft
wants to merge 75 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
6318f80
#196 Publish a global dotnet tool
Jul 6, 2024
2162d72
#196 Publish a global dotnet tool -- Api/API casing fix
Jul 6, 2024
55895a2
#196 .NET8
Jul 6, 2024
6ba3409
#196 .NET6
Jul 6, 2024
74c9cff
#196 I'd like .NET8 more, request both for ci
Jul 6, 2024
cc5d952
#196 I'd like .NET8 more, request both for ci?
Jul 6, 2024
569a30a
#196 Fixed resolving, added support for multiple asyncAPI documents, …
Jul 6, 2024
0419101
#196 Test for dotnet cli tool, added support for default asyncapi doc…
Jul 6, 2024
b29a1ab
#196 Pack_Install_Run_Uninstall Test
Jul 6, 2024
12593dc
#196 Pack_Install_Run_Uninstall fix casing in test, add meta data to …
Jul 6, 2024
93dc17e
#196 fix accident
Jul 6, 2024
e701660
#196 fix warnings, fix permission
Jul 6, 2024
d9b558c
#196 unix needs a shebang
Jul 6, 2024
f0af6d1
#196 sourcelink properties
Jul 6, 2024
a379a3e
#197 Produce AsyncAPI documents at build time
Jul 6, 2024
02ffbcd
#197 Produce AsyncAPI documents at build time
Jul 7, 2024
1ebb77c
#196 renamed tool to make up a more logical name, fixed empty paramet…
Jul 7, 2024
ba1e856
#196 fix readme error
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
90dcff1
Merge remote-tracking branch 'remotes/origin/main' into #196-Publish-…
Jul 8, 2024
a746e4d
#196 Fixed formatting etc + some PR remarks
Jul 9, 2024
8e7a01f
#196 Tool rewrite to make its components testable, removed Swachbuckl…
Jul 9, 2024
240c9ed
#196 formatting
Jul 9, 2024
715a62d
#196 add unitTests for tofile classes
Jul 10, 2024
e181850
#196 add unitTests for tofile
Jul 10, 2024
ab5b375
#196-Publish-a-global-dotnet-tool
Jul 11, 2024
183a4e8
#196 formatting
Jul 11, 2024
8d2fd49
#196 ALL tests should run
Jul 11, 2024
a9d544a
#196 Tests use streetlights DLL in integegration tests, add dependency
Jul 11, 2024
72dc742
#196 release also the CLI tool
Jul 11, 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
7b22ce0
#196 Add example project with top level statement, because that faile…
Jul 13, 2024
ba8dd8e
#196 Ignore expected warning (ASP0014 needs #173)
Jul 13, 2024
3d6c0ea
#196 formatting and readme wording
Jul 13, 2024
8a4f5c6
#196 ExitCode test problems
Jul 13, 2024
07b4273
#196 ExitCode test problems -- the issue is a missing reference
Jul 13, 2024
e846dd9
#196 GetStreamFor logging
Jul 13, 2024
fc7cccd
#196 GetStreamFor try recreate directory?
Jul 13, 2024
4f1064e
#196 GetStreamFor try recreate directory??
Jul 13, 2024
74260a8
#196 permission issue?
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
5fe8c6e
#196 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
Prev Previous commit
Next Next commit
#196 permission issue?
Senn Geerts authored and Senn Geerts committed Jul 13, 2024
commit 74260a8fb877dcb86dec50ead7afcfb2d5b798f0
16 changes: 1 addition & 15 deletions src/AsyncAPI.Saunter.Generator.Cli/ToFile/StreamProvider.cs
Original file line number Diff line number Diff line change
@@ -16,21 +16,7 @@ public Stream GetStreamFor(string path)

if (!string.IsNullOrEmpty(path))
{
var directory = new DirectoryInfo(Path.GetDirectoryName(path));
var sw = Stopwatch.StartNew();
do
{
try
{
directory.Create();
}
catch (Exception e) when (sw.Elapsed < TimeSpan.FromMilliseconds(250))
{
logger.LogDebug(e, $"Retry... {directory.Parent.Exists}, {directory.Parent.Parent.Exists}, {directory.Parent.Parent.Parent.Exists}");
Thread.Sleep(100);
}
}
while (!directory.Exists);
Directory.CreateDirectory(Path.GetDirectoryName(path));
}

return path != null ? File.Create(path) : Console.OpenStandardOutput();
22 changes: 11 additions & 11 deletions test/AsyncAPI.Saunter.Generator.Cli.Tests/IntegrationTests.cs
Original file line number Diff line number Diff line change
@@ -60,26 +60,26 @@ Retrieves AsyncAPI spec from a startup assembly and writes to file.
[InlineData("StreetlightsAPI.TopLevelStatement", "net8.0")]
public void Streetlights_ExportSpecTest(string csprojName, string targetFramework)
{
var path = Path.Combine(Directory.GetCurrentDirectory(), csprojName, "specs");
var path = Path.Combine(Directory.GetCurrentDirectory());
output.WriteLine($"Output path: {path}");
var stdOut = RunTool($"tofile ../../../../../examples/{csprojName}/bin/Debug/{targetFramework}/{csprojName}.dll --output {path} --format json,yml,yaml");
var stdOut = RunTool($"tofile ../../../../../examples/{csprojName}/bin/Debug/{targetFramework}/{csprojName}.dll --output {path} --filename {csprojName}.{{extension}} --format json,yml,yaml");

stdOut.ShouldNotBeEmpty();
stdOut.ShouldContain($"AsyncAPI yaml successfully written to {Path.Combine(path, "asyncapi.yaml")}");
stdOut.ShouldContain($"AsyncAPI yml successfully written to {Path.Combine(path, "asyncapi.yml")}");
stdOut.ShouldContain($"AsyncAPI json successfully written to {Path.Combine(path, "asyncapi.json")}");
stdOut.ShouldContain($"AsyncAPI yaml successfully written to {Path.Combine(path, $"{csprojName}.yaml")}");
stdOut.ShouldContain($"AsyncAPI yml successfully written to {Path.Combine(path, $"{csprojName}.yml")}");
stdOut.ShouldContain($"AsyncAPI json successfully written to {Path.Combine(path, $"{csprojName}.json")}");

File.Exists(Path.Combine(path, "asyncapi.yml")).ShouldBeTrue("asyncapi.yml");
File.Exists(Path.Combine(path, "asyncapi.yaml")).ShouldBeTrue("asyncapi.yaml");
File.Exists(Path.Combine(path, "asyncapi.json")).ShouldBeTrue("asyncapi.json");
File.Exists(Path.Combine(path, $"{csprojName}.yml")).ShouldBeTrue();
File.Exists(Path.Combine(path, $"{csprojName}.yaml")).ShouldBeTrue();
File.Exists(Path.Combine(path, $"{csprojName}.json")).ShouldBeTrue();

var yml = File.ReadAllText(Path.Combine(path, "asyncapi.yml"));
var yml = File.ReadAllText(Path.Combine(path, $"{csprojName}.yml"));
yml.ShouldBe(ExpectedSpecFiles.Yml_v2_6, "yml");

var yaml = File.ReadAllText(Path.Combine(path, "asyncapi.yaml"));
var yaml = File.ReadAllText(Path.Combine(path, $"{csprojName}.yaml"));
yaml.ShouldBe(yml, "yaml");

var json = File.ReadAllText(Path.Combine(path, "asyncapi.json"));
var json = File.ReadAllText(Path.Combine(path, $"{csprojName}.json"));
json.ShouldBe(ExpectedSpecFiles.Json_v2_6, "json");
}
}