-
Notifications
You must be signed in to change notification settings - Fork 57
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
#196 Publish a global dotnet tool (AsyncAPI.Saunter.Generator.Cli) #217
Open
smoerijf
wants to merge
37
commits into
asyncapi:main
Choose a base branch
from
smoerijf:#196-Publish-a-global-dotnet-tool
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,772
−155
Open
Changes from 16 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
6318f80
#196 Publish a global dotnet tool
2162d72
#196 Publish a global dotnet tool -- Api/API casing fix
55895a2
#196 .NET8
6ba3409
#196 .NET6
74c9cff
#196 I'd like .NET8 more, request both for ci
cc5d952
#196 I'd like .NET8 more, request both for ci?
569a30a
#196 Fixed resolving, added support for multiple asyncAPI documents, …
0419101
#196 Test for dotnet cli tool, added support for default asyncapi doc…
b29a1ab
#196 Pack_Install_Run_Uninstall Test
12593dc
#196 Pack_Install_Run_Uninstall fix casing in test, add meta data to …
93dc17e
#196 fix accident
e701660
#196 fix warnings, fix permission
d9b558c
#196 unix needs a shebang
f0af6d1
#196 sourcelink properties
1ebb77c
#196 renamed tool to make up a more logical name, fixed empty paramet…
ba1e856
#196 fix readme error
90dcff1
Merge remote-tracking branch 'remotes/origin/main' into #196-Publish-…
a746e4d
#196 Fixed formatting etc + some PR remarks
8e7a01f
#196 Tool rewrite to make its components testable, removed Swachbuckl…
240c9ed
#196 formatting
715a62d
#196 add unitTests for tofile classes
e181850
#196 add unitTests for tofile
ab5b375
#196-Publish-a-global-dotnet-tool
183a4e8
#196 formatting
8d2fd49
#196 ALL tests should run
a9d544a
#196 Tests use streetlights DLL in integegration tests, add dependency
72dc742
#196 release also the CLI tool
7b22ce0
#196 Add example project with top level statement, because that faile…
ba8dd8e
#196 Ignore expected warning (ASP0014 needs #173)
3d6c0ea
#196 formatting and readme wording
8a4f5c6
#196 ExitCode test problems
07b4273
#196 ExitCode test problems -- the issue is a missing reference
e846dd9
#196 GetStreamFor logging
fc7cccd
#196 GetStreamFor try recreate directory?
4f1064e
#196 GetStreamFor try recreate directory??
74260a8
#196 permission issue?
5fe8c6e
#196 cleanup csproj
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
// ReSharper disable once CheckNamespace | ||
public static partial class Program | ||
{ | ||
internal const string StartupAssemblyArgument = "startupassembly"; | ||
internal const string DocOption = "--doc"; | ||
internal const string FormatOption = "--format"; | ||
internal const string FileNameOption = "--filename"; | ||
internal const string OutputOption = "--output"; | ||
internal const string EnvOption = "--env"; | ||
} |
49 changes: 49 additions & 0 deletions
49
src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<LangVersion>12</LangVersion> | ||
<RootNamespace>AsyncAPI.Saunter.Generator.Cli</RootNamespace> | ||
|
||
<Description>AsyncAPI Command Line Tools</Description> | ||
<Authors>AsyncAPI Initiative</Authors> | ||
<PackAsTool>true</PackAsTool> | ||
<PackageId>AsyncAPI.Saunter.Generator.Cli</PackageId> | ||
<ToolCommandName>dotnet-asyncapi</ToolCommandName> | ||
<PackageTags>asyncapi;aspnetcore;openapi;documentation;amqp;generator;cli;tool</PackageTags> | ||
<PackageReadmeFile>readme.md</PackageReadmeFile> | ||
<PackageIcon>logo.png</PackageIcon> | ||
<RepositoryUrl>https://github.com/asyncapi/saunter</RepositoryUrl> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<PackageProjectUrl>https://github.com/asyncapi/saunter</PackageProjectUrl> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<Version>1.0.1</Version> | ||
smoerijf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</PropertyGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' "> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AsyncAPI.NET.Readers" Version="5.2.1" /> | ||
|
||
<!-- Development Dependencies --> | ||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Saunter\Saunter.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="readme.md" Pack="true" PackagePath="\"/> | ||
<None Include="../../assets/logo.png" Pack="true" PackagePath="/" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
smoerijf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Diagnostics; | ||
using System.Reflection; | ||
using static Program; | ||
|
||
namespace AsyncApi.Saunter.Generator.Cli.Commands; | ||
|
||
internal class Tofile | ||
{ | ||
internal static Func<IDictionary<string, string>, int> Run(string[] args) => namedArgs => | ||
{ | ||
if (!File.Exists(namedArgs[StartupAssemblyArgument])) | ||
{ | ||
throw new FileNotFoundException(namedArgs[StartupAssemblyArgument]); | ||
} | ||
|
||
var depsFile = namedArgs[StartupAssemblyArgument].Replace(".dll", ".deps.json"); | ||
var runtimeConfig = namedArgs[StartupAssemblyArgument].Replace(".dll", ".runtimeconfig.json"); | ||
var commandName = args[0]; | ||
|
||
var subProcessArguments = new string[args.Length - 1]; | ||
if (subProcessArguments.Length > 0) | ||
{ | ||
Array.Copy(args, 1, subProcessArguments, 0, subProcessArguments.Length); | ||
} | ||
|
||
var assembly = typeof(Program).GetTypeInfo().Assembly; | ||
var subProcessCommandLine = | ||
$"exec --depsfile {EscapePath(depsFile)} " + | ||
$"--runtimeconfig {EscapePath(runtimeConfig)} " + | ||
$"{EscapePath(assembly.Location)} " + | ||
$"_{commandName} {string.Join(" ", subProcessArguments.Select(EscapePath))}"; | ||
|
||
var subProcess = Process.Start("dotnet", subProcessCommandLine); | ||
subProcess.WaitForExit(); | ||
return subProcess.ExitCode; | ||
}; | ||
|
||
private static string EscapePath(string path) | ||
{ | ||
return (path.Contains(' ') || string.IsNullOrWhiteSpace(path)) ? "\"" + path + "\"" : path; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current files were using a size of 2 and lf line endings, so I changed it (because my VS defaults are different)