Skip to content

[flutter_tools] Update WebAssetServer to avoid context, fix tests - #60224

Merged
jonahwilliams merged 6 commits into
flutter:masterfrom
jonahwilliams:more_test_fixes
Jun 24, 2020
Merged

jonahwilliams merged 6 commits into
flutter:masterfrom
jonahwilliams:more_test_fixes

Conversation

@jonahwilliams

Copy link
Copy Markdown
Contributor

Description

WebAssetServer could fail if some of the global statics it depended on were initialized in a different order. Fix this by removing globals.

Delete dwds startup test that needs to spawn a real server.

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 24, 2020
ReleaseAssetServer(this.entrypoint);
ReleaseAssetServer(this.entrypoint, {
@required FileSystem fileSystem,
@required String webBuilDirectory,

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.

Suggested change
@required String webBuilDirectory,
@required String webBuildDirectory,

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.

D'oh

fileSystem: globals.fs,
platform: globals.platform,
flutterRoot: Cache.flutterRoot,
webBuilDirectory: getWebBuildDirectory(),

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.

Suggested change
webBuilDirectory: getWebBuildDirectory(),
webBuildDirectory: getWebBuildDirectory(),

}) : _fileSystem = fileSystem,
_platform = platform,
_flutterRoot = flutterRoot,
_webBuilDirectory = webBuilDirectory,

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.

Suggested change
_webBuilDirectory = webBuilDirectory,
_webBuildDirectory = webBuildDirectory,


final Uri entrypoint;
final String _flutterRoot;
final String _webBuilDirectory;

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.

Suggested change
final String _webBuilDirectory;
final String _webBuildDirectory;

globals.fs.currentDirectory.uri,
globals.fs.directory(globals.fsUtils.homeDirPath).uri,
List<Uri> _searchPaths() => <Uri>[
_fileSystem.directory(_webBuilDirectory).uri,

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.

Suggested change
_fileSystem.directory(_webBuilDirectory).uri,
_fileSystem.directory(_webBuildDirectory).uri,

}
if (request.url.path == '') {
final File file = globals.fs.file(globals.fs.path.join(getWebBuildDirectory(), 'index.html'));
final File file = _fileSystem.file(_fileSystem.path.join(_webBuilDirectory, 'index.html'));

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.

Suggested change
final File file = _fileSystem.file(_fileSystem.path.join(_webBuilDirectory, 'index.html'));
final File file = _fileSystem.file(_fileSystem.path.join(_webBuildDirectory, 'index.html'));

}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
Platform: () => platform,
ProcessManager: () => FakeProcessManager.any(),

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.

was the process manager never getting called?

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 guess not, since these are now testWithoutContext. cool.

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.

Negatory, but we have a rule that a context injected FIleSystem requires a context Injected ProcessManager

@christopherfujino christopherfujino left a comment

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.

LGTM once the analyzer verifies all the spelling changes are consistent.

@jonahwilliams

Copy link
Copy Markdown
Contributor Author

Almost! Sorry I didn't accept the suggestions, that seems to trip up the CLA bot

@christopherfujino

Copy link
Copy Markdown
Contributor

Almost! Sorry I didn't accept the suggestions, that seems to trip up the CLA bot

Not offended at all. It's probably easier to do locally anyway.

@flutter-github-sync

Copy link
Copy Markdown

Started Google testing for this PR

@flutter-github-sync

Copy link
Copy Markdown

Google testing passed!

@jonahwilliams
jonahwilliams merged commit 2a7ee93 into flutter:master Jun 24, 2020
@jonahwilliams
jonahwilliams deleted the more_test_fixes branch June 24, 2020 23:19
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
…utter#60224)

WebAssetServer could fail if some of the global statics it depended on were initialized in a different order. Fix this by removing globals.

Delete dwds startup test that needs to spawn a real server.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

5 participants