-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add a --print-dtd flag to print the DTD address served by DevTools server
#144272
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
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
| final Match? dtdMatch = _serveDtdPattern.firstMatch(line); | ||
| if (dtdMatch != null) { | ||
| final String uri = dtdMatch[1]!; | ||
| dtdUri = Uri.parse(uri); |
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.
nit, we can return here and not bother checking for _serveDevToolsPattern, right?
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.
No these are independent of one another. The _serveDevToolsPattern should always be in the stdout. The _serveDtdPattern might be there depending on whether the --print-dtd flag was passed to the dart devtools command above.
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.
Would they be on the same line though?
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.
No these will be on separate lines.
|
|
||
| devToolsUrl = await completer.future; | ||
| // We do not need to wait for a [Completer] holding the DTD URI because | ||
| // the DTD URI will be output to stdout before the DevTools URI. Awaiting |
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.
Is this an implementation detail that could be inadvertently broken in a future refactor?
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.
Could also be a reason to use the nifty new FutureRecord2 extension method .wait() :)
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.
The DTD uri won't always be available here, so we can't await a completer with the guarantee that it will complete. I can add tests in https://dart-review.googlesource.com/c/sdk/+/354460 that verify the order, with a comment that if the order or strings should change, that we will need to update the Flutter tools launcher. We could already get in a broken state with the existing "Serving DevTools" string if that were ever to change.
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.
ahhhh, I see. A test sounds great, thanks!
|
Just added testing. Please review with "Hide whitespace" enabled. I fixed a formatting issue as a yak-shave. |
| argParser.addFlag( | ||
| FlutterGlobalOptions.kPrintDtdUri, | ||
| negatable: false, | ||
| help: 'Print the URI of the Dart Tooling Daemon, if one is hosted by the Flutter CLI.', |
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.
@christopherfujino is it okay to say "the Flutter CLI" here? Technically it is hosted by DevTools server, but that seemed like an implementation detail that wouldn't mean anything to the end user.
--print-dtd-uri flag to print the DTD address served by DevTools server--print-dtd flag to print the DTD address served by DevTools server
christopherfujino
left a comment
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.
LGTM
|
I'm seeing test failures that I'm 99% sure are not related to your change: |
|
merging in upstream master, in case it was fixed there. it might also have been a recipe change... |
|
The failure is being triggered from this line: @christopherfujino any ideas on why that artifact would not be available in a test environment? Or how to make it so that it is available? Another thought is to wrap |
|
All tests are passing with the try / catch. @christopherfujino let me know if you think this is an acceptable solution. |
Hmm, a lot of this code (not from your PR) looks wrong to me, but I'm not fully grokking what happened. I'm investigating now... |
Now that https://dart-review.googlesource.com/c/sdk/+/354460 has landed, DevTools server (or DDS depending on how DDS is started) will spawn the Dart Tooling Daemon (DTD). We need a way to access this URI from both the Dart CLI (dart-lang/sdk#55034) and Flutter CLI (#144270)
This PR
adds a command runner flag

--print-dtdthat is passed along to theDevToolsLauncherclass. This value is then read when printing the DevTools output to determine whether we should also print a DTD uri.[cleanup for testing] merges multiple
FakeDevtoolsLauncherclasses into a single fake defined infakes.dartFixes #144270.
@bkonyi @christopherfujino