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
[script/tool] speed up the pub get portion of the analyze command #3982
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,47 @@ void main() { | |
])); | ||
}); | ||
|
||
test('skips flutter pub get for examples', () async { | ||
final Directory plugin1Dir = createFakePlugin('a', withSingleExample: true); | ||
|
||
final MockProcess mockProcess = MockProcess(); | ||
mockProcess.exitCodeCompleter.complete(0); | ||
processRunner.processToReturn = mockProcess; | ||
await runner.run(<String>['analyze']); | ||
|
||
expect( | ||
processRunner.recordedCalls, | ||
orderedEquals(<ProcessCall>[ | ||
ProcessCall( | ||
'flutter', const <String>['packages', 'get'], plugin1Dir.path), | ||
ProcessCall('dart', const <String>['analyze', '--fatal-infos'], | ||
plugin1Dir.path), | ||
])); | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also add a test of a package with a sub-package that's not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have one like that already - the |
||
test('don\'t elide a non-contained example package', () async { | ||
final Directory plugin1Dir = createFakePlugin('a'); | ||
final Directory plugin2Dir = createFakePlugin('example'); | ||
|
||
final MockProcess mockProcess = MockProcess(); | ||
mockProcess.exitCodeCompleter.complete(0); | ||
processRunner.processToReturn = mockProcess; | ||
await runner.run(<String>['analyze']); | ||
|
||
expect( | ||
processRunner.recordedCalls, | ||
orderedEquals(<ProcessCall>[ | ||
ProcessCall( | ||
'flutter', const <String>['packages', 'get'], plugin1Dir.path), | ||
ProcessCall( | ||
'flutter', const <String>['packages', 'get'], plugin2Dir.path), | ||
ProcessCall('dart', const <String>['analyze', '--fatal-infos'], | ||
plugin1Dir.path), | ||
ProcessCall('dart', const <String>['analyze', '--fatal-infos'], | ||
plugin2Dir.path), | ||
])); | ||
}); | ||
|
||
test('uses a separate analysis sdk', () async { | ||
final Directory pluginDir = createFakePlugin('a'); | ||
|
||
|
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.
I was hoping we could just use
getPlugins
instead of doing the filtering, but it looks like flutter/packages has some other nested constructions.Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah, I would prefer something more semantic here as well. The logic for how these are computed - getPlugins() and getPackages() - seems complicated, and I wasn't comfortable modifying it.
It looks like
plugins
actually returns packages? Andpackages
returns packages plus their example directories?I would have assumed that
getPlugins()
would return the directory containing the n dart packages that make up a plugin - likeurl_launcher/
,url_launcher_platform_interface/
,url_launcher_macos/
, ...I'll want a call like that - the top level plugin directory - for a follow up PR, where I'm going to try and speed up the analysis portion of the analyze call.
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 suspect what happened is that this was written for flutter/plugins, then expanded for use in flutter/packages without renaming. Fixing the fact that "plugins" is used to refer to packages in general in the tool (including the
--plugins
argument) is on my list.