Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement --preview-dart-2 option for pub run #1807

Closed
nex3 opened this issue Feb 20, 2018 · 21 comments
Closed

Implement --preview-dart-2 option for pub run #1807

nex3 opened this issue Feb 20, 2018 · 21 comments
Labels
status-blocked Blocked from making progress by another (referenced) issue type-enhancement A request for a change that isn't a bug

Comments

@nex3
Copy link
Member

nex3 commented Feb 20, 2018

From @aam on February 17, 2018 1:41

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

See flutter/flutter#14728 (comment) for context.

Copied from original issue: dart-lang/sdk#32214

@nex3
Copy link
Member Author

nex3 commented Feb 20, 2018

From @kevmoo on February 20, 2018 17:33

Related to dart-lang/sdk#32188

@nex3
Copy link
Member Author

nex3 commented Feb 20, 2018

From @kevmoo on February 20, 2018 17:34

CC @a-siva

@nex3
Copy link
Member Author

nex3 commented Feb 20, 2018

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

@nex3 nex3 added type-enhancement A request for a change that isn't a bug status-blocked Blocked from making progress by another (referenced) issue pub run labels Feb 20, 2018
@natebosch
Copy link
Member

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)

@nex3
Copy link
Member Author

nex3 commented Feb 21, 2018

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.

@natebosch
Copy link
Member

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.

@nex3
Copy link
Member Author

nex3 commented Feb 21, 2018

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

@tvolkert
Copy link

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

@nex3
Copy link
Member Author

nex3 commented Apr 12, 2018

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

@kevmoo
Copy link
Member

kevmoo commented Apr 12, 2018

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

After #1857 – it'd just be analyzer, right?

@leafpetersen
Copy link
Member

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. :}

@stevenroose
Copy link

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?

@johnpryan
Copy link

johnpryan commented May 14, 2018

@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.

@natebosch
Copy link
Member

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.

@nex3
Copy link
Member Author

nex3 commented May 19, 2018

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.

@kevmoo
Copy link
Member

kevmoo commented May 19, 2018 via email

@chalin
Copy link

chalin commented Jun 15, 2018

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.

@kevmoo
Copy link
Member

kevmoo commented Jun 15, 2018

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?

@chalin
Copy link

chalin commented Jun 15, 2018

Done: #1922

@chalin
Copy link

chalin commented Aug 16, 2018

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

@kevmoo
Copy link
Member

kevmoo commented Aug 16, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status-blocked Blocked from making progress by another (referenced) issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

8 participants