This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[flutter_plugin_tool] Move branch-switching logic from tool_runner.sh to tool #4268
Merged
stuartmorgan-g
merged 10 commits into
flutter:master
from
stuartmorgan-g:tool-runner-replacement
Aug 31, 2021
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
da8e15b
WIP
stuartmorgan-g 7c74f7d
Move branch behavioral switch from tool_runner.sh to a new tool flag
stuartmorgan-g 31ba457
Simplify tool_runner.sh
stuartmorgan-g 243ba40
Remove all but one use of tool_runner.sh
stuartmorgan-g 38fe65b
Rename variable
stuartmorgan-g 5b177bf
Bump version
stuartmorgan-g bcd1561
Add a comment about splitting
stuartmorgan-g 984f1d8
Revert "Rename variable"
stuartmorgan-g 56d86fd
Revert "Remove all but one use of tool_runner.sh"
stuartmorgan-g fc4fd9e
typo fix
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 fyi: This would be more efficient as a
Stream<String>
instead ofFuture<List<String>>
.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.
Sure, I can change it in a follow-up. Neither the API nor the way it's being used are new in this PR, I'm just rearranging the flow a bit.
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.
Actually, having looked at the details I'm not clear how it would be more efficient.
getChangedFiles
is taking the full stdout fromgit
(the process API for the tools aren't stream-based) and splitting it by lines, giving a list. So returning aStream
instead of aList
doesn't change anything there.At this call site I need this list in two places:
_changesRequireFullTest
and_getChangedPackages
. I can't consume the stream twice, so I would need to.toList()
it here.So the difference would be that instead of taking a
List
and returning it to a caller that needs aList
, I would be taking aList
, converting it to aStream
, and giving the stream to the caller to immediately turn back to aList
. Am I missing a different way of structuring this?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.
Yea, if you are going to cache the result it doesn't make a difference, it's more of an academic change.
Returning a Stream is better because it allows people to process the output while it is being parsed. This is especially helpful when you are working on input from files/pipes. This also means the operation isn't memory bound and if a consumer decides to stop consuming mid-stream resources won't be wasted processing the output that happens after it stops.
It doesn't mean a lick of difference if you cache the results though so you can process it twice.
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.
The supply-side issue here is that the
git
package doesn't steamgit
output, it usesrun
and returns the full output as a String.