-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Rewrite dotnet-getdocument and GetDocument.Insider to retrieve all documents in one go #10667
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
Conversation
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.
Pranav asked me to help him look at this.
Overall I think looks good. I left a few comments. Mostly I would strongly recommend you to reuse the logic for finding the app entry point, as we share that everywhere.
I'm not sure about the constraints this tool has, but there are other things that are a bit concerning to me, like reading the deps file or the runtime.config.json file.
I also don't see any tests for this PR, not sure if its because there are already tests and didn't require changes or because there aren't any. If its the latter, I think there should be at least one, as this tool does a lot of things that are prone to integration errors.
That said, I don't see anything that strikes me as wrong here.
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
|
||
// Write out the cache file. | ||
var stream = File.Create(context.FileListPath); | ||
using var writer = new StreamWriter(stream) { AutoFlush = true }; |
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.
+5 Pranav points
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
_output = command.Option("--output <Path>", Resources.OutputDescription); | ||
_service = command.Option("--service <QualifiedName>", Resources.FormatServiceDescription(FallbackService)); | ||
_fileListPath = command.Option("--file-list <Path>", Resources.FileListDescription); | ||
_output = command.Option("--output <Directory>", Resources.OutputDescription); |
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.
example usage of this for the unfamiliar?
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.
Also, is this something that needs to be reviewed in detail? or is this an implementation detail of the MSBuild functionality?
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.
This is an implementation detail of the MSBuild functionality seen in #10669 and that PR shows how the tool should be used
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
src/Mvc/GetDocumentInsider/src/Commands/GetDocumentCommandWorker.cs
Outdated
Show resolved
Hide resolved
args.Add(project.TargetPath); | ||
args.Add(assemblyPath); | ||
args.Add("--project"); | ||
args.Add(projectName); |
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.
I'm probably not the best person to review the inside-man stuff. I've never really known how this works 😕
The general spirit of the changes here makes sense to me and sees like a good enhancement. Due to the diffs being what they are, I'm not really sure if I'm reviewing old code or new code, but I still found some things that seem worthy of a look. |
@javiercn I realize I missed your high-level comments, sorry:
None of the code reads either of these files though it does scan the project assets file for probing paths. The See similar code in the
This feature has some engineering debt I'll be catching up on in the next milestone. #4914 covers the test part of that. |
…all documents in one go - #8242 1 of 2 - save a cache file listing all retrieved documents - remove .NET Core App 2.0 support - remove ServiceProjectReferenceMetadata.targets, related `Project` class, and searches for a project - tools will run within a project and get needed information from project on command line - roll framework forward in both tools to expand their applicability nits: - refactor methods in `GetDocumentCommandWorker` - reorder option addition for consistency and to place `--help` at the top of help output - consolidate information about method signatures at top of `GetDocumentCommandWorker` - consolidate `try` / `catch` blocks in `GetDocumentCommandWorker`
- use Microsoft.Extensions.HostFactoryResolver.Sources - remove `GetMethod(...)` parameters that aren't needed anymore - remove Microsoft.AspNetCore.Hosting.Abstractions dependency - remove `Flush()` and `AutoFlush = true` - use `Exception.ToString()` and `String.Replace(...)` - move unnecessary lines out of a `try` block nits: - "retrieving" -> "generating" - shorten the lifespan of a `Task` - ensure GetDocument.Insider exit codes are unique - make a few more `string`s `const` - fold a few expressions over fewer lines
- ensure it is flushed before underlying stream is read
426880e
to
d1130bf
Compare
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.
🆙:date; to address more comments than I expected
Project
class, and searches for a projectnits:
GetDocumentCommandWorker
--help
at the top of help outputGetDocumentCommandWorker
try
/catch
blocks inGetDocumentCommandWorker