From 82a6f9bf0bef537537d91b8b5d927a0d5364f834 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 25 Jun 2020 12:52:14 -0700 Subject: [PATCH] [flutter_tools] remove most use of global packages path (#60231) The global packages path could cause tests to fail when it would be overriden to unexpected (in test setup) values. Remove most usage and make it a configuration on buildInfo, along with most other build information. Cleanup the asset builder to require the .packages path and the resident runners to no longer require it, since they already have the information in build_info. It needs to stick around for the fuchsia deps we do not control. Filled #60232 for remaining work. --- .../flutter_tools/lib/src/android/gradle.dart | 1 + packages/flutter_tools/lib/src/asset.dart | 5 +- .../flutter_tools/lib/src/build_info.dart | 9 ++++ .../lib/src/build_runner/devfs_web.dart | 12 ++--- .../src/build_runner/resident_web_runner.dart | 6 +-- .../lib/src/build_system/targets/web.dart | 7 ++- packages/flutter_tools/lib/src/bundle.dart | 7 ++- .../lib/src/commands/attach.dart | 1 - .../lib/src/commands/daemon.dart | 1 - .../flutter_tools/lib/src/commands/run.dart | 1 - .../flutter_tools/lib/src/commands/test.dart | 2 +- .../lib/src/dart/package_map.dart | 3 +- packages/flutter_tools/lib/src/plugins.dart | 2 +- .../lib/src/resident_runner.dart | 12 ++--- packages/flutter_tools/lib/src/run_cold.dart | 3 +- packages/flutter_tools/lib/src/run_hot.dart | 12 ++--- .../lib/src/runner/flutter_command.dart | 1 + .../lib/src/tester/flutter_tester.dart | 3 +- .../commands.shard/hermetic/attach_test.dart | 1 - .../asset_bundle_package_fonts_test.dart | 4 +- .../asset_bundle_package_test.dart | 8 +-- .../test/general.shard/asset_bundle_test.dart | 32 ++++++------ .../asset_bundle_variant_test.dart | 4 +- .../test/general.shard/build_info_test.dart | 2 + .../build_system/targets/web_test.dart | 20 ++++---- .../test/general.shard/cold_test.dart | 5 +- .../test/general.shard/hot_test.dart | 50 +++++++++++++------ .../test/general.shard/plugins_test.dart | 3 +- .../general.shard/resident_runner_test.dart | 7 ++- .../resident_web_runner_test.dart | 5 +- .../general.shard/test_compiler_test.dart | 3 +- .../general.shard/web/devfs_web_test.dart | 4 +- 32 files changed, 128 insertions(+), 108 deletions(-) diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart index 552c6521be..0d583deab3 100644 --- a/packages/flutter_tools/lib/src/android/gradle.dart +++ b/packages/flutter_tools/lib/src/android/gradle.dart @@ -790,6 +790,7 @@ Future buildPluginsAsAar( BuildMode.release, // Plugins are built as release. null, // Plugins don't define flavors. treeShakeIcons: androidBuildInfo.buildInfo.treeShakeIcons, + packagesPath: androidBuildInfo.buildInfo.packagesPath, ), ), target: '', diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart index c680de599e..0473f18e50 100644 --- a/packages/flutter_tools/lib/src/asset.dart +++ b/packages/flutter_tools/lib/src/asset.dart @@ -51,7 +51,7 @@ abstract class AssetBundle { Future build({ String manifestPath = defaultManifestPath, String assetDirPath, - String packagesPath, + @required String packagesPath, bool includeDefaultFonts = true, bool reportLicensedPackages = false, }); @@ -122,12 +122,11 @@ class ManifestAssetBundle implements AssetBundle { Future build({ String manifestPath = defaultManifestPath, String assetDirPath, - String packagesPath, + @required String packagesPath, bool includeDefaultFonts = true, bool reportLicensedPackages = false, }) async { assetDirPath ??= getAssetBuildDirectory(); - packagesPath ??= globals.fs.path.absolute(globalPackagesPath); FlutterManifest flutterManifest; try { flutterManifest = FlutterManifest.createFromPath( diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart index a8d9a7af66..563863509d 100644 --- a/packages/flutter_tools/lib/src/build_info.dart +++ b/packages/flutter_tools/lib/src/build_info.dart @@ -29,6 +29,7 @@ class BuildInfo { this.dartExperiments = const [], @required this.treeShakeIcons, this.performanceMeasurementFile, + this.packagesPath = '.packages', }); final BuildMode mode; @@ -44,6 +45,12 @@ class BuildInfo { /// Mode-Flavor (e.g. Release-Paid). final String flavor; + /// The path to the .packages file to use for compilation. + /// + /// This is used by package:package_config to locate the actual package_config.json + /// file. If not provded, defaults to `.packages`. + final String packagesPath; + final List fileSystemRoots; final String fileSystemScheme; @@ -156,6 +163,8 @@ class BuildInfo { 'PERFORMANCE_MEASUREMENT_FILE': performanceMeasurementFile, if (bundleSkSLPath != null) 'BUNDLE_SKSL_PATH': bundleSkSLPath, + if (packagesPath != null) + 'PACKAGE_CONFIG': packagesPath, }; } } diff --git a/packages/flutter_tools/lib/src/build_runner/devfs_web.dart b/packages/flutter_tools/lib/src/build_runner/devfs_web.dart index 071ee24ca4..e27d9c1aab 100644 --- a/packages/flutter_tools/lib/src/build_runner/devfs_web.dart +++ b/packages/flutter_tools/lib/src/build_runner/devfs_web.dart @@ -140,7 +140,7 @@ class WebAssetServer implements AssetReader { int port, UrlTunneller urlTunneller, bool useSseForDebugProxy, - BuildMode buildMode, + BuildInfo buildInfo, bool enableDwds, Uri entrypoint, ExpressionCompiler expressionCompiler, { @@ -156,7 +156,7 @@ class WebAssetServer implements AssetReader { } final HttpServer httpServer = await HttpServer.bind(address, port); final PackageConfig packageConfig = await loadPackageConfigWithLogging( - globals.fs.file(globalPackagesPath), + globals.fs.file(buildInfo.packagesPath), logger: globals.logger, ); final Map digests = {}; @@ -173,7 +173,7 @@ class WebAssetServer implements AssetReader { } // In release builds deploy a simpler proxy server. - if (buildMode != BuildMode.debug) { + if (buildInfo.mode != BuildMode.debug) { final ReleaseAssetServer releaseAssetServer = ReleaseAssetServer( entrypoint, fileSystem: globals.fs, @@ -589,7 +589,7 @@ class WebDevFS implements DevFS { @required this.packagesFilePath, @required this.urlTunneller, @required this.useSseForDebugProxy, - @required this.buildMode, + @required this.buildInfo, @required this.enableDwds, @required this.entrypoint, @required this.expressionCompiler, @@ -603,7 +603,7 @@ class WebDevFS implements DevFS { final String packagesFilePath; final UrlTunneller urlTunneller; final bool useSseForDebugProxy; - final BuildMode buildMode; + final BuildInfo buildInfo; final bool enableDwds; final bool testMode; final ExpressionCompiler expressionCompiler; @@ -670,7 +670,7 @@ class WebDevFS implements DevFS { port, urlTunneller, useSseForDebugProxy, - buildMode, + buildInfo, enableDwds, entrypoint, expressionCompiler, diff --git a/packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart b/packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart index c5ccc4aaee..b7b2d2b4a1 100644 --- a/packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart +++ b/packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart @@ -66,7 +66,7 @@ class DwdsWebRunnerFactory extends WebRunnerFactory { } } -const String kExitMessage = 'Failed to establish connection with the application ' +const String kExitMessage = 'Failed to establish connection with the application ' 'instance in Chrome.\nThis can happen if the websocket connection used by the ' 'web tooling is unable to correctly establish a connection, for example due to a firewall.'; @@ -447,7 +447,7 @@ class _ResidentWebRunner extends ResidentWebRunner { packagesFilePath: packagesFilePath, urlTunneller: urlTunneller, useSseForDebugProxy: debuggingOptions.webUseSseForDebugProxy, - buildMode: debuggingOptions.buildInfo.mode, + buildInfo: debuggingOptions.buildInfo, enableDwds: _enableDwds, entrypoint: globals.fs.file(target).uri, expressionCompiler: expressionCompiler, @@ -639,7 +639,7 @@ class _ResidentWebRunner extends ResidentWebRunner { final bool rebuildBundle = assetBundle.needsBuild(); if (rebuildBundle) { globals.printTrace('Updating assets'); - final int result = await assetBundle.build(); + final int result = await assetBundle.build(packagesPath: debuggingOptions.buildInfo.packagesPath); if (result != 0) { return UpdateFSReport(success: false); } diff --git a/packages/flutter_tools/lib/src/build_system/targets/web.dart b/packages/flutter_tools/lib/src/build_system/targets/web.dart index 45333778df..5e65e56ea8 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/web.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/web.dart @@ -58,8 +58,10 @@ class WebEntrypointTarget extends Target { final bool shouldInitializePlatform = environment.defines[kInitializePlatform] == 'true'; final bool hasPlugins = environment.defines[kHasWebPlugins] == 'true'; final Uri importUri = environment.fileSystem.file(targetFile).absolute.uri; + // TODO(jonahwilliams): support configuration of this file. + const String packageFile = '.packages'; final PackageConfig packageConfig = await loadPackageConfigWithLogging( - environment.projectDir.childFile('.packages'), + environment.fileSystem.file(packageFile), logger: environment.logger, ); @@ -156,7 +158,8 @@ class Dart2JSTarget extends Target { final BuildMode buildMode = getBuildModeForName(environment.defines[kBuildMode]); final String specPath = globals.fs.path.join( globals.artifacts.getArtifactPath(Artifact.flutterWebSdk), 'libraries.json'); - final String packageFile = globalPackagesPath; + // TODO(jonahwilliams): support configuration of this file. + const String packageFile = '.packages'; final File outputKernel = environment.buildDir.childFile('app.dill'); final File outputFile = environment.buildDir.childFile('main.dart.js'); final List dartDefines = decodeDartDefines(environment.defines, kDartDefines); diff --git a/packages/flutter_tools/lib/src/bundle.dart b/packages/flutter_tools/lib/src/bundle.dart index cca243e980..4b693e5b3a 100644 --- a/packages/flutter_tools/lib/src/bundle.dart +++ b/packages/flutter_tools/lib/src/bundle.dart @@ -20,7 +20,6 @@ import 'build_system/targets/common.dart'; import 'build_system/targets/icon_tree_shaker.dart'; import 'cache.dart'; import 'convert.dart'; -import 'dart/package_map.dart'; import 'devfs.dart'; import 'globals.dart' as globals; import 'project.dart'; @@ -95,7 +94,7 @@ class BundleBuilder { mainPath ??= defaultMainPath; depfilePath ??= defaultDepfilePath; assetDirPath ??= getAssetBuildDirectory(); - packagesPath ??= globals.fs.path.absolute(globalPackagesPath); + packagesPath ??= globals.fs.path.absolute('.packages'); final FlutterProject flutterProject = FlutterProject.current(); await buildWithAssemble( buildMode: buildInfo.mode, @@ -192,12 +191,12 @@ Future buildWithAssemble({ Future buildAssets({ String manifestPath, String assetDirPath, - String packagesPath, + @required String packagesPath, bool includeDefaultFonts = true, bool reportLicensedPackages = false, }) async { assetDirPath ??= getAssetBuildDirectory(); - packagesPath ??= globals.fs.path.absolute(globalPackagesPath); + packagesPath ??= globals.fs.path.absolute(packagesPath); // Build the asset bundle. final AssetBundle assetBundle = AssetBundleFactory.instance.createBundle(); diff --git a/packages/flutter_tools/lib/src/commands/attach.dart b/packages/flutter_tools/lib/src/commands/attach.dart index 308d8aa467..853f279891 100644 --- a/packages/flutter_tools/lib/src/commands/attach.dart +++ b/packages/flutter_tools/lib/src/commands/attach.dart @@ -415,7 +415,6 @@ class HotRunnerFactory { applicationBinary: applicationBinary, hostIsIde: hostIsIde, projectRootPath: projectRootPath, - packagesFilePath: packagesFilePath, dillOutputPath: dillOutputPath, stayResident: stayResident, ipv6: ipv6, diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index cc5bb60fe9..9994d4dad3 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -486,7 +486,6 @@ class AppDomain extends Domain { debuggingOptions: options, applicationBinary: applicationBinary, projectRootPath: projectRootPath, - packagesFilePath: packagesFilePath, dillOutputPath: dillOutputPath, ipv6: ipv6, hostIsIde: true, diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index cfc964375c..9dab37574e 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart @@ -536,7 +536,6 @@ class RunCommand extends RunCommandBase { ? null : globals.fs.file(applicationBinaryPath), projectRootPath: stringArg('project-root'), - packagesFilePath: globalResults['packages'] as String, dillOutputPath: stringArg('output-dill'), stayResident: stayResident, ipv6: ipv6, diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart index ab08c13905..f30f73ea07 100644 --- a/packages/flutter_tools/lib/src/commands/test.dart +++ b/packages/flutter_tools/lib/src/commands/test.dart @@ -296,7 +296,7 @@ class TestCommand extends FlutterCommand { Future _buildTestAsset() async { final AssetBundle assetBundle = AssetBundleFactory.instance.createBundle(); - final int build = await assetBundle.build(); + final int build = await assetBundle.build(packagesPath: '.packages'); if (build != 0) { throwToolExit('Error: Failed to build asset bundle'); } diff --git a/packages/flutter_tools/lib/src/dart/package_map.dart b/packages/flutter_tools/lib/src/dart/package_map.dart index c5702bfa06..cd5f14b721 100644 --- a/packages/flutter_tools/lib/src/dart/package_map.dart +++ b/packages/flutter_tools/lib/src/dart/package_map.dart @@ -13,6 +13,7 @@ import '../base/logger.dart'; const String kPackagesFileName = '.packages'; +// No touching! String get globalPackagesPath => _globalPackagesPath ?? kPackagesFileName; set globalPackagesPath(String value) { @@ -55,7 +56,7 @@ Future loadPackageConfigWithLogging(File file, { message += '\nDid you run this command from the same directory as your pubspec.yaml file?'; } logger.printError(message); - throwToolExit(null); + throwToolExit(file.path); } ); } diff --git a/packages/flutter_tools/lib/src/plugins.dart b/packages/flutter_tools/lib/src/plugins.dart index 79d930566b..97e3406986 100644 --- a/packages/flutter_tools/lib/src/plugins.dart +++ b/packages/flutter_tools/lib/src/plugins.dart @@ -321,7 +321,7 @@ Future> findPlugins(FlutterProject project) async { final List plugins = []; final String packagesFile = globals.fs.path.join( project.directory.path, - globalPackagesPath, + '.packages', ); final PackageConfig packageConfig = await loadPackageConfigWithLogging( globals.fs.file(packagesFile), diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 3e52c9b14a..0b0840079e 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -26,7 +26,6 @@ import 'bundle.dart'; import 'cache.dart'; import 'codegen.dart'; import 'compile.dart'; -import 'dart/package_map.dart'; import 'devfs.dart'; import 'device.dart'; import 'features.dart'; @@ -60,7 +59,7 @@ class FlutterDevice { fileSystemScheme: fileSystemScheme, targetModel: targetModel, dartDefines: buildInfo.dartDefines, - packagesPath: globalPackagesPath, + packagesPath: buildInfo.packagesPath, extraFrontEndOptions: buildInfo.extraFrontEndOptions, artifacts: globals.artifacts, processManager: globals.processManager, @@ -113,7 +112,7 @@ class FlutterDevice { dartDefines: buildInfo.dartDefines, librariesSpec: globals.fs.file(globals.artifacts .getArtifactPath(Artifact.flutterWebLibrariesJson)).uri.toString(), - packagesPath: globalPackagesPath, + packagesPath: buildInfo.packagesPath, artifacts: globals.artifacts, processManager: globals.processManager, logger: globals.logger, @@ -136,7 +135,7 @@ class FlutterDevice { trackWidgetCreation: buildInfo.trackWidgetCreation, dartDefines: buildInfo.dartDefines, ), - packagesPath: globalPackagesPath, + packagesPath: buildInfo.packagesPath, artifacts: globals.artifacts, processManager: globals.processManager, logger: globals.logger, @@ -683,16 +682,15 @@ abstract class ResidentRunner { ResidentRunner( this.flutterDevices, { this.target, - this.debuggingOptions, + @required this.debuggingOptions, String projectRootPath, - String packagesFilePath, this.ipv6, this.stayResident = true, this.hotMode = true, String dillOutputPath, }) : mainPath = findMainDartFile(target), + packagesFilePath = debuggingOptions.buildInfo.packagesPath, projectRootPath = projectRootPath ?? globals.fs.currentDirectory.path, - packagesFilePath = packagesFilePath ?? globals.fs.path.absolute(globalPackagesPath), _dillOutputPath = dillOutputPath, artifactDirectory = dillOutputPath == null ? globals.fs.systemTempDirectory.createTempSync('flutter_tool.') diff --git a/packages/flutter_tools/lib/src/run_cold.dart b/packages/flutter_tools/lib/src/run_cold.dart index 82c3661d47..59f82602b3 100644 --- a/packages/flutter_tools/lib/src/run_cold.dart +++ b/packages/flutter_tools/lib/src/run_cold.dart @@ -13,12 +13,11 @@ import 'resident_runner.dart'; import 'tracing.dart'; import 'vmservice.dart'; -// TODO(mklim): Test this, flutter/flutter#23031. class ColdRunner extends ResidentRunner { ColdRunner( List devices, { String target, - DebuggingOptions debuggingOptions, + @required DebuggingOptions debuggingOptions, this.traceStartup = false, this.awaitFirstFrameWhenTracing = true, this.applicationBinary, diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 258d0c41af..6a05ccc203 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -67,12 +67,11 @@ class HotRunner extends ResidentRunner { HotRunner( List devices, { String target, - DebuggingOptions debuggingOptions, + @required DebuggingOptions debuggingOptions, this.benchmarkMode = false, this.applicationBinary, this.hostIsIde = false, String projectRootPath, - String packagesFilePath, String dillOutputPath, bool stayResident = true, bool ipv6 = false, @@ -80,7 +79,6 @@ class HotRunner extends ResidentRunner { target: target, debuggingOptions: debuggingOptions, projectRootPath: projectRootPath, - packagesFilePath: packagesFilePath, stayResident: stayResident, hotMode: true, dillOutputPath: dillOutputPath, @@ -157,7 +155,7 @@ class HotRunner extends ResidentRunner { final UpdateFSReport results = UpdateFSReport(success: true); final List invalidated = [Uri.parse(libraryId)]; final PackageConfig packageConfig = await loadPackageConfigWithLogging( - globals.fs.file(globalPackagesPath), + globals.fs.file(debuggingOptions.buildInfo.packagesPath), logger: globals.logger, ); for (final FlutterDevice device in flutterDevices) { @@ -343,7 +341,7 @@ class HotRunner extends ResidentRunner { final List> startupTasks = >[]; final PackageConfig packageConfig = await loadPackageConfigWithLogging( - globals.fs.file(globalPackagesPath), + globals.fs.file(debuggingOptions.buildInfo.packagesPath), logger: globals.logger, ); for (final FlutterDevice device in flutterDevices) { @@ -407,7 +405,7 @@ class HotRunner extends ResidentRunner { final bool rebuildBundle = assetBundle.needsBuild(); if (rebuildBundle) { globals.printTrace('Updating assets'); - final int result = await assetBundle.build(); + final int result = await assetBundle.build(packagesPath: '.packages'); if (result != 0) { return UpdateFSReport(success: false); } @@ -1289,7 +1287,7 @@ class ProjectFileInvalidator { Future _createPackageConfig(String packagesPath) { return loadPackageConfigWithLogging( - _fileSystem.file(globalPackagesPath), + _fileSystem.file(packagesPath), logger: _logger, ); } diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index 4a3af214e3..8c6aeec53a 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -685,6 +685,7 @@ abstract class FlutterCommand extends Command { bundleSkSLPath: bundleSkSLPath, dartExperiments: experiments, performanceMeasurementFile: performanceMeasurementFile, + packagesPath: globalResults['packages'] as String ?? '.packages' ); } diff --git a/packages/flutter_tools/lib/src/tester/flutter_tester.dart b/packages/flutter_tools/lib/src/tester/flutter_tester.dart index 0e86f3970e..f786ccb367 100644 --- a/packages/flutter_tools/lib/src/tester/flutter_tester.dart +++ b/packages/flutter_tools/lib/src/tester/flutter_tester.dart @@ -14,7 +14,6 @@ import '../base/io.dart'; import '../build_info.dart'; import '../bundle.dart'; import '../convert.dart'; -import '../dart/package_map.dart'; import '../device.dart'; import '../globals.dart' as globals; import '../project.dart'; @@ -138,7 +137,7 @@ class FlutterTesterDevice extends Device { '--run-forever', '--non-interactive', '--enable-dart-profiling', - '--packages=$globalPackagesPath', + '--packages=${debuggingOptions.buildInfo.packagesPath}', ]; if (debuggingOptions.debuggingEnabled) { if (debuggingOptions.startPaused) { diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart index c1c2722818..ee034fa51b 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -782,7 +782,6 @@ class TestHotRunnerFactory extends HotRunnerFactory { applicationBinary: applicationBinary, hostIsIde: hostIsIde, projectRootPath: projectRootPath, - packagesFilePath: packagesFilePath, dillOutputPath: dillOutputPath, stayResident: stayResident, ipv6: ipv6, diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart index 6ce082395b..b551710252 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart @@ -68,7 +68,7 @@ $fontsSection String expectedAssetManifest, ) async { final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); for (final String packageName in packages) { for (final String packageFont in packageFonts) { @@ -122,7 +122,7 @@ $fontsSection writePubspecFile('p/p/pubspec.yaml', 'test_package'); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest expect(bundle.entries.containsKey('FontManifest.json'), isTrue); }, overrides: { diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart index bd4a9f4fd4..c5acfc4cce 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart @@ -74,7 +74,7 @@ $assetsSection bool expectExists = true, }) async { final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); for (final String packageName in packages) { for (final String asset in assets) { @@ -129,7 +129,7 @@ $assetsSection writePubspecFile('p/p/pubspec.yaml', 'test_package'); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest const String expectedAssetManifest = '{}'; expect( @@ -157,7 +157,7 @@ $assetsSection writeAssets('p/p/', assets); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest const String expectedAssetManifest = '{}'; expect( @@ -589,7 +589,7 @@ $assetsSection writeAssets('p/p/', assetsOnDisk); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); expect(bundle.entries['AssetManifest.json'], isNull, reason: 'Invalid pubspec.yaml should not generate AssetManifest.json' ); diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart index 25b0600a4a..155a6f5240 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart @@ -37,7 +37,7 @@ void main() { testUsingContext('nonempty', () async { final AssetBundle ab = AssetBundleFactory.instance.createBundle(); - expect(await ab.build(), 0); + expect(await ab.build(packagesPath: '.packages'), 0); expect(ab.entries.length, greaterThan(0)); }, overrides: { FileSystem: () => testFileSystem, @@ -50,7 +50,7 @@ void main() { ..writeAsStringSync(''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); expect(bundle.entries.length, 1); const String expectedAssetManifest = '{}'; expect( @@ -74,7 +74,7 @@ flutter: - assets/foo/ '''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); // Expected assets: // - asset manifest // - font manifest @@ -89,7 +89,7 @@ flutter: ..setLastModifiedSync(packageFile.lastModifiedSync().add(const Duration(hours: 1))); expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), true); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); // Expected assets: // - asset manifest // - font manifest @@ -114,7 +114,7 @@ flutter: '''); globals.fs.file('.packages').createSync(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); // Expected assets: // - asset manifest // - font manifest @@ -140,7 +140,7 @@ name: example''') // asset manifest and not updated. This is due to the devfs not // supporting file deletion. expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), true); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); // Expected assets: // - asset manifest // - font manifest @@ -168,7 +168,7 @@ flutter: '''); globals.fs.file('.packages').createSync(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); // Expected assets: // - asset manifest // - font manifest @@ -205,7 +205,7 @@ assets: - assets/foo/bar.txt '''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); final DevFSStringContent assetManifest = bundle.entries['AssetManifest.json'] as DevFSStringContent; @@ -214,7 +214,7 @@ assets: final DevFSStringContent license = bundle.entries['NOTICES'] as DevFSStringContent; - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); expect(assetManifest, bundle.entries['AssetManifest.json']); expect(fontManifest, bundle.entries['FontManifest.json']); @@ -238,7 +238,7 @@ flutter: '''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - expect(await bundle.build(manifestPath: 'pubspec.yaml'), 0); + expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0); expect(bundle.additionalDependencies.single.path, contains('DOES_NOT_EXIST_RERUN_FOR_WILDCARD')); }, overrides: { FileSystem: () => MemoryFileSystem.test(), @@ -259,7 +259,7 @@ flutter: '''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - expect(await bundle.build(manifestPath: 'pubspec.yaml'), 0); + expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0); expect(bundle.additionalDependencies, isEmpty); }, overrides: { FileSystem: () => MemoryFileSystem.test(), @@ -293,7 +293,7 @@ flutter: final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true); - expect(await bundle.build(manifestPath: 'pubspec.yaml'), 0); + expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0); expect(bundle.additionalDependencies, isEmpty); }, overrides: { FileSystem: () => MemoryFileSystem.test(), @@ -327,7 +327,7 @@ flutter: final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); globals.fs.file('foo/bar/fizz.txt').createSync(recursive: true); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); expect(bundle.entries, hasLength(4)); expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false); @@ -369,7 +369,7 @@ flutter: '''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - expect(await bundle.build(manifestPath: 'pubspec.yaml'), 1); + expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 1); expect(testLogger.errorText, contains('This asset was included from package foo')); }, overrides: { FileSystem: () => MemoryFileSystem.test(), @@ -392,7 +392,7 @@ flutter: '''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - expect(await bundle.build(manifestPath: 'pubspec.yaml'), 1); + expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 1); expect(testLogger.errorText, isNot(contains('This asset was included from'))); }, overrides: { FileSystem: () => MemoryFileSystem.test(), @@ -426,7 +426,7 @@ flutter: '''); final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - expect(await bundle.build(manifestPath: 'pubspec.yaml'), 0); + expect(await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'), 0); expect((bundle.entries['FontManifest.json'] as DevFSStringContent).string, '[]'); expect((bundle.entries['AssetManifest.json'] as DevFSStringContent).string, '{}'); expect(testLogger.errorText, contains( diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart index 3edb0550cc..936b5c5fb5 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart @@ -72,7 +72,7 @@ flutter: } AssetBundle bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); // The main asset file, /a/b/c/foo, and its variants exist. for (final String asset in assets) { @@ -82,7 +82,7 @@ flutter: globals.fs.file(fixPath('a/b/c/foo')).deleteSync(); bundle = AssetBundleFactory.instance.createBundle(); - await bundle.build(manifestPath: 'pubspec.yaml'); + await bundle.build(manifestPath: 'pubspec.yaml', packagesPath: '.packages'); // Now the main asset file, /a/b/c/foo, does not exist. This is OK because // the /a/b/c/*/foo variants do exist. diff --git a/packages/flutter_tools/test/general.shard/build_info_test.dart b/packages/flutter_tools/test/general.shard/build_info_test.dart index f2f031961e..9b50cf86c2 100644 --- a/packages/flutter_tools/test/general.shard/build_info_test.dart +++ b/packages/flutter_tools/test/general.shard/build_info_test.dart @@ -106,6 +106,7 @@ void main() { extraFrontEndOptions: ['--enable-experiment=non-nullable', 'bar'], extraGenSnapshotOptions: ['--enable-experiment=non-nullable', 'fizz'], bundleSkSLPath: 'foo/bar/baz.sksl.json', + packagesPath: 'foo/.packages', ); expect(buildInfo.toEnvironmentConfig(), { @@ -117,6 +118,7 @@ void main() { 'EXTRA_FRONT_END_OPTIONS': '--enable-experiment%3Dnon-nullable,bar', 'EXTRA_GEN_SNAPSHOT_OPTIONS': '--enable-experiment%3Dnon-nullable,fizz', 'BUNDLE_SKSL_PATH': 'foo/bar/baz.sksl.json', + 'PACKAGE_CONFIG': 'foo/.packages', }); }); diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart index 84d9490f59..f4a9cb04cf 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart @@ -11,7 +11,6 @@ import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/depfile.dart'; import 'package:flutter_tools/src/build_system/targets/common.dart'; import 'package:flutter_tools/src/build_system/targets/web.dart'; -import 'package:flutter_tools/src/dart/package_map.dart'; import 'package:flutter_tools/src/globals.dart' as globals; import 'package:mockito/mockito.dart'; import 'package:process/process.dart'; @@ -44,10 +43,9 @@ void main() { setUp(() { testbed = Testbed(setup: () { - final File packagesFile = globals.fs.file(globals.fs.path.join('foo', '.packages')) + globals.fs.file('.packages') ..createSync(recursive: true) - ..writeAsStringSync('foo:lib/\n'); - globalPackagesPath = packagesFile.path; + ..writeAsStringSync('foo:foo/lib/\n'); globals.fs.currentDirectory.childDirectory('bar').createSync(); processManager = FakeProcessManager.list([]); @@ -229,7 +227,7 @@ void main() { ...kDart2jsLinuxArgs, '-o', environment.buildDir.childFile('app.dill').absolute.path, - '--packages=${globals.fs.path.join('foo', '.packages')}', + '--packages=.packages', '-Ddart.vm.profile=true', '--cfe-only', environment.buildDir.childFile('main.dart').absolute.path, @@ -263,7 +261,7 @@ void main() { '--enable-experiment=non-nullable', '-o', environment.buildDir.childFile('app.dill').absolute.path, - '--packages=${globals.fs.path.join('foo', '.packages')}', + '--packages=.packages', '-Ddart.vm.profile=true', '--cfe-only', environment.buildDir.childFile('main.dart').absolute.path, @@ -294,7 +292,7 @@ void main() { ...kDart2jsLinuxArgs, '-o', environment.buildDir.childFile('app.dill').absolute.path, - '--packages=${globals.fs.path.join('foo', '.packages')}', + '--packages=.packages', '-Ddart.vm.profile=true', '--cfe-only', environment.buildDir.childFile('main.dart').absolute.path, @@ -324,7 +322,7 @@ void main() { ...kDart2jsLinuxArgs, '-o', environment.buildDir.childFile('app.dill').absolute.path, - '--packages=${globals.fs.path.join('foo', '.packages')}', + '--packages=.packages', '-Ddart.vm.product=true', '--cfe-only', environment.buildDir.childFile('main.dart').absolute.path, @@ -354,7 +352,7 @@ void main() { ...kDart2jsLinuxArgs, '-o', environment.buildDir.childFile('app.dill').absolute.path, - '--packages=${globals.fs.path.join('foo', '.packages')}', + '--packages=.packages', '-Ddart.vm.product=true', '--cfe-only', environment.buildDir.childFile('main.dart').absolute.path, @@ -403,7 +401,7 @@ void main() { ...kDart2jsLinuxArgs, '-o', environment.buildDir.childFile('app.dill').absolute.path, - '--packages=${globals.fs.path.join('foo', '.packages')}', + '--packages=.packages', '-Ddart.vm.product=true', '-DFOO=bar', '-DBAZ=qux', @@ -437,7 +435,7 @@ void main() { ...kDart2jsLinuxArgs, '-o', environment.buildDir.childFile('app.dill').absolute.path, - '--packages=${globals.fs.path.join('foo', '.packages')}', + '--packages=.packages', '-Ddart.vm.profile=true', '-DFOO=bar', '-DBAZ=qux', diff --git a/packages/flutter_tools/test/general.shard/cold_test.dart b/packages/flutter_tools/test/general.shard/cold_test.dart index d9f88a9d55..3800969862 100644 --- a/packages/flutter_tools/test/general.shard/cold_test.dart +++ b/packages/flutter_tools/test/general.shard/cold_test.dart @@ -77,7 +77,10 @@ void main() { final MockFlutterDevice mockFlutterDevice = MockFlutterDevice(); when(mockFlutterDevice.device).thenReturn(mockDevice); final List devices = [mockFlutterDevice]; - final int result = await ColdRunner(devices).run(); + final int result = await ColdRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug), + ).run(); expect(result, 1); expect(testLogger.errorText, matches(r'Tried to run .*, but that file does not exist\.')); diff --git a/packages/flutter_tools/test/general.shard/hot_test.dart b/packages/flutter_tools/test/general.shard/hot_test.dart index 2ffd67bc38..6d9c011b95 100644 --- a/packages/flutter_tools/test/general.shard/hot_test.dart +++ b/packages/flutter_tools/test/general.shard/hot_test.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'package:file/memory.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/dart/package_map.dart'; import 'package:vm_service/vm_service.dart' as vm_service; import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/io.dart'; @@ -163,7 +162,7 @@ void main() { }); testUsingContext('Does not hot restart when device does not support it', () async { - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); // Setup mocks @@ -175,7 +174,10 @@ void main() { final List devices = [ FlutterDevice(mockDevice, generator: residentCompiler, buildInfo: BuildInfo.debug)..devFS = mockDevFs, ]; - final OperationResult result = await HotRunner(devices).restart(fullRestart: true); + final OperationResult result = await HotRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug), + ).restart(fullRestart: true); // Expect hot restart failed. expect(result.isOk, false); expect(result.message, 'hotRestart not supported'); @@ -188,7 +190,7 @@ void main() { }); testUsingContext('Does not hot restart when one of many devices does not support it', () async { - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); // Setup mocks @@ -203,7 +205,10 @@ void main() { FlutterDevice(mockDevice, generator: residentCompiler, buildInfo: BuildInfo.debug)..devFS = mockDevFs, FlutterDevice(mockHotDevice, generator: residentCompiler, buildInfo: BuildInfo.debug)..devFS = mockDevFs, ]; - final OperationResult result = await HotRunner(devices).restart(fullRestart: true); + final OperationResult result = await HotRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug) + ).restart(fullRestart: true); // Expect hot restart failed. expect(result.isOk, false); expect(result.message, 'hotRestart not supported'); @@ -302,7 +307,10 @@ void main() { ..vmService = fakeVmServiceHost.vmService ..devFS = mockDevFs, ]; - final HotRunner hotRunner = HotRunner(devices); + final HotRunner hotRunner = HotRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug), + ); final OperationResult result = await hotRunner.restart(fullRestart: true); // Expect hot restart was successful. expect(hotRunner.uri, mockDevFs.baseUri); @@ -317,7 +325,7 @@ void main() { }); testUsingContext('setup function fails', () async { - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); final MockDevice mockDevice = MockDevice(); @@ -327,7 +335,10 @@ void main() { final List devices = [ FlutterDevice(mockDevice, generator: residentCompiler, buildInfo: BuildInfo.debug), ]; - final OperationResult result = await HotRunner(devices).restart(fullRestart: true); + final OperationResult result = await HotRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug), + ).restart(fullRestart: true); expect(result.isOk, false); expect(result.message, 'setupHotRestart failed'); }, overrides: { @@ -339,7 +350,7 @@ void main() { }); testUsingContext('hot restart supported', () async { - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); // Setup mocks @@ -389,7 +400,10 @@ void main() { ..vmService = fakeVmServiceHost.vmService ..devFS = mockDevFs, ]; - final HotRunner hotRunner = HotRunner(devices); + final HotRunner hotRunner = HotRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug), + ); final OperationResult result = await hotRunner.restart(fullRestart: true); // Expect hot restart successful. expect(hotRunner.uri, mockDevFs.baseUri); @@ -413,7 +427,7 @@ void main() { }); testUsingContext('shutdown hook called after signal', () async { - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); final MockDevice mockDevice = MockDevice(); @@ -423,7 +437,10 @@ void main() { final List devices = [ FlutterDevice(mockDevice, generator: residentCompiler, buildInfo: BuildInfo.debug), ]; - await HotRunner(devices).cleanupAfterSignal(); + await HotRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug) + ).cleanupAfterSignal(); expect(shutdownTestingConfig.shutdownHookCalled, true); }, overrides: { HotRunnerConfig: () => shutdownTestingConfig, @@ -434,7 +451,7 @@ void main() { }); testUsingContext('shutdown hook called after app stop', () async { - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); final MockDevice mockDevice = MockDevice(); @@ -444,7 +461,10 @@ void main() { final List devices = [ FlutterDevice(mockDevice, generator: residentCompiler, buildInfo: BuildInfo.debug), ]; - await HotRunner(devices).preExit(); + await HotRunner( + devices, + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug) + ).preExit(); expect(shutdownTestingConfig.shutdownHookCalled, true); }, overrides: { HotRunnerConfig: () => shutdownTestingConfig, @@ -465,7 +485,7 @@ void main() { testUsingContext('Exits with code 2 when when HttpException is thrown ' 'during VM service connection', () async { - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); diff --git a/packages/flutter_tools/test/general.shard/plugins_test.dart b/packages/flutter_tools/test/general.shard/plugins_test.dart index f3f4506576..37100403d2 100644 --- a/packages/flutter_tools/test/general.shard/plugins_test.dart +++ b/packages/flutter_tools/test/general.shard/plugins_test.dart @@ -8,7 +8,6 @@ import 'package:file/file.dart'; import 'package:file/memory.dart'; import 'package:file_testing/file_testing.dart'; import 'package:flutter_tools/src/base/time.dart'; -import 'package:flutter_tools/src/dart/package_map.dart'; import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/ios/xcodeproj.dart'; @@ -107,7 +106,7 @@ void main() { // Set up a simple .packages file for all the tests to use, pointing to one package. dummyPackageDirectory = fs.directory('/pubcache/apackage/lib/'); - packagesFile = fs.file(fs.path.join(flutterProject.directory.path, globalPackagesPath)); + packagesFile = fs.file(fs.path.join(flutterProject.directory.path, '.packages')); packagesFile..createSync(recursive: true) ..writeAsStringSync('apackage:file://${dummyPackageDirectory.path}\n'); }); diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart index 9bb669b0f8..89ff3a589f 100644 --- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart @@ -5,7 +5,6 @@ import 'dart:async'; import 'package:flutter_tools/src/cache.dart'; -import 'package:flutter_tools/src/dart/package_map.dart'; import 'package:vm_service/vm_service.dart' as vm_service; import 'package:file/memory.dart'; import 'package:file_testing/file_testing.dart'; @@ -93,9 +92,8 @@ void main() { setUp(() { testbed = Testbed(setup: () { - globals.fs.file(globalPackagesPath) - ..createSync(recursive: true) - ..writeAsStringSync('\n'); + globals.fs.file('.packages') + .writeAsStringSync('\n'); globals.fs.file(globals.fs.path.join('build', 'app.dill')) ..createSync(recursive: true) ..writeAsStringSync('ABC'); @@ -1124,6 +1122,7 @@ void main() { final FlutterDevice device = FlutterDevice(mockDevice, buildInfo: BuildInfo.debug); final ResidentRunner residentRunner = HotRunner( [device], + debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug) ); expect(await residentRunner.listFlutterViews(), isEmpty); diff --git a/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart index 17d0ea3ade..813fbc8cb2 100644 --- a/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart @@ -16,7 +16,6 @@ import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_runner/devfs_web.dart'; import 'package:flutter_tools/src/build_runner/resident_web_runner.dart'; import 'package:flutter_tools/src/compile.dart'; -import 'package:flutter_tools/src/dart/package_map.dart'; import 'package:flutter_tools/src/dart/pub.dart'; import 'package:flutter_tools/src/devfs.dart'; import 'package:flutter_tools/src/device.dart'; @@ -116,7 +115,7 @@ void main() { }); testbed = Testbed( setup: () { - globals.fs.file(globalPackagesPath) + globals.fs.file('.packages') ..createSync(recursive: true) ..writeAsStringSync('\n'); residentWebRunner = DwdsWebRunnerFactory().createWebRunner( @@ -127,8 +126,6 @@ void main() { stayResident: true, urlTunneller: null, ) as ResidentWebRunner; - globals.fs.currentDirectory.childFile('.packages') - .writeAsStringSync('\n'); }, overrides: { Pub: () => MockPub(), diff --git a/packages/flutter_tools/test/general.shard/test_compiler_test.dart b/packages/flutter_tools/test/general.shard/test_compiler_test.dart index 99572d60f9..4bca809abc 100644 --- a/packages/flutter_tools/test/general.shard/test_compiler_test.dart +++ b/packages/flutter_tools/test/general.shard/test_compiler_test.dart @@ -9,7 +9,6 @@ import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/compile.dart'; -import 'package:flutter_tools/src/dart/package_map.dart'; import 'package:flutter_tools/src/project.dart'; import 'package:flutter_tools/src/test/test_compiler.dart'; import 'package:mockito/mockito.dart'; @@ -32,7 +31,7 @@ void main() { fileSystem.file('pubspec.yaml').createSync(); fileSystem.file('.packages').writeAsStringSync('flutter_test:flutter_test/'); fileSystem.file('test/foo.dart').createSync(recursive: true); - fileSystem.file(globalPackagesPath) + fileSystem.file('.packages') ..createSync() ..writeAsStringSync('flutter_test:flutter_test/'); residentCompiler = MockResidentCompiler(); diff --git a/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart b/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart index 8ac82892d3..c69200b4cd 100644 --- a/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart +++ b/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart @@ -416,7 +416,7 @@ void main() { packagesFilePath: '.packages', urlTunneller: null, useSseForDebugProxy: true, - buildMode: BuildMode.debug, + buildInfo: BuildInfo.debug, enableDwds: false, entrypoint: Uri.base, testMode: true, @@ -510,7 +510,7 @@ void main() { packagesFilePath: '.packages', urlTunneller: null, useSseForDebugProxy: true, - buildMode: BuildMode.debug, + buildInfo: BuildInfo.debug, enableDwds: false, entrypoint: Uri.base, testMode: true,