Skip to content

Commit

Permalink
Make package configuration loading use the correct function. (#3355)
Browse files Browse the repository at this point in the history
When you have the URI of a package configuration file, you should load it directly.
It's not safe to use discovery, which assumes you start with a Dart script file.

Fixes #3354
  • Loading branch information
lrhn committed Aug 17, 2022
1 parent fcff629 commit 231750a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build_test/CHANGELOG.md
@@ -1,5 +1,7 @@
## 2.1.6-dev

- Fix bug in package config file loading.

## 2.1.5

- Allow the latest analyzer.
Expand Down
3 changes: 1 addition & 2 deletions build_test/lib/src/package_reader.dart
Expand Up @@ -76,8 +76,7 @@ class PackageAssetReader extends AssetReader
{String? rootPackage}) async {
final packageConfigUri = await Isolate.packageConfig ??
(throw UnsupportedError('No package config found'));
final packageConfig = await findPackageConfigUri(packageConfigUri) ??
(throw UnsupportedError('Package configuration file not found'));
final packageConfig = await loadPackageConfigUri(packageConfigUri);

return PackageAssetReader(packageConfig, rootPackage);
}
Expand Down

0 comments on commit 231750a

Please sign in to comment.