Coder Social home page Coder Social logo

Comments (4)

devoncarew avatar devoncarew commented on August 17, 2024

My understanding of dependency_overrides is that is should force constraint resolution to use the indicated version (https://dart.dev/tools/pub/dependencies#dependency-overrides), irrespective of the version constraint specified in either your direct dependencies: section or the version constraint from any direct or transitive dep.

Can you confirm that you are seeing something different from this? Preferably via a minimal repro. Thanks!

from sdk.

lukehutch avatar lukehutch commented on August 17, 2024

@devoncarew Correct, based on the current usage of dependency_overrides, which affects only the dependencies of your own project.

I am proposing augmenting the pubspec.yaml syntax to add a new dependency_overrides section as a child of any dependency, so that the dependencies of the dependency can be forced to a specific version.

The "repro" is the bug report I linked. Basically, tyr depending upon firebase_admin: ^0.2.0 and http: ^1.0.0 in the same project, and you will see the problem. firebase_admin is compatible with http: ^1.0.0, but its own dependency on this is http: ^0.13.0, so you cannot use if your project needs http: ^1.0.0 (possibly because another dependency you are using depends upon it), you can't build your project, even though all the code would compile and work just fine with http: ^1.0.0.

Therefore, currently the only fix is to fork the firebase_admin project, change your fork's dependency to http: '>=0.13.0 <2.0.0', then change your project to depend upon your fork. This is a pain in the butt, and leads to a lot of different projects having to fork the same project just to get their build dependencies to resolve.

What I am proposing is allowing the user to override the version requirement of any dependency of any dependency of your project. This is not what dependency_overrides currently does. Look where I wrote dependency_overrides in the yaml example I gave. Currently you can't use dependency_overrides there. I am proposing that it should be allowed, for dependency-specific transitive dependency overrides.

from sdk.

devoncarew avatar devoncarew commented on August 17, 2024

@devoncarew Correct, based on the current usage of dependency_overrides, which affects only the dependencies of your own project.

To be clear, is does affect the transitive dependencies. dependency_overrides can be and is used to work around the problem of a dep not updating one of it's own dependencies. dependency_overrides lets you ignore the version constraints that your pubspec + transitive deps would otherwise impose on that dep.

https://github.com/dart-lang/sdk/wiki/Flutter-Pinned-Packages#i-see-issues-through-one-of-my-dependencies-but-they-cant-immediately-release-a-new-version mentions this as a way to get around periodic issues with flutter pinned packages.

from sdk.

lukehutch avatar lukehutch commented on August 17, 2024

To be clear, is does affect the transitive dependencies.

Ah, OK, thank you for explaining that. I jumped to the conclusion that I couldn't override dependencies in other packages using a directive in my own package. Thanks, I'll close this!

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.