-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add pre-stable support for create on Windows #51895
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
Add pre-stable support for create on Windows #51895
Conversation
|
I still need to do the manual tests on this one, but it should be good to review as-is. |
|
|
||
| # Since there are multiple workflows, uncomment next line to ignore bower_components | ||
| # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) | ||
| #bower_components/ |
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.
blast from the past
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 am torn on whether we should use this giant stock ignore file, or instead do just what we actually need (which is probably not much, but I may get wrong initially and have to adjust). Thoughts?
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.
For the most part, we've followed the later policy. This works great until we need to add something, and users end up without. For a pre-stable template I think it won't matter as much. It is harder to explain "why is X here" when pointing at the catch-all
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.
Though, maybe someone writes an app and just happens to call a folder bower_components 🤷♂
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'll redo this when I'm at my Windows machine, doing just what shows up for me in an edit+build cycle.
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 slimmed it way down. I left a few of the very basic user-file patterns in case they are triggered by things I just didn't do.
I suspect we'll find a few things over time that I should have left in but didn't, but we can always re-add things as we find them.
|
The non UTF files need an exception added in dev/bots/test.dart . This is mostly to prevent us from accidentally adding large binaries or images, should be okay for templates |
Added an exception for the .ico. It looks like the rc file can be UTF-8 in VS 2019, so I've pushed a version with that. I need to double-check when I'm at my Windows machine though since it sounds like the exact behavior changed during the development of VS 2019 so I'm not 100% sure it will preserve UTF-8 on edit+save, and if it doesn't I'll switch it back to UTF-16. |
Tested adding a resource via VS 2019 and it still saved out in UTF-8, so it looks like that's fine to change! |
Turns out I was looking at the wrong check. @Hixie, the code I would actually need to change to allow adding the icon for this new template has multiple comments saying not to change it, but don't point to any suggestions about what to do instead and only say to talk to you.
|
jonahwilliams
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
|
@jonahwilliams PTAL; this now includes the new code to use flutter_template_images. Requires flutter/packages#118 to land and be published before it'll work, but it can be reviewed in parallel. Unit test coverage of |
|
flutter_template_images has been published; this now works end to end. |
|
Can you do me a favour and add a comment to the place that verifies that there's no binaries saying that if anyone wants to add or change images in the templates, they should do it via your package and pointing to the logic for how to do it? Thanks for setting this logic up, this is great. I'm glad we have a real solution for avoiding images in the templates now. |
Done. I meant to do that once I had something working, thanks for the reminder. |
|
For reasons I don't understand adding a new dependency made me run |
75120eb to
e0ea3a9
Compare
| // Returns the directory containing the 'name' template directory in | ||
| // flutter_template_images, to resolve image placeholder against. | ||
| Directory templateImageDirectory(String name, FileSystem fileSystem) { | ||
| final String packageFilePath = fileSystem.path.join( |
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 might be cases where this .packages file doesn't exist. I think the zip uploaded SDKs do not include the packages since they would contains paths of the zipping machine they would be incorrect for clients.
Less commonly, the other way this could go wrong is that the user could update or delete their pub cache. Since the tool is snapshotted, it is still able to start even if the .packages is pointing to junk.
First you need to check for the existence of the .packages and the imagePackageLibDir. If either is missing you'll need to run a pub get in the flutter_tools directory. It might be easier to hoist this work out of template creation into a separate service class and drill that down instead
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, thanks for flagging that as I'd never have hit it in my testing.
I haven't done a full sweep of tests locally so I may need to adjust the environment in some other tests the way I've done in project_tests.
jonahwilliams
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.
This should handle missing .packages/cache as noted in my comment above, otherwise looks good!
jonahwilliams
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
Recreates testbed/windows/ from the new template added in flutter/flutter#51895 Diffs that don't ignore whitespace show most files have changed completely due to differences in how the two repos handle line endings on checkout; actual diffs are very small.
Recreates testbed/windows/ from the new template added in flutter/flutter#51895 Diffs that don't ignore whitespace show most files have changed completely due to differences in how the two repos handle line endings on checkout; actual diffs are very small.
This is normal. When you add a dependency, we have to recalculate the full dependency chart so that we can make sure all the packages in the repo use the same versions of each package. |
|
(ideally we'd have a bot that does this daily so it would never be a lot of changes at once) |
Description
Adds initial support for
flutter createof apps and plugins. This is derived from the current FDE example app and sample plugin, adding template values where relevant.Since the APIs/tooling/template aren't stable yet, the app template includes a version marker, which will be updated each time there's a breaking change. The build now checks that the template version matches the version known by that version of the tool, and gives a specific error message when there's a mismatch, which improves over the current breaking change experience of hitting whatever build failure the breaking change causes and having to figure out that the problem is that the runner is out of date. It also adds a warning to the
createoutput about the fact that it won't be stable.Plugins don't currently have a version marker since in practice this is not a significant problem for plugins yet the way it is for runners; we can add it later if that changes.
Related Issues
#30704
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.