Skip to content

[flutter_tools] share bootstrap module between run and test#70903

Merged
jonahwilliams merged 2 commits intoflutter:masterfrom
jonahwilliams:source_maps_web
Nov 20, 2020
Merged

[flutter_tools] share bootstrap module between run and test#70903
jonahwilliams merged 2 commits intoflutter:masterfrom
jonahwilliams:source_maps_web

Conversation

@jonahwilliams
Copy link
Contributor

Description

Flutter run and test can share the generated bootstrap module. Also wire up null-assertions for flutter test and move all of the fields together.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 20, 2020
@google-cla google-cla bot added the cla: yes label Nov 20, 2020
''';
}

String generatedActualMain(String bootstrapUrl, String mainUri) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is deleted and shared with run.

CancelableOperation<dynamic> displayPause() => _manager._displayPause();
}

String bootstrapFileContents(String mainUri, String requireUrl, String mapperUrl) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was moved to web/bootstrap.dart

final String leadingPath = request.url.path.split('.browser_test.dart.js')[0];
final String generatedFile = _fileSystem.path.split(leadingPath).join('_') + '.bootstrap.js';
return shelf.Response.ok(bootstrapFileContents('/' + generatedFile, 'require.js', 'dart_stack_trace_mapper.js'), headers: <String, String>{
return shelf.Response.ok(generateTestBootstrapFileContents('/' + generatedFile, 'require.js', 'dart_stack_trace_mapper.js'), headers: <String, String>{
Copy link
Member

Choose a reason for hiding this comment

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

Flutter run and test can share the generated bootstrap module.

This looks like it's doing the same thing in the same spot. Will there be a follow up PR where you use the bootstrap code in a second place? Or am I missing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

generatedActualMain was deleted and replaced with the existing logic in web/bootstrap.dart. bootstrapFileContents was renamed to generateTestBootstrapFileContents and moved to bootstrap.dart but is otherwise unchanged

Copy link
Member

Choose a reason for hiding this comment

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

Ah I missed that generateMainModule wasn't new.

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants