Skip to content

Conversation

@jmagman
Copy link
Member

@jmagman jmagman commented Mar 18, 2021

This PR parses the src directory from --local-engine if it is an absolute path when --local-engine-src-path is 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 src directory from .packages sky_engine path, then checks if the engine is a sibling directory to the flutter checkout.

It also exits the tool with a failure if --local-engine is set but the src directory cannot be found, instead of silently failing and using the bin/cache engine.

Fixes #78072

@jmagman jmagman added c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. labels Mar 18, 2021
@jmagman jmagman self-assigned this Mar 18, 2021
@google-cla google-cla bot added the cla: yes label Mar 18, 2021
return null;
}

Future<String> _findEngineSourceBySkyEngine(String packagePath) async {
Copy link
Member Author

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) {
Copy link
Member Author

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(
Copy link
Member Author

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.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Just a couple of nitpicks. LGTM.

lgtm

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') {
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for outDirectory.

Copy link
Member Author

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 {
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about _findEngineSourceByPackageConfig?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@jmagman
Copy link
Member Author

jmagman commented Mar 18, 2021

Google testing failure unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web] engine LUCI does not fail tests that should fail

2 participants