[custom-devices] general improvements, add custom-devices subcommand, better error handling#82043
Conversation
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
fb909e1 to
8195220
Compare
|
Great work! I have one feedback about |
Thanks! Yeah, the style guide also mentions this, I chose to ignore it because I thought it'd be weird for a field to default to "true" if omitted, but you're probably right I should've called it I'll change it 👍 |
f6c028f to
e30c32e
Compare
|
this should be ready to be reviewed now @jonahwilliams (just fyi) |
|
Awesome, will take a look at this tomorrow! |
jonahwilliams
left a comment
There was a problem hiding this comment.
Still looking through this one, just some initial feedback
There was a problem hiding this comment.
not sure what this means
There was a problem hiding this comment.
A config with a null runDebug command would be invalid, a config with ["dawdawaw"] as the runDebug command would be valid, but wouldn't work
So you can use the --check option to make sure it the config actually works, which will execute some of the commands of the config with dummy arguments and see if they succeed.
But if you have to ask to understand it, that's probably a good sign the help isn't helpful enough 😄
There was a problem hiding this comment.
I updated the help, is it better?
There was a problem hiding this comment.
ahh I see. In this case, it is better to either leave off the value help or provide an actual example of the data you would pass : valueHelp: '{...};. That might be too much for the CLI help option
There was a problem hiding this comment.
Okay, I changed the valueHelp to {"id": "pi", ...} now
packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart
Outdated
Show resolved
Hide resolved
jonahwilliams
left a comment
There was a problem hiding this comment.
FallThroughError should be an Exception type if it is intended to be caught.
There was a problem hiding this comment.
ahh I see. In this case, it is better to either leave off the value help or provide an actual example of the data you would pass : valueHelp: '{...};. That might be too much for the CLI help option
packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/custom_devices/custom_devices_config.dart
Outdated
Show resolved
Hide resolved
df79296 to
6fb0d02
Compare
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
6fb0d02 to
576c39d
Compare
I see, in the one instance where I throw it, it's not intended to be caught (I mean I don't know what to do when the command is run on something other than macOS, windows or linux) Also I did something wrong while rebasing (somehow I rebased master on top of custom-device-improvements instead of the other way around), all the master commits showed up in this PR and somehow the bot requested two authors of the commits for review. Maybe you can remove the two from the reviewer list? @jonahwilliams |
- make CustomDeviceConfig throw `JsonRevivalException` when it couldn't load the config. - make CustomDevicesConfig log those JsonRevivalExceptions - make CustomDevicesConfig log other config loading errors - add tests for CustomDevicesConfig for testing those errors - implement more dataclass-like methods for CustomDeviceConfig - make CustomDeviceConfig immutable - improve default pingSuccessRegex - move some common stuff from the custom device tests into a custom_devices_common.dart - fix some formatting issues
- hookup track-widget-creation and tree-shake-icons options - hookup runtime engine options
… when the device is unreachable)
Co-authored-by: Jonah Williams <[email protected]>
Co-authored-by: Jonah Williams <[email protected]>
…nfig.dart Co-authored-by: Jonah Williams <[email protected]>
…nfig.dart Co-authored-by: Jonah Williams <[email protected]>
Co-authored-by: Jonah Williams <[email protected]>
- use ErrorHandlingFilesystem to delete file - use OperatingSystemUtils to find a free port - improve the custom-devices add help a bit
… doesn't exist, and return false when that's the case - in test, match config file contents after executing custom-devices reset - add test for correct custom-devices reset message
…m_devices_config_test.dart Co-authored-by: Jonah Williams <[email protected]>
Co-authored-by: Jonah Williams <[email protected]>
…nfig.dart Co-authored-by: Jonah Williams <[email protected]>
…nfig.dart Co-authored-by: Jonah Williams <[email protected]>
…onfig.dart Co-authored-by: Jonah Williams <[email protected]>
Co-authored-by: Jonah Williams <[email protected]>
- make config backup function synchronous
576c39d to
ec88744
Compare
|
@zanderso yep it's ready |
|
@ardera I would love to see an article in our Wiki (to start) with a tutorial on how to use this. |
sure, good idea! |
flutter custom-devices listlists the configured custom devicesflutter custom-devices resetflutter custom-devices add--jsonparametersshdevice, i.e. it won't ask for the values of every custom device config option, but rather for things like the ssh username & hostname and generally provide some good defaults for ssh devicesflutter custom-devices deleteCustomDeviceConfig, aJsonRevivalExceptionwill be thrown with an error message describing the error (likeExpected 'pingSuccessRegex' to be null or string-ified regex.)CustomDevicesConfig.devicesso the outputted error message may look like this:Could not load custom device from config index 0: Expected 'pingSuccessRegex' to be null or string-ified regex.fixes #79406
Pre-launch Checklist
///).