-
Notifications
You must be signed in to change notification settings - Fork 29.7k
feature/clean-a-specific-scheme: Add this-scheme new flag for clean c… #116733
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
feature/clean-a-specific-scheme: Add this-scheme new flag for clean c… #116733
Conversation
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.
(Will remove)
Actually displaying null...
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 don't see null when I run this locally. Are you ensuring the cached tool snapshot is up to date? See https://github.com/flutter/flutter/wiki/The-flutter-tool#making-changes-to-the-flutter-tool for more context.
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.
will check that.
Currently i run my unit test with this command :
$> dart bin/flutter_tools.dart test test/commands.shard/hermetic/clean_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.
will check that.
Currently i run my unit test with this command :
$> dart bin/flutter_tools.dart test test/commands.shard/hermetic/clean_test.dart
Well if it's showing null in unit tests, that's different :) That means your test is set up wrong.
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.
will check that.
Currently i run my unit test with this command :$> dart bin/flutter_tools.dart test test/commands.shard/hermetic/clean_test.dartWell if it's showing null in unit tests, that's different :) That means your test is set up wrong.
Need help on that, didn't know what is wrong inside the test... Just trying to use my flag inside test...
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 pushed a new version with a working test. Maybe not the best test ever, do not hesitate to tell me what changes need I do.
68ea985 to
77724ac
Compare
|
Thanks for the PR! I checked out this branch and tried to use the new option, and I got some interesting results: As you see, the command appeared to run without issue despite 1) receiving a name for a non-existent scheme and 2) not being given a scheme at all. This isn't intended, right? I verified that On an unrelated note: for the CLI argument name, I would consider using |
77724ac to
ac500c4
Compare
I will rework error management. Btw, command was "--this-scheme" not "this-scheme". |
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.
Exceptions here were hidden. If xcode didn't find scheme or throw something it's important to abort no ? I've edited that.
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.
@christopherfujino Do you have any opinions on this? In particular, is it appropriate to throw a ToolExit in the case of input error (i.e. no scheme given)?
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.
@christopherfujino Do you have any opinions on this? In particular, is it appropriate to throw a ToolExit in the case of input error (i.e. no scheme given)?
I'm not sure I understand the question. Are you asking if we should printError and exit 0 when the user provides a non-existent scheme? If so, then I think tool exiting is the right course of action (ToolExit generally means that we cannot continue because of some invalid state, usually based on user inputs).
If I'm misunderstanding the question, please clarify.
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.
Three new ToolExit throws are added here:
and
(side note: the first two shown in the first code snippet will get caught by the catch in the second code snippet, in which case a different ToolExit is thrown)
However, in other cases throughout the tool, debug.printError is used without throwing a ToolExit. Example:
flutter/packages/flutter_tools/lib/src/commands/clean.dart
Lines 101 to 104 in 378387b
| } on FileSystemException catch (err) { | |
| globals.printError('Cannot clean ${file.path}.\n$err'); | |
| return; | |
| } |
Going back to the three newly added ToolExit throws, is it appropriate to throw here instead of just printing an error message? Asked more specifically:
- Is it appropriate to throw if a user provides an invalid Xcode scheme name (or doesn't provide one at all despite using
--scheme), or should we print an error message and continue with cleaning? - Is it appropriate to throw if something goes wrong with cleaning a workspace, or should we print an error message and continue with cleaning?
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.
Three new
ToolExitthrows are added here:and
(side note: the first two shown in the first code snippet will get caught by the
catchin the second code snippet, in which case a differentToolExitis thrown)However, in other cases throughout the tool,
debug.printErroris used without throwing aToolExit. Example:flutter/packages/flutter_tools/lib/src/commands/clean.dart
Lines 101 to 104 in 378387b
} on FileSystemException catch (err) { globals.printError('Cannot clean ${file.path}.\n$err'); return; } Going back to the three newly added
ToolExitthrows, is it appropriate to throw here instead of just printing an error message? Asked more specifically:
- Is it appropriate to throw if a user provides an invalid Xcode scheme name (or doesn't provide one at all despite using
--scheme), or should we print an error message and continue with cleaning?
This to me seems like a clear user error, and thus should be a tool exit.
- Is it appropriate to throw if something goes wrong with cleaning a workspace, or should we print an error message and continue with cleaning?
It makes sense to me printError and continue cleaning, but I don't have a strong opinion either way.
|
@andrewkolos can you take another look at this one? |
|
@andrewkolos friendly ping |
|
Hello--sorry I lost track of this PR, I confused it with another one that was merged. I'll be looking at this again shortly |
packages/flutter_tools/test/commands.shard/hermetic/clean_test.dart
Outdated
Show resolved
Hide resolved
|
Is this ready for review again? |
Yes |
|
@EArminjon Google testing seems to be stuck for this PR. Would you mind merging upstream/master into this branch? This might fix it. |
|
oops bad push, will fix |
ca77e23 to
a4a9b68
Compare
|
Seems to be good now. |
|
The ci.yaml validation check is failing for some reason. Per the message, could you try another |
27f7eac to
b49b561
Compare
b49b561 to
e6ec087
Compare
|
(didn't know why I always fail my rebase. I update my repo on github to sync it with the original flutter repo. Then i go to my branch : git fetch --all && git pull --rebase origin master && git push origin my_branch_name -f. I got the all commit history pushed... Git is still a subject for me despite all these years...) Must be good this time :'( ! |
andrewkolos
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
This PR intent to add the possibility for developer which have a heavy project, to run flutter clean with a specific scheme. This to avoid running xcode clean to all schemes.
List which issues are fixed by this PR. You must list at least one issue.
#116735
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Done