Skip to content

support or complain if pub run my_bin_script depends on dev-dependencies #20982

Closed
@sigmundch

Description

@sigmundch

This feature request summarizes a discussion Natalie, Kevin, and I had last week.

Most people are surprised if in package a you do:

  pub run foo

and it works, but when running it in package b, as:

  pub run a:foo

it fails.

This typically happens if foo uses code from dev_dependencies.

This feature request is to make pub run foo work the same everywhere. We discussed several ideas for how to do this:

a) make pub-run/pub-get use the dev-dependencies of package a and when executing foo:a.

b) like (a), but to keep things cleaner we could add a third dependency section: bin_dependencies (since dev_dependencies are really just for developers of the package).

c) force using just dependencies and not dev_dependencies when executing in pub-run. This will make pub run foo fail locally and users will realize that they need to change a dev_dependency as a normal dependency.

Our conclusions were that probably (c) is the simplest. But (b) might reduce the number of false-positives for version conflicts - if a tool in bin/ uses a dependency but it doesn't require it to be the same that is used in the library of another package, then there is no conflict. Those two pieces of code will never be able to depend on each other anyways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions