thosakwe / pub_mediator

[ARCHIVED] Diagnoses version conflicts between dependencies in Dart packages.
http://mediator.thosakwe.com/
MIT License
12 stars 2 forks source link

Support for dependency overrides and/or path-based dependencies #5

Open cedx opened 6 years ago

cedx commented 6 years ago

My pubspec.yaml looks like:

dependencies:
  foo: ^0.1.0

dependency_overrides:
  foo:
    path: ../foo.next

When I run mediator, it does not seem to process the dependency_overrides field. So I can't resolve dependency issues with a local/development version of the foo package.

(Otherwise, this library is great! Much more useful than the output of pub command.)

Stargator commented 6 years ago

This may be an issue related to https://pub.dartlang.org/packages/pubspec, have you confirmed if that package is the cause of the issue?

Stargator commented 6 years ago

After going through the code, I would agree with @cedx this is a mediator issue. @thosakwe I forked and created a branch to work on this issue FYI.

thosakwe commented 6 years ago

@Stargator Are you using Dart 2? In Dart 2, the version solver performs the work of pub_mediator out-of-the-box.

Stargator commented 6 years ago

I'm using Dart 1

thosakwe commented 6 years ago

OK. Let me know if you need any assistance with the PR. I'm almost exclusively using Dart 2 these days, and working on several things, so it might be some time before I can work on pub_mediator.

Stargator commented 6 years ago

No worries, I think I implemented a solution, but just testing it out. I'll have some time tonight or this weekend

Stargator commented 6 years ago

Hmm, I'm having trouble testing my solution. Primarily because I am having trouble getting a PASS from mediator for a dart project that doesn't have any issues.

For example, I created a pubspec.yaml:

environment:
  sdk: '>=1.24.1 <2.0.0'

dev_dependencies:
  test: 0.12.34

And I get the following output:

✗ Found 1 dependency conflict:
You are running Dart SDK version 1.24.3 (Wed Dec 13 23:26:59 2017) on "macos_x64".
  * dart_katas requires SDK >=1.24.1 <2.0.0
  * test->async requires SDK >=2.0.0-dev.23.0 <2.0.0
  * test->shelf_static requires SDK >=2.0.0-dev.55.0 <2.0.0
  * test->shelf_web_socket requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->web_socket_channel requires SDK >=2.0.0-dev.23.0 <2.0.0
  * test->async->collection requires SDK >=2.0.0-dev.55.0 <2.0.0
  * test->stream_channel requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->http_multi_server requires SDK >=2.0.0-dev.55.0 <3.0.0
  * test->shelf requires SDK >=2.0.0-dev.55.0 <2.0.0
  * test->pool requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->barback requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->path requires SDK >=2.0.0-dev.62.0 <2.0.0
  * test->yaml requires SDK >=2.0.0-dev.49.0 <2.0.0
  * test->analyzer requires SDK >=2.0.0-dev <2.0.0
  * test->shelf_packages_handler->package_resolver requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->shelf_static->mime requires SDK >=2.0.0-dev.20.0 <2.0.0
  * test->web_socket_channel->crypto requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->analyzer->watcher requires SDK >=2.0.0-dev.20.0 <2.0.0
  * test->analyzer->html requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->analyzer->html->csslib requires SDK >=2.0.0-dev.17.0 <2.0.0
  * test->analyzer->html->utf requires SDK >=2.0.0-dev.20.0 <2.0.0
Done at 2018-06-22 19:32:55.645960

So I would have expected this to not have any conflicts (the pub get and pub upgrade encounter no issues.

So it's hard for me to use a simple example like this as a control for testing my solution for utilizing overrides.

thosakwe commented 6 years ago

Well, that's the expected behavior; you're running Dart 1, whereas those packages require Dart 2.

Perhaps mediator should keep this in mind, and when encountering versions of a package with an incompatible SDK requirement, skip testing against them entirely?

Stargator commented 6 years ago

But my only dependency is test version "0.12.34", which supports Dart 1. So the problem is that while that version of test supports Dart 1, some of it's dependencies only support dev versions of Dart 2. Why is that possible.

thosakwe commented 6 years ago

I think it's that because Pub Mediator was created before Dart 2, it doesn't check to see whether a package supports Dart 1 before fetching it from Pub.

The way Pub Mediator works is:

In step 2 (get the latest version), what it should do nowawadays is also check whether a package is Dart 1 compatible, if running Dart 1. It doesn't do this yet.