Skip to content

pub run can't run a bin script in a transitive dependencies #21

Closed
@DartBot

Description

@DartBot

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="96" height="96"hspace="10"> Issue by sethladd
Originally opened as dart-lang/sdk#23426


Testing out pub run's ability to run scripts. It appears that it's unable to run a script in a dependency's dependency.

Setup:

package A
  depends on package B

package B
  depends on dartdoc

I tried running with pub run dartdoc:dartdoc from package A

Output/error:

Package "dartdoc" is not an immediate dependency.
Cannot run executables in transitive dependencies.

Activity

DartBot

DartBot commented on Jun 4, 2015

@DartBot
Author
added
type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
closed-as-intendedClosed as the reported issue is expected behavior
on Jun 4, 2015
DartBot

DartBot commented on Jun 4, 2015

@DartBot
Author

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


As the error message indicates, this is deliberate. Packages don't automatically make their transitive dependencies part of their own public API, and that philosophy extends to binaries. If A depends on B, that's an implementation detail of A, and not something that should be exposed to all consumers. That includes any binaries B may contain.


cc @nex3.
Added AsDesigned label.

DartBot

DartBot commented on Jun 4, 2015

@DartBot
Author

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd


Thanks for the detailed explanation. We'll wrap the script from the developer-facing dependency.

DartBot

DartBot commented on Jun 4, 2015

@DartBot
Author

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


Keep in mind that if you're exporting the public API of another package, including its executables, your package should have a very narrow constraint on the package you're exporting. For example, if A exports B and the latest version of B is 1.0.0, A should have the constraint ">=1.0.0 <1.1.0" for B. Otherwise, A is unable to guarantee that its API will be stable in the way its versions indicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-as-intendedClosed as the reported issue is expected behaviortype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @DartBot

        Issue actions

          pub run can't run a bin script in a transitive dependencies · Issue #21 · dart-lang/pub