Lookup the package config location for Dart and Flutter test targets
This depends on https://github.com/dart-lang/test/issues/2246 being resolved and all test bootstrap generators being updated with the new changes to add a packageConfigLocation constant.
I will wait to land this until the bootstrapping changes have landed
- https://github.com/flutter/flutter/pull/150440
- https://github.com/dart-lang/test/pull/2245 (@natebosch will there be additional bootstrapping changes outside of this PR that I should wait for?)
It is also worth noting that in the workspace case, the package config will contain all packages depended on by any package in the workspace, not just the current package.
Noted. This will take some more thought and design as pub workspaces roll out.
I don't know how and why you are consuming the package config currently
But for deciding exactly which packages are dependencies of your package pubspec.yaml is the way to go.
If you want the transitive closure of the set of dependencies you will have to look up each dependency in turn in the package_config and load that pubspec.yaml and find the dependencies etc.
It is also worth noting that in the workspace case, the package config will contain all packages depended on by any package in the workspace, not just the current package.
Noted. This will take some more thought and design as pub workspaces roll out.
I don't know how and why you are consuming the package config currently
But for deciding exactly which packages are dependencies of your package pubspec.yaml is the way to go.
If you want the transitive closure of the set of dependencies you will have to look up each dependency in turn in the package_config and load that pubspec.yaml and find the dependencies etc.
We use the package config file to pass it to the extension_discovery package, which finds extensions for every package dependency in the package config (both direct and transitive).
It is also worth noting that in the workspace case, the package config will contain all packages depended on by any package in the workspace, not just the current package.
Noted. This will take some more thought and design as pub workspaces roll out.
I don't know how and why you are consuming the package config currently But for deciding exactly which packages are dependencies of your package pubspec.yaml is the way to go. If you want the transitive closure of the set of dependencies you will have to look up each dependency in turn in the package_config and load that pubspec.yaml and find the dependencies etc.
We use the package config file to pass it to the
extension_discoverypackage, which finds extensions for every package dependency in the package config (both direct and transitive).
As long as you are OK with finding some extra extensions for some of the workspace packages, you might not even need to do anything. I don't know what the cost of loading extra extensions is.
- will there be additional bootstrapping changes outside of this PR that I should wait for?
We don't have any other specific changes planned at the moment. We expect there could be some use cases which are missing this variable, but we can respond to those places as they surface.