[flutter_tools] remove PackageMap and finish PackageConfig migration (#55244)
This commit is contained in:
@@ -115,7 +115,7 @@ class CoverageCollector extends TestWatcher {
|
||||
return null;
|
||||
}
|
||||
if (formatter == null) {
|
||||
final coverage.Resolver resolver = coverage.Resolver(packagesPath: PackageMap.globalPackagesPath);
|
||||
final coverage.Resolver resolver = coverage.Resolver(packagesPath: globalPackagesPath);
|
||||
final String packagePath = globals.fs.currentDirectory.path;
|
||||
final List<String> reportOn = coverageDirectory == null
|
||||
? <String>[globals.fs.path.join(packagePath, 'lib')]
|
||||
|
||||
@@ -459,7 +459,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
final Process process = await _startProcess(
|
||||
shellPath,
|
||||
mainDart,
|
||||
packages: PackageMap.globalPackagesPath,
|
||||
packages: globalPackagesPath,
|
||||
enableObservatory: enableObservatory,
|
||||
startPaused: startPaused,
|
||||
disableServiceAuthCodes: disableServiceAuthCodes,
|
||||
|
||||
@@ -97,32 +97,20 @@ class FlutterWebPlatform extends PlatformPlugin {
|
||||
);
|
||||
}
|
||||
|
||||
final Future<PackageConfig> _packagesFuture = loadPackageConfigUri(
|
||||
Uri.base.resolve('.packages'),
|
||||
loader: (Uri uri) {
|
||||
final File file = globals.fs.file(uri);
|
||||
if (!file.existsSync()) {
|
||||
return null;
|
||||
}
|
||||
return file.readAsBytes();
|
||||
}
|
||||
final Future<PackageConfig> _packagesFuture = loadPackageConfigOrFail(
|
||||
globals.fs.file(globalPackagesPath),
|
||||
logger: globals.logger,
|
||||
);
|
||||
|
||||
final Future<PackageConfig> _flutterToolsPackageMap = loadPackageConfigUri(
|
||||
final Future<PackageConfig> _flutterToolsPackageMap = loadPackageConfigOrFail(
|
||||
globals.fs.file(globals.fs.path.join(
|
||||
Cache.flutterRoot,
|
||||
'packages',
|
||||
'flutter_tools',
|
||||
'.packages',
|
||||
)).absolute.uri,
|
||||
loader: (Uri uri) {
|
||||
final File file = globals.fs.file(uri);
|
||||
if (!file.existsSync()) {
|
||||
return null;
|
||||
}
|
||||
return file.readAsBytes();
|
||||
}
|
||||
);
|
||||
)),
|
||||
logger: globals.logger,
|
||||
);
|
||||
|
||||
/// Uri of the test package.
|
||||
Future<Uri> get testUri async => (await _flutterToolsPackageMap)['test']?.packageUriRoot;
|
||||
@@ -874,7 +862,7 @@ class TestGoldenComparator {
|
||||
shellPath,
|
||||
'--disable-observatory',
|
||||
'--non-interactive',
|
||||
'--packages=${PackageMap.globalPackagesPath}',
|
||||
'--packages=$globalPackagesPath',
|
||||
output,
|
||||
];
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
||||
|
||||
// Make the global packages path absolute.
|
||||
// (Makes sure it still works after we change the current directory.)
|
||||
PackageMap.globalPackagesPath =
|
||||
globals.fs.path.normalize(globals.fs.path.absolute(PackageMap.globalPackagesPath));
|
||||
globalPackagesPath =
|
||||
globals.fs.path.normalize(globals.fs.path.absolute(globalPackagesPath));
|
||||
|
||||
// Call package:test's main method in the appropriate directory.
|
||||
final Directory saved = globals.fs.currentDirectory;
|
||||
|
||||
@@ -103,7 +103,7 @@ class TestCompiler {
|
||||
initializeFromDill: testFilePath,
|
||||
unsafePackageSerialization: false,
|
||||
dartDefines: const <String>[],
|
||||
packagesPath: PackageMap.globalPackagesPath,
|
||||
packagesPath: globalPackagesPath,
|
||||
);
|
||||
if (flutterProject.hasBuilders) {
|
||||
return CodeGeneratingResidentCompiler.create(
|
||||
@@ -126,15 +126,9 @@ class TestCompiler {
|
||||
if (!isEmpty) {
|
||||
return;
|
||||
}
|
||||
_packageConfig ??= await loadPackageConfigUri(
|
||||
globals.fs.file(PackageMap.globalPackagesPath).absolute.uri,
|
||||
loader: (Uri uri) async {
|
||||
final File file = globals.fs.file(uri);
|
||||
if (!file.existsSync()) {
|
||||
return null;
|
||||
}
|
||||
return file.readAsBytes();
|
||||
}
|
||||
_packageConfig ??= await loadPackageConfigOrFail(
|
||||
globals.fs.file(globalPackagesPath),
|
||||
logger: globals.logger,
|
||||
);
|
||||
while (compilationQueue.isNotEmpty) {
|
||||
final _CompilationRequest request = compilationQueue.first;
|
||||
|
||||
Reference in New Issue
Block a user