See the code here
This doesn’t allow you to pass a package_config.json file by any name other than exactly .dart_tool/package_config.json
. This will likely cause problems in blaze where we can’t create overlapping files but have multiple dart_library rules in a package (all of which will need to create files like this.).
The format of the file should be determined by checking if it starts with a {
, as is done in the package_config package.
The behavior is “optimized” for the situation where you point to a
package_config.json
file.That is the only long-term behavior that we need to support, and what we want tools which specify a file to migrate to as soon as possible.
If those tools point to a
.packages
file, then we will detect that (by reading the file) and then check if a better file as available in the default location relative to the default location of a.package
file.This is the only situation where we assume anything about directory structures or file names.
There is no requirement that a specifically specified file has the default name or is placed in the default location.
One thing we could perhaps do instead is to only look for an alternative file if the originally provided file is named
.packages
. That would suggest that we are in a default layout, which is the only case where it makes sense to look for the other file in its default relative position.Then we could even do that check before reading the
.packages
file.How would that work?
OK, I propose that as a change then:
WDYT @leafpetersen, @jonasfj?