Skip to content

improvements for binary executables #2099

@sigmundch

Description

@sigmundch

I was recently surprised that a package I published failed to install via pub global activate.

My issue was that I had some shared code in libraries within the bin/ folder that are not binaries themselves. When I ran pub global activate I saw that precompilation failed on those libraries. I was surprised by this because the libraries were not listed in the executables section in the pubspect.yaml file and because, during development, activating via path (pub global activate -s path ...) gives no warning of the issue.

My workaround is to move the shared code under bin/src/. However, I wonder:

  • Chould we detect libraries without a main and skip precompilation for those? Or
  • Chould we detect the issue earlier, either when activating a path or when validating a package before it's published?

To reproduce this, try:

pub global activate dart2js_info 0.6.0

and you'll see errors like:

Failed to precompile dart2js_info:deferred_library_check:
Dart_LoadScriptFromKernel: The binary program does not contain 'main'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-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

    Issue actions