File tree Expand file tree Collapse file tree 3 files changed +8
-18
lines changed
packages/flutter_tools/lib/src Expand file tree Collapse file tree 3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change 2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
+ import 'dart:isolate' ;
5
6
import 'dart:typed_data' ;
6
7
7
8
import 'package:package_config/package_config.dart' ;
@@ -10,6 +11,11 @@ import '../base/common.dart';
10
11
import '../base/file_system.dart' ;
11
12
import '../base/logger.dart' ;
12
13
14
+ /// Loads the package configuration of the current isolate.
15
+ Future <PackageConfig > currentPackageConfig () async {
16
+ return loadPackageConfigUri (Isolate .packageConfigSync! );
17
+ }
18
+
13
19
/// Load the package configuration from [file] or throws a [ToolExit]
14
20
/// if the operation would fail.
15
21
///
Original file line number Diff line number Diff line change @@ -1222,14 +1222,7 @@ void log(logging.LogRecord event) {
1222
1222
1223
1223
Future <Directory > _loadDwdsDirectory (
1224
1224
FileSystem fileSystem, Logger logger) async {
1225
- final String toolPackagePath =
1226
- fileSystem.path.join (Cache .flutterRoot! , 'packages' , 'flutter_tools' );
1227
- final String packageFilePath =
1228
- fileSystem.path.join (toolPackagePath, '.dart_tool' , 'package_config.json' );
1229
- final PackageConfig packageConfig = await loadPackageConfigWithLogging (
1230
- fileSystem.file (packageFilePath),
1231
- logger: logger,
1232
- );
1225
+ final PackageConfig packageConfig = await currentPackageConfig ();
1233
1226
return fileSystem.directory (packageConfig['dwds' ]! .packageUriRoot);
1234
1227
}
1235
1228
Original file line number Diff line number Diff line change @@ -175,16 +175,7 @@ class FlutterWebPlatform extends PlatformPlugin {
175
175
}) async {
176
176
final shelf.Server server = await serverFactory ();
177
177
if (testPackageUri == null ) {
178
- final PackageConfig packageConfig = await loadPackageConfigWithLogging (
179
- fileSystem.file (fileSystem.path.join (
180
- Cache .flutterRoot! ,
181
- 'packages' ,
182
- 'flutter_tools' ,
183
- '.dart_tool' ,
184
- 'package_config.json' ,
185
- )),
186
- logger: logger,
187
- );
178
+ final PackageConfig packageConfig = await currentPackageConfig ();
188
179
testPackageUri = packageConfig['test' ]! .packageUriRoot;
189
180
}
190
181
final File testDartJs = fileSystem.file (fileSystem.path.join (
You can’t perform that action at this time.
0 commit comments