-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Fix flutter attach local engine #131825
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
Merged
auto-submit
merged 8 commits into
flutter:master
from
chris-forks:fix-flutter-attach-local-engine
Aug 10, 2023
Merged
Fix flutter attach local engine #131825
auto-submit
merged 8 commits into
flutter:master
from
chris-forks:fix-flutter-attach-local-engine
Aug 10, 2023
Conversation
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 reverts commit 41afccd1bedcc474374be291b7b99d15f43cd1a4.
f09aee4 to
f406070
Compare
Comment on lines
+265
to
+267
| expect(artifacts, isA<CachedLocalEngineArtifacts>()); | ||
| // expecting this to be true ensures this test ran | ||
| passedArtifactTest = true; |
Contributor
Author
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.
FYI: this is what we are actually testing
eliasyishak
approved these changes
Aug 9, 2023
Contributor
eliasyishak
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.
LGTM
Contributor
Author
|
FYI @moffatman |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 10, 2023
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 10, 2023
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
autosubmit
Merge PR when tree becomes green via auto submit App
tool
Affects the "flutter" command-line tool. See also t: labels.
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.
Fixes: #124970
Part of #47161
Before this change, there were two places we overrode the
Artifactsin a Zone:flutter/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
Line 281 in 1cf3907
flutter/packages/flutter_tools/lib/src/commands/attach.dart
Line 274 in 1cf3907
Note 1 above creates a new instance of
Artifacts.getLocalEngine(). In this flow, there exist two instances ofArtifacts:CachedArtifacts(which gets all artifacts from flutter/bin/cache), instantiated in context_runner.dart:flutter/packages/flutter_tools/lib/src/context_runner.dart
Line 137 in 1cf3907
CachedLocalEngineArtifactscreated in the command runner once the CLI options have been parsed:flutter/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
Line 281 in 1cf3907
The regression happened when we direct injected the Artifacts 1 from above BEFORE we parsed the local-engine flag, and then used this in the second zone override, and then when creating the
FlutterDevicethere are multiple calls toglobals.artifactsreturned it when it should have returned Artifacts 2:flutter/packages/flutter_tools/lib/src/resident_runner.dart
Line 80 in 1cf3907
Device.artifactOverrides was originally introduced in #32071, but is no longer used, so I deleted it.
I also removed direct injection of
Artifactsto the attach sub-command, because that class now no longer references artifacts.I believe the ideal true fix for this would be to:
globals.artifactsto use direct injection (in this case, the offending invocations were inFlutterDevice.create(), but I'm not sure that something else would not have broken later)Artifacts--that is, if the user desires local engine artifacts, that we are passing an instance ofCachedLocalEngineArtifacts.a. Alternatively, and probably simpler, teach
CachedArtifactsto know about the local engine. This would mean parsing the global CLI options BEFORE we ever construct any instance ofArtifacts.As an overall recommendation for implementing #47161, in the overall tree of tool function calls, we should probably migrate the leaves first (that is, migrate the sub-commands last). We should also audit and reconsider any usage of
runZoned()orcontext.run()for the purpose overriding zoneValues.