dart-lang / pub

The pub command line tool

Home Page:https://dart.dev/tools/pub/cmd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update the `ensureUptodate` procedure to handle workspaces

sigurdm opened this issue · comments

We want:

  • Should be invokable in any directory. The relevant enclosing directory with a package config should be found.
  • a fast-path for dart run that does not have to parse yaml.
  • Only .dart_tool/package_config.json should be parsed, and relevant timestamps compared.
  • If .dart_tool/package_config.json could not be found, or time-stamps mismatch we do a full resolution.
  • A stray package config above the workspaceroot pubspec.yaml should not be used.

The procedure for the fast path would be like:

We then for each parent directory p of current directory (including it):

  • If p is the file system root: use an empty package config.
  • look for $p/.dart_tool/package_config.json. If that exists check if it is up-to-date. (this allows a stand-alone package config).
  • look for $p/pubspec.yaml:
    • If that exists: look for $p/.dart_tool/pub/workspace_ref.json.
      • If that exists: check if the .dart_tool/package_config.json relative to its "workspaceRoot" is up-to-date.
      • Otherwise: do full resolution
    • Otherwise continue to next parent directory.

First steps were taken in #4153