-
Notifications
You must be signed in to change notification settings - Fork 28.8k
Only synchronize used Dart sources to DevFS. #6668
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
Only synchronize used Dart sources to DevFS. #6668
Conversation
johnmccutchan
commented
Nov 2, 2016
- Remove the second full-sync on startup.
- Always invoke the snapshotter to determine the minimal set of Dart sources used.
- Only synchronize the used Dart sources to DevFS.
- Detect syntax / file missing errors on the host and gate reloads / restarts.
This needs a roll of the engine too but the bots are red, so, I'm putting this up for review in the meantime. |
/// Run cmd and return stdout on success. | ||
/// | ||
/// Throws the standard error output if cmd exits with a non-zero value. | ||
String runSyncAndThrowStdErrOnError(List<String> cmd) { |
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.
we really should avoid adding more ways to run subprocesses... I don't suppose I can get you to embrace a yak shave that involves cleaning up this file, can I? :-)
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.
Agreed but I'm thinking more about instance field initializers...
/// Run cmd and return stdout on success. | ||
/// | ||
/// Throws the standard error output if cmd exits with a non-zero value. | ||
String runSyncAndThrowStdErrOnError(List<String> cmd) { |
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.
We should probably move away from "Sync" ways of running subprocesses, by the way, since they block progress meters.
} catch (e) { | ||
return null; | ||
rethrow; |
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.
??
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.
Dropped the try { } catch {}.
result = await _restartFromSources(); | ||
} | ||
if (!result.isOk) { | ||
printStatus('Try again after fixing the above error(s).', emphasis: 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.
Bonus points if you can figure out how many errors there were, and use error/errors appropriately instead of "error(s)". :-)
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.
Line count might be sufficient. I've added a TODO here.
bool updatedDevFS = await _updateDevFS(); | ||
if (!updatedDevFS) { | ||
return new OperationResult(1, 'Dart Source Error'); | ||
} |
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: extraneous braces
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.
Done.
if (_devFS != null) { | ||
bool updatedDevFS = await _updateDevFS(); | ||
if (!updatedDevFS) { | ||
return new OperationResult(1, 'Dart Source Error'); |
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.
extraneous braces
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.
Done.
LGTM with comments |
- [x] Remove the second full-sync on startup. - [x] Always invoke the snapshotter to determine the minimal set of Dart sources used. - [x] Only synchronize the *used* Dart sources to DevFS. - [x] Detect syntax / file missing errors on the host and gate reloads / restarts.