Unverified Commit f98df595 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Restructure resident web runner usage to avoid SDK users that don't support dwds (#37815)

parent 41cc80c5
......@@ -10,6 +10,7 @@ import 'src/base/context.dart';
// avoid introducing the dependency into google3. Not all build* packages
// are synced internally.
import 'src/build_runner/build_runner.dart';
import 'src/build_runner/resident_web_runner.dart';
import 'src/build_runner/web_compilation_delegate.dart';
import 'src/codegen.dart';
......@@ -46,6 +47,7 @@ import 'src/commands/upgrade.dart';
import 'src/commands/version.dart';
import 'src/runner/flutter_command.dart';
import 'src/web/compile.dart';
import 'src/web/web_runner.dart';
/// Main entry point for commands.
///
......@@ -100,5 +102,8 @@ Future<void> main(List<String> args) async {
// the build runner packages are not synced internally.
CodeGenerator: () => const BuildRunner(),
WebCompilationProxy: () => BuildRunnerWebCompilationProxy(),
// The web runner is not supported internally because it depends
// on dwds.
WebRunnerFactory: () => DwdsWebRunnerFactory(),
});
}
......@@ -8,19 +8,40 @@ import 'package:dwds/dwds.dart';
import 'package:meta/meta.dart';
import 'package:vm_service_lib/vm_service_lib.dart' as vmservice;
import 'application_package.dart';
import 'base/common.dart';
import 'base/file_system.dart';
import 'base/logger.dart';
import 'base/terminal.dart';
import 'base/utils.dart';
import 'build_info.dart';
import 'convert.dart';
import 'device.dart';
import 'globals.dart';
import 'project.dart';
import 'resident_runner.dart';
import 'web/web_fs.dart';
import '../application_package.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/terminal.dart';
import '../base/utils.dart';
import '../build_info.dart';
import '../convert.dart';
import '../device.dart';
import '../globals.dart';
import '../project.dart';
import '../resident_runner.dart';
import '../web/web_runner.dart';
import 'web_fs.dart';
/// Injectable factory to create a [ResidentWebRunner].
class DwdsWebRunnerFactory extends WebRunnerFactory {
@override
ResidentRunner createWebRunner(
Device device, {
String target,
@required FlutterProject flutterProject,
@required bool ipv6,
@required DebuggingOptions debuggingOptions
}) {
return ResidentWebRunner(
device,
target: target,
flutterProject: flutterProject,
debuggingOptions: debuggingOptions,
ipv6: ipv6,
);
}
}
// TODO(jonahwilliams): remove this constant when the error message is removed.
// The web engine is currently spamming this message on certain pages. Filter it out
......
......@@ -30,7 +30,7 @@ import '../bundle.dart';
import '../cache.dart';
import '../globals.dart';
import '../project.dart';
import 'chrome.dart';
import '../web/chrome.dart';
/// The name of the built web project.
const String kBuildTargetName = 'web';
......
......@@ -21,10 +21,10 @@ import '../emulator.dart';
import '../globals.dart';
import '../project.dart';
import '../resident_runner.dart';
import '../resident_web_runner.dart';
import '../run_cold.dart';
import '../run_hot.dart';
import '../runner/flutter_command.dart';
import '../web/web_runner.dart';
const String protocolVersion = '0.5.3';
......@@ -414,12 +414,12 @@ class AppDomain extends Domain {
ResidentRunner runner;
if (await device.targetPlatform == TargetPlatform.web_javascript) {
runner = ResidentWebRunner(
flutterDevice.device,
debuggingOptions: options,
runner = webRunnerFactory.createWebRunner(
device,
flutterProject: flutterProject,
ipv6: ipv6,
target: target,
debuggingOptions: options,
ipv6: ipv6,
);
} else if (enableHotReload) {
runner = HotRunner(
......
......@@ -19,13 +19,12 @@ import '../macos/xcode.dart';
import '../project.dart';
import '../reporting/reporting.dart';
import '../resident_runner.dart';
import '../resident_web_runner.dart';
import '../run_cold.dart';
import '../run_hot.dart';
import '../runner/flutter_command.dart';
import '../tracing.dart';
import '../version.dart';
import '../web/web_runner.dart';
import 'daemon.dart';
abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
......@@ -430,7 +429,7 @@ class RunCommand extends RunCommandBase {
ipv6: ipv6,
);
} else if (webMode) {
runner = ResidentWebRunner(
runner = webRunnerFactory.createWebRunner(
devices.single,
target: targetFile,
flutterProject: flutterProject,
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:meta/meta.dart';
import '../base/context.dart';
import '../device.dart';
import '../project.dart';
import '../resident_runner.dart';
WebRunnerFactory get webRunnerFactory => context.get<WebRunnerFactory>();
// Hack to hide web imports for google3.
abstract class WebRunnerFactory {
const WebRunnerFactory();
/// Create a [ResidentRunner] for the web.
ResidentRunner createWebRunner(
Device device, {
String target,
@required FlutterProject flutterProject,
@required bool ipv6,
@required DebuggingOptions debuggingOptions
});
}
......@@ -12,7 +12,7 @@ import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/resident_web_runner.dart';
import 'package:flutter_tools/src/build_runner/resident_web_runner.dart';
import 'package:flutter_tools/src/version.dart';
import 'package:flutter_tools/src/web/compile.dart';
import 'package:mockito/mockito.dart';
......
......@@ -11,8 +11,8 @@ import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/resident_web_runner.dart';
import 'package:flutter_tools/src/web/web_fs.dart';
import 'package:flutter_tools/src/build_runner/resident_web_runner.dart';
import 'package:flutter_tools/src/build_runner/web_fs.dart';
import 'package:meta/meta.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service_lib/vm_service_lib.dart';
......
......@@ -13,8 +13,8 @@ import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/globals.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/resident_web_runner.dart';
import 'package:flutter_tools/src/web/web_fs.dart';
import 'package:flutter_tools/src/build_runner/resident_web_runner.dart';
import 'package:flutter_tools/src/build_runner/web_fs.dart';
import 'package:meta/meta.dart';
import 'package:mockito/mockito.dart';
import 'package:vm_service_lib/vm_service_lib.dart';
......
......@@ -10,7 +10,7 @@ import 'package:flutter_tools/src/base/os.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/web/chrome.dart';
import 'package:flutter_tools/src/web/web_fs.dart';
import 'package:flutter_tools/src/build_runner/web_fs.dart';
import 'package:http_multi_server/http_multi_server.dart';
import 'package:meta/meta.dart';
import 'package:mockito/mockito.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment