Pub: Implement `--preview-dart-2` option for `pub run`

Created on 21 Feb 2018  Â·  21Comments  Â·  Source: dart-lang/pub

_From @aam on February 17, 2018 1:41_

Are there plans to implement --preview-dart-2 option for pub run?

See https://github.com/flutter/flutter/pull/14728#discussion_r168903155 for context.

_Copied from original issue: dart-lang/sdk#32214_

blocked enhancement pub run

All 21 comments

_From @kevmoo on February 20, 2018 17:33_

Related to https://github.com/dart-lang/sdk/issues/32188

_From @kevmoo on February 20, 2018 17:34_

CC @a-siva

I'd love to add this, but we need support from the isolate library first. I've filed https://github.com/dart-lang/sdk/issues/32253 to track that.

Could we have an API to ask pub for the entrypoint rather than have it run it itself?

That way we could do something like dart --preview-dart-2 $(pub run --find_entrypoint some_package)

We could, but that invocation wouldn't just work. The entrypoint is likely to be somewhere that automated package resolution won't work, so you'd have to run something more like dart --preview-dart-2 --packages=.packages $(pub run --find-entrypoint some_package). I'd really like to provide a more streamlined option than that.

I'd be super happy to have that option, even outside of the --preview-dart-2 discussion. It would also give us an opportunity to run this code in our own isolate.

@natebosch Maybe we should discuss this on another issue? I'd be interested in hearing your use-cases.

Discussed with @a-siva, and it sounds like if pub were made to be Dart 2 compliant, then dart-lang/sdk#32253 wouldn't be needed, because pub could start in Dart 2, in which case all of its spawned isolates would start in Dart 2 as well.

If this is correct, I'm surprised that pub isn't _already_ Dart 2 compliant, with all the work that we've been asking of our ecosystem to migrate to Dart 2 compatibility.

/cc @leafpetersen

Dart 2 compliance for pub is blocked on Dart 2 compliance for dart2js and for the analyzer.

Dart 2 compliance for pub is blocked on Dart 2 compliance for dart2js and for the analyzer.

After https://github.com/dart-lang/pub/issues/1857 – it'd just be analyzer, right?

If this is correct, I'm surprised that pub isn't already Dart 2 compliant, with all the work that we've been asking of our ecosystem to migrate to Dart 2 compatibility.

In fairness, most folks have been too busy helping the ecosystem migrate, but yes, it's more than a little embarrassing that we haven't migrated all of our own code yet. :}

Just a related question: I have Dart v1 installed on my system and dart and pub are in PATH for regular commands. I also installed Dart v2 in /opt/dart-v2. Now, when I run /opt/dart-v2/bin/pub run test in a project, does it use the Dart v2 executable in /opt/dart-v2/bin/dart, or the default dart in PATH?

@stevenroose I have the same question, I seem to remember pub using whatever the $DART_SDK variable is set to...

edit: this is only for the reflectable package. See the comment below.

The pub executable should use the Dart VM from it's own SDK. So if you run /opt/dart-v2/bin/pub you'll be using /opt/dart-v2/bin/dart vm.

To be clear, though, just running with a Dart VM from a 2.0.0-dev SDK doesn't give you full Dart 2 semantics. By default, you'll still be running in Dart 1 mode unless you pass the --preview-dart-2 option to the VM, which currently doesn't work for pub.

I does work (a bit) w/ SDK @ HEAD. Enough to run pub get, pub run test, etc

On Sat, May 19, 2018 at 6:25 AM Natalie Weizenbaum notifications@github.com
wrote:

To be clear, though, just running with a Dart VM from a 2.0.0-dev SDK
doesn't give you full Dart 2 semantics. By default, you'll still be running
in Dart 1 mode unless you pass the --preview-dart-2 option to the VM,
which currently doesn't work for pub.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dart-lang/pub/issues/1807#issuecomment-390404812, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AABCivujnP8j8FKmWxs0vZg0wtGRTtEKks5t0B1dgaJpZM4SM26l
.

Has this landed (in an externally released SDK)?

> pub run -h
Run an executable from a package.

Usage: pub run <executable> [args...]
-h, --help            Print this usage information.
-c, --[no-]checked    Enable runtime type checks and assertions.

Run "pub help" to see global options.

That reminds me, --[no-]checked should be removed/replaced.

You can run DART_VM_OPTIONS=--preview-dart-2 pub run... with latest -dev

That reminds me, --[no-]checked should be removed/replaced.

@chalin – please open an issue!

CC @grouma – might be good to hold v1 for this?

Done: #1922

Given that Dart 2 stable is out, this can be closed, right? /cc @kwalrath

Yup!

On Thu, Aug 16, 2018 at 9:30 AM Nate Bosch notifications@github.com wrote:

Closed #1807 https://github.com/dart-lang/pub/issues/1807.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dart-lang/pub/issues/1807#event-1792832021, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AABCirZuSEiu92Rzp0__pUAWcV1SSMlFks5uRZ4QgaJpZM4SM26l
.

Was this page helpful?
0 / 5 - 0 ratings