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

[flutter_tools] move dwds imports to not require g3 visibility (#50823)

parent 08c83591
...@@ -29,8 +29,8 @@ import '../compile.dart'; ...@@ -29,8 +29,8 @@ import '../compile.dart';
import '../convert.dart'; import '../convert.dart';
import '../devfs.dart'; import '../devfs.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import 'bootstrap.dart'; import '../web/bootstrap.dart';
import 'chrome.dart'; import '../web/chrome.dart';
/// A web server which handles serving JavaScript and assets. /// A web server which handles serving JavaScript and assets.
/// ///
......
...@@ -31,9 +31,9 @@ import '../resident_runner.dart'; ...@@ -31,9 +31,9 @@ import '../resident_runner.dart';
import '../run_hot.dart'; import '../run_hot.dart';
import '../web/chrome.dart'; import '../web/chrome.dart';
import '../web/compile.dart'; import '../web/compile.dart';
import '../web/devfs_web.dart';
import '../web/web_device.dart'; import '../web/web_device.dart';
import '../web/web_runner.dart'; import '../web/web_runner.dart';
import 'devfs_web.dart';
/// Injectable factory to create a [ResidentWebRunner]. /// Injectable factory to create a [ResidentWebRunner].
class DwdsWebRunnerFactory extends WebRunnerFactory { class DwdsWebRunnerFactory extends WebRunnerFactory {
......
...@@ -158,11 +158,13 @@ void main() { ...@@ -158,11 +158,13 @@ void main() {
} }
}); });
test('no unauthorized imports of build_runner', () { test('no unauthorized imports of build_runner or dwds', () {
final List<String> whitelistedPaths = <String>[ final List<String> whitelistedPaths = <String>[
globals.fs.path.join(flutterTools, 'test', 'src', 'build_runner'), globals.fs.path.join(flutterTools, 'test', 'src', 'build_runner'),
globals.fs.path.join(flutterTools, 'lib', 'src', 'build_runner'), globals.fs.path.join(flutterTools, 'lib', 'src', 'build_runner'),
globals.fs.path.join(flutterTools, 'lib', 'executable.dart'), globals.fs.path.join(flutterTools, 'lib', 'executable.dart'),
globals.fs.path.join(flutterTools, 'lib', 'devfs_web.dart'),
globals.fs.path.join(flutterTools, 'lib', 'resident_web_runner.dart'),
]; ];
bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => !entity.path.contains(path)); bool _isNotWhitelisted(FileSystemEntity entity) => whitelistedPaths.every((String path) => !entity.path.contains(path));
...@@ -177,6 +179,7 @@ void main() { ...@@ -177,6 +179,7 @@ void main() {
if (line.startsWith(RegExp(r'import.*package:build_runner_core/build_runner_core.dart')) || if (line.startsWith(RegExp(r'import.*package:build_runner_core/build_runner_core.dart')) ||
line.startsWith(RegExp(r'import.*package:build_runner/build_runner.dart')) || line.startsWith(RegExp(r'import.*package:build_runner/build_runner.dart')) ||
line.startsWith(RegExp(r'import.*package:build_config/build_config.dart')) || line.startsWith(RegExp(r'import.*package:build_config/build_config.dart')) ||
line.startsWith(RegExp(r'import.*dwds:*.dart')) ||
line.startsWith(RegExp(r'import.*build_runner/.*.dart'))) { line.startsWith(RegExp(r'import.*build_runner/.*.dart'))) {
final String relativePath = globals.fs.path.relative(file.path, from:flutterTools); final String relativePath = globals.fs.path.relative(file.path, from:flutterTools);
fail('$relativePath imports a build_runner package'); fail('$relativePath imports a build_runner package');
......
...@@ -16,7 +16,7 @@ import 'package:flutter_tools/src/project.dart'; ...@@ -16,7 +16,7 @@ import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/resident_runner.dart'; import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/build_runner/resident_web_runner.dart'; import 'package:flutter_tools/src/build_runner/resident_web_runner.dart';
import 'package:flutter_tools/src/web/chrome.dart'; import 'package:flutter_tools/src/web/chrome.dart';
import 'package:flutter_tools/src/web/devfs_web.dart'; import 'package:flutter_tools/src/build_runner/devfs_web.dart';
import 'package:flutter_tools/src/web/web_device.dart'; import 'package:flutter_tools/src/web/web_device.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:platform/platform.dart'; import 'package:platform/platform.dart';
......
...@@ -19,7 +19,7 @@ import 'package:flutter_tools/src/project.dart'; ...@@ -19,7 +19,7 @@ import 'package:flutter_tools/src/project.dart';
import 'package:flutter_tools/src/reporting/reporting.dart'; import 'package:flutter_tools/src/reporting/reporting.dart';
import 'package:flutter_tools/src/resident_runner.dart'; import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/web/chrome.dart'; import 'package:flutter_tools/src/web/chrome.dart';
import 'package:flutter_tools/src/web/devfs_web.dart'; import 'package:flutter_tools/src/build_runner/devfs_web.dart';
import 'package:flutter_tools/src/web/web_device.dart'; import 'package:flutter_tools/src/web/web_device.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:platform/platform.dart'; import 'package:platform/platform.dart';
......
...@@ -9,7 +9,7 @@ import 'package:flutter_tools/src/base/io.dart'; ...@@ -9,7 +9,7 @@ import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/compile.dart'; import 'package:flutter_tools/src/compile.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/web/devfs_web.dart'; import 'package:flutter_tools/src/build_runner/devfs_web.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:package_config/discovery.dart'; import 'package:package_config/discovery.dart';
import 'package:package_config/packages.dart'; import 'package:package_config/packages.dart';
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/web/devfs_web.dart'; import 'package:flutter_tools/src/build_runner/devfs_web.dart';
import 'package:shelf/shelf.dart'; import 'package:shelf/shelf.dart';
import '../../src/common.dart'; import '../../src/common.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