feat(): adjust apigenerator to use dotnet format#747
Closed
joefeser wants to merge 8 commits intoopensearch-project:mainfrom
Closed
feat(): adjust apigenerator to use dotnet format#747joefeser wants to merge 8 commits intoopensearch-project:mainfrom
joefeser wants to merge 8 commits intoopensearch-project:mainfrom
Conversation
bb21002 to
7abde69
Compare
Xtansia
reviewed
Aug 8, 2024
src/ApiGenerator/Program.cs
Outdated
Comment on lines
+178
to
+216
| var rootPath = GetRootPath(typeof(Program).Assembly.Location); | ||
|
|
||
| var relativeFolderList = new List<string>(); | ||
|
|
||
| foreach (var item in Generator.ApiGenerator.GeneratedFilePaths) | ||
| { | ||
| var relativePath = item.Replace(rootPath.FullName, string.Empty); | ||
| relativeFolderList.Add($".{relativePath.Replace("\\", "/")}"); | ||
| } | ||
|
|
||
| var si = new System.Diagnostics.ProcessStartInfo | ||
| { | ||
| WorkingDirectory = rootPath.FullName, | ||
| FileName = "dotnet", | ||
| Arguments = "format -v diag --include " + string.Join(' ', relativeFolderList.Select(item => $"{item}")), | ||
| RedirectStandardInput = true, | ||
| RedirectStandardOutput = true, | ||
| RedirectStandardError = true, | ||
| UseShellExecute = false, | ||
| CreateNoWindow = true, | ||
| }; | ||
|
|
||
| var process = System.Diagnostics.Process.Start(si); | ||
|
|
||
| Console.WriteLine(); | ||
| Console.WriteLine($"Running dotnet format --include {string.Join(' ', relativeFolderList.Select(item => $"{item}"))} -v diag"); | ||
|
|
||
| // hookup the eventhandlers to capture the data that is received | ||
| process.OutputDataReceived += (sender, args) => Console.WriteLine(args.Data); | ||
| process.ErrorDataReceived += (sender, args) => Console.WriteLine(args.Data); | ||
|
|
||
| process.Start(); | ||
|
|
||
| // start our event pumps | ||
| process.BeginOutputReadLine(); | ||
| process.BeginErrorReadLine(); | ||
|
|
||
| process.WaitForExit(); | ||
| Console.WriteLine(); |
Collaborator
There was a problem hiding this comment.
If you add a package reference on Proc = 0.8.1 which is already used by other projects in the solution, this could be simplified down to something like:
Proc.Exec(new ExecArguments("dotnet", "format", "--verbosity", "normal", "--include", "./src/*/_Generated/")
{
WorkingDirectory = GeneratorLocations.SolutionFolder
})And just define GeneratorLocations.SolutionFolder as something like:
public static string SolutionFolder { get; } = $"{Root}../../";
Contributor
Author
There was a problem hiding this comment.
No problem, thank you for the feedback. I will make the changes this evening
Contributor
Author
There was a problem hiding this comment.
PR Comments resolved
Contributor
Author
There was a problem hiding this comment.
@Xtansia I updated the pr off the current main branch. If you ignore _generated files, there are less than 20 files to review.
2338330 to
384648d
Compare
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
44310c0 to
439ec72
Compare
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
Signed-off-by: Joe Feser <joseph.feser@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adjust the generator to use dotnet format
Issues Resolved
Request from #739, Phase 1
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.