Skip to content

Add pub get|upgrade|downgrade --json that prints errors in a machine-readable format #4840

Description

@srawlins

The analysis server runs dart pub get (or upgrade) in a synthetic pub package directory for analyzer plugins. If that command fails (like a plugin has a version constraint of it's dependency on analysis_server_plugin which is incompatible with DAS's constraint, or two plugins have incompatible constraints of their dependencies on analysis_server_plugin, etc.) then DAS just takes the stderr/stdout and dumps it to the user, like if they are executing dart analyze.

A user pointed out, dart-lang/sdk#63568, that much of the recommendations in the error text are inapplicable to the user, and actively lead them astray.

It would be great if DAS could instead call dart pub get --json or something similar, which would spit out its errors in a machine-readable format.

(Alternatively, DAS could execute dart pub get via a programmatic API, but I'm unaware that one exists. That would probably be faster and we'd have more fine-grained control. I'm sure that's a huge ask if it's not available today.)

CC @bwilkerson @keertip

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions