Skip to content

[flutter_tools] refactor local engine locator to its own class - #67274

Merged
jonahwilliams merged 1 commit into
flutter:masterfrom
jonahwilliams:local_engine
Oct 5, 2020
Merged

jonahwilliams merged 1 commit into
flutter:masterfrom
jonahwilliams:local_engine

Conversation

@jonahwilliams

@jonahwilliams jonahwilliams commented Oct 4, 2020 •

Copy link
Copy Markdown
Contributor

Description

Make the logic for locating a local engine path part of its own class, add documentation, and update tests to cover engine source path locating too.

#47161

@flutter-dashboard flutter-dashboard Bot added tool Affects the "flutter" command-line tool. See also t: labels. work in progress; do not review labels Oct 4, 2020
@jonahwilliams
jonahwilliams marked this pull request as ready for review October 5, 2020 15:30
@jonahwilliams
jonahwilliams requested a review from tvolkert October 5, 2020 17:40
@jonahwilliams

This comment has been minimized.

@jonahwilliams
jonahwilliams removed the request for review from tvolkert October 5, 2020 19:54
@jonahwilliams jonahwilliams changed the title [flutter_tools] refactor engine locator to its own class [flutter_tools] refactor local engine locator to its own class Oct 5, 2020
// file://flutter-engine-local-path/src/out/host_debug_unopt/gen/dart-pkg/sky_engine/lib/
if (engineUri?.path != null) {
engineSourcePath = _fileSystem.directory(engineUri.path)
?.parent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I would have expected the question mark to come at the end of the last line rather than the beginning of this one, but if this style is consistent with other uses it should be fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

?. is one operator though, splitting them up seems odd - or do you mean leaving both on a previous line?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm. Dartfmt does indeed move the ? part to the next line as well. Maybe I'm just starting to think in terms of null-safety world, with ? as one operator and . as another, but this is fine.

xcode: globals.xcode,
platform: globals.platform,
),
LocalEngineLocator: () => LocalEngineLocator(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought we were trying to avoid adding new globals to the context and instead providing ctor initialization. Is that not possible for some reason in this case, or are we not trying to do that anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The initialization of the flutter commands still needs some work, but eventually yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

err "eventually yes"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we just introduce this into the ctors of the necessary commands in this patch rather than introducing more work to refactor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I considered that but it is not feasible until #67275 and others have been completed and initialization of the tool is moved out of the flutter command

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok. LGTM

@jonahwilliams

Copy link
Copy Markdown
Contributor Author

Thanks Dan!

@jonahwilliams
jonahwilliams merged commit 7f2ca5e into flutter:master Oct 5, 2020
@jonahwilliams
jonahwilliams deleted the local_engine branch October 5, 2020 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants