-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[flutter_plugin_tool] Refactor createFakePlugin #4064
[flutter_plugin_tool] Refactor createFakePlugin #4064
Conversation
A lot of these changes are pretty mechanical. |
isIosPlugin: true); | ||
final Directory pluginDirectory = | ||
createFakePlugin('plugin', packagesDir, extraFiles: <List<String>>[ | ||
<String>['example', 'test_driver', 'integration_test.dart'], |
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: it would be a bit more concise if this was just a list of strings that are paths, then we replaced the '/' with platform specific characters. No need to address it here, just calling it out.
<String>[
'example/test_driver/integration_test.dart',
'example/integration_test/bar_test.dart',
...
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 think that may actually already work by accident, but I'll look at formalizing it. I agree the current system is needlessly messy.
'''; | ||
if (isFlutter) { | ||
if (isPlugin) { | ||
yaml += ''' |
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: Instead of manipulating strings, we could create the datastructure then use a yaml library to generate the yaml. That would make this a bit more maintainable.
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.
Yes, I've thought about that as well. Initial investigation turned up mostly libraries that can read YAML, unfortunately, rather than write it, but I'd like to look into it more at some point.
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, it was a lot to look at. I just had a few nits.
createFakePlugin is used extensively in tests, but has become more and more complex over time. This substantially refactors it and related test utilities:
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).