devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Lookup the package config location for Dart and Flutter test targets

Open kenzieschmoll opened this issue 1 year ago • 5 comments

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.

kenzieschmoll avatar Jun 17 '24 21:06 kenzieschmoll

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?)

kenzieschmoll avatar Jun 25 '24 17:06 kenzieschmoll

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.

sigurdm avatar Jun 26 '24 08:06 sigurdm

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).

kenzieschmoll avatar Jun 26 '24 15:06 kenzieschmoll

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).

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.

jakemac53 avatar Jun 26 '24 16:06 jakemac53

  • 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.

natebosch avatar Jun 27 '24 00:06 natebosch