Skip to content

Proposal: Have dart run <file.dart> do resolution #55548

@sigurdm

Description

@sigurdm

Background

Currently

> dart run <package>[:<executable>]

will ensure that resolution and .dart_tool/package_config.json in the current working dir is up to date, and then find bin/<executable>.dart relative to the <package> package dir.

As part of the workspace work, we will search in parent directories to current working dir

However:

> dart run path/to/file.dart

Will pass path/to/file.dart directly to the VM without doing any resolution. The package will be run with the nearest enclosing .dart_tool/package_config.dart to path/to and no snapshotting is done. This corresponds to running dart path/to/file.dart (though it is slower because it enters the dartdev command-line handling).

Proposal

Let dart run path/to/file.dart search for a .dart_tool/package_config.json (or, failing that a pubspec.yaml) enclosing path/to, ensuring the resolution is up-to-date and doing the same snapshotting it would do for dart run <package>:<executable>.

This will slightly change the current observed behavior, and could be considered a bug fix or a breaking change depending on how you look at it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.dart-cli-runIssues related to 'dart run'

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions