Repository navigation
Add --package option to create command. - #11105
Conversation
devoncarew
left a comment
There was a problem hiding this comment.
I added some drive my comments about the cli ux -
There was a problem hiding this comment.
We should have a bit more verbose description here, to help the user choose between a regular project, and plugin project, and a package project.
There was a problem hiding this comment.
We can use the following help strings:
Package: "Generate a shareable Flutter project containing modular Dart code."
Plugin: "Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation for Android, for iOS code, or for both."
There was a problem hiding this comment.
I think we should switch to using an option to select project types; something like --template=<type>, where type is one of application, package, or plugin. That feels a bit cleaner to me than having several different, mutually exclusive, cli flags.
There was a problem hiding this comment.
I think that is a good idea, but it would be a breaking change impacting docs, code labs, etc. so we should handle that as a separate change later.
There was a problem hiding this comment.
We can do it in this patch and just provide a legacy --plugin option to not break people in the meantime.
The thing to avoid is adding something we know we're going to change.
There was a problem hiding this comment.
I'd prefer flutter create package over flutter create --template=package, if we can make this work with the argument parser (ideally defaulting to 'application' if a sub-command to create isn't specified).
I personally think having the shorter flags is cleaner and easier to use than the longer --template=.... Note that we have mutually exclusive flags elsewhere, too -- the build mode flags, for example.
There was a problem hiding this comment.
The first rest argument is currently used for the output location: flutter create <output directory>, so I think it'd be problematic to use it for the project type as well.
I personally think having the shorter flags is cleaner and easier to use than the longer --template=...
Gotcha. The length may not be critical here, since flutter create a less common command (compared to something like flutter run). I think I still prefer the option flag (--template=foo) - I do think it makes it more clear that you're selecting between a few different project templates.
There was a problem hiding this comment.
My main concern with having multiple flags is that then we have to handle the cases of them being specified together (--plugin --package), which gets confusing to explain (you can use these together, but not these, etc), especially since we have other flags that do work in combination.
--debug, --profile, and --release are an unfortunate set of values that we've grandfathered in because that's what people expect coming from other build systems, but I don't think that's a problem here.
There was a problem hiding this comment.
Don't think we need these plugin details (lines 8-10)?
There was a problem hiding this comment.
we definitely don't want to be including any default licenses with any of the flutter create output
There was a problem hiding this comment.
In that case we should also fix https://github.com/flutter/flutter/tree/master/packages/flutter_tools/templates/plugin
There was a problem hiding this comment.
Yeah. Can you do that in this PR also?
We should probably just have placeholder LICENSE files so that people see that they should fill it in. e.g. just a TODO.
|
@jakobr-google Are you still working on this PR? |
|
Yep, I'll pick it up again. Was struck by vacation. |
101b685 to
d2ce268
Compare
|
LGTM |
|
But the test is failing: |
|
@jakobr-google is this ready to go in? |
Creates a Flutter package, which is a package that depends on Flutter, but does not contain native code. Fixes flutter#10377.
Creates a Flutter package, which is a package that depends on Flutter, but does not contain native code.
Fixes #10377.