dart-lang / pub

The pub command line tool
https://dart.dev/tools/pub/cmd
BSD 3-Clause "New" or "Revised" License
1.05k stars 230 forks source link

Dependency overrides can't override path deps from other packages #3336

Open jakemac53 opened 2 years ago

jakemac53 commented 2 years ago

Environment

Problem

I am creating an example in the language repo which depends on some SDK packages via a git dependency. In particular, the frontend_server package. Generally this would be inadvisable, but this is just temporary example code for hacking on things.

In my pubspec, I have several overrides for each of the deps of frontend_server, to also be git dependencies, something like this:

# Override to the latest version of the in progress api.
dependency_overrides:
  _fe_analyzer_shared:
    git:
      url: https://github.com/dart-lang/sdk.git
      path: pkg/_fe_analyzer_shared
  analyzer:
    git:
      url: https://github.com/dart-lang/sdk.git
      path: pkg/analyzer
  build_integration:
    git:
      url: https://github.com/dart-lang/sdk.git
      path: pkg/build_integration
  front_end:
    git:
      url: https://github.com/dart-lang/sdk.git
      path: pkg/front_end
  frontend_server:
    git:
      url: https://github.com/dart-lang/sdk.git
      path: pkg/frontend_server
  kernel:
    git:
      url: https://github.com/dart-lang/sdk.git
      path: pkg/kernel

Expected behavior

I would expect a pub get to work, since I have overridden all deps to be github deps.

Actual behavior

Pub fails when it encounters relative path dependencies in the frontend_server package:

Resolving dependencies... (1.0s)
Error on line 12, column 11: Invalid description in the "frontend_server" pubspec on the "build_integration" dependency: "../build_integration" is a relative path, but this isn't a local pubspec.
   ╷
12 │     path: ../build_integration
sigurdm commented 2 years ago

Ah - so we should not validate dependency-descriptions if they are anyway overridden. That makes quite some sense.