-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Parse engine src path from an absolute --local-engine #78496
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
Conversation
| return null; | ||
| } | ||
|
|
||
| Future<String> _findEngineSourceBySkyEngine(String packagePath) async { |
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 method was extracted from findEnginePath to make that method more readable, but has not been changed.
| return null; | ||
| } | ||
|
|
||
| String _findEngineSourceByLocalEngine(String localEngine) { |
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 method is new.
| _logger.printTrace('Could not find engine source for $localEngine, skipping'); | ||
| } | ||
| if (localEngine != null) { | ||
| throwToolExit( |
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.
Now throw instead of silently fail if --local-engine is set but the engineSourcePath can't be found.
yjbanov
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.
| final Directory localEngineDirectory = _fileSystem.directory(localEngine); | ||
| final Directory outDirectory = localEngineDirectory?.parent; | ||
| final Directory srcDirectory = outDirectory?.parent; | ||
| if (localEngineDirectory.existsSync() && outDirectory.basename == 'out' && srcDirectory.basename == 'src') { |
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.
On line 98 localEngineDirectory is guarded against null, which means on this line it may still be null. Should we guard against null here? Or remove the guard above?
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.
Same for outDirectory.
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.
Good catch. nnbd soon!
| return null; | ||
| } | ||
|
|
||
| Future<String> _findEngineSourceBySkyEngine(String packagePath) async { |
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: would _findEngineSourceByDotPackagesFile be a better name?
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.
How about _findEngineSourceByPackageConfig?
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.
SGTM
|
Google testing failure unrelated. |

This PR parses the
srcdirectory from--local-engineif it is an absolute path when--local-engine-src-pathis not specified. This will support LUCI recipes with local engine builds that are not a sibling to the flutter root (like--local-engine=/b/s/w/ir/cache/builder/src/out/host_debug_unopt).The tool will then continue with the previous resolution steps: parse the
srcdirectory from.packagessky_enginepath, then checks if theengineis a sibling directory to thefluttercheckout.It also exits the tool with a failure if
--local-engineis set but thesrcdirectory cannot be found, instead of silently failing and using thebin/cacheengine.Fixes #78072