Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Issue 301063002: First stab at "pub run" command. (Closed)

Created:
6 years, 6 months ago by Bob Nystrom
Modified:
6 years, 6 months ago
Reviewers:
nweiz
CC:
reviews_dartlang.org
Visibility:
Public.

Description

First stab at "pub run" command. It only runs scripts from the entrypoint package's "bin" directory, but it's a start. BUG=https://code.google.com/p/dart/issues/detail?id=18536 R=nweiz@google.com Committed: https://code.google.com/p/dart/source/detail?r=37292

Patch Set 1 #

Total comments: 33

Patch Set 2 : Revise. #

Patch Set 3 : Fix a few mistakes. #

Total comments: 18

Patch Set 4 : Revise! #

Patch Set 5 : Add TODO. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+569 lines, -145 lines) Patch
M sdk/lib/_internal/pub/bin/pub.dart View 1 1 chunk +5 lines, -7 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart View 1 2 3 2 chunks +10 lines, -9 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/command.dart View 2 chunks +2 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/barback.dart View 1 1 chunk +2 lines, -2 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/build.dart View 1 2 3 2 chunks +2 lines, -5 lines 0 comments Download
A sdk/lib/_internal/pub/lib/src/command/run.dart View 1 1 chunk +93 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/serve.dart View 1 chunk +3 lines, -2 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/log.dart View 1 2 3 6 chunks +83 lines, -54 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/progress.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/_internal/pub/test/pub_test.dart View 1 2 3 chunks +3 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/run/app_can_read_from_stdin_test.dart View 1 2 3 1 chunk +40 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/run/displays_transformer_logs_test.dart View 1 2 3 4 1 chunk +94 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/run/does_not_run_on_transformer_error_test.dart View 1 2 3 1 chunk +64 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/run/errors_if_no_executable_is_given_test.dart View 1 1 chunk +12 lines, -10 lines 0 comments Download
A + sdk/lib/_internal/pub/test/run/nonexistent_script_test.dart View 1 2 3 2 chunks +7 lines, -9 lines 0 comments Download
A sdk/lib/_internal/pub/test/run/passes_along_arguments_test.dart View 1 2 3 1 chunk +32 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/run/runs_a_generated_script_test.dart View 1 2 3 2 chunks +16 lines, -21 lines 0 comments Download
A sdk/lib/_internal/pub/test/run/runs_app_in_entrypoint_test.dart View 1 2 3 1 chunk +34 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/run/runs_the_script_in_checked_mode_test.dart View 1 1 chunk +14 lines, -12 lines 0 comments Download
A + sdk/lib/_internal/pub/test/run/runs_transformer_in_entrypoint_test.dart View 1 2 3 1 chunk +18 lines, -11 lines 0 comments Download
A sdk/lib/_internal/pub/test/run/utils.dart View 1 2 3 1 chunk +32 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/test/version_solver_test.dart View 1 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
Bob Nystrom
6 years, 6 months ago (2014-05-29 00:39:42 UTC) #1
nweiz
I'd also like to see tests for: * A transformer error. * A transformer log ...
6 years, 6 months ago (2014-05-29 19:30:08 UTC) #2
Bob Nystrom
> * A transformer error. > * A transformer log message. > * An executable ...
6 years, 6 months ago (2014-05-30 18:17:46 UTC) #3
Bob Nystrom
Now that I think we're mostly in the clear for 1.5, friendly ping to get ...
6 years, 6 months ago (2014-06-10 19:57:26 UTC) #4
nweiz
https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart File sdk/lib/_internal/pub/lib/src/command/run.dart (right): https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart#newcode70 sdk/lib/_internal/pub/lib/src/command/run.dart:70: // Wire up pub's pipes to the spawned process. ...
6 years, 6 months ago (2014-06-10 20:20:19 UTC) #5
Bob Nystrom
Thanks! https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart File sdk/lib/_internal/pub/lib/src/command/run.dart (right): https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart#newcode70 sdk/lib/_internal/pub/lib/src/command/run.dart:70: // Wire up pub's pipes to the spawned ...
6 years, 6 months ago (2014-06-11 18:07:34 UTC) #6
nweiz
lgtm https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart File sdk/lib/_internal/pub/lib/src/command/run.dart (right): https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart#newcode70 sdk/lib/_internal/pub/lib/src/command/run.dart:70: // Wire up pub's pipes to the spawned ...
6 years, 6 months ago (2014-06-12 01:17:37 UTC) #7
Bob Nystrom
Thanks! https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart File sdk/lib/_internal/pub/lib/src/command/run.dart (right): https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart#newcode70 sdk/lib/_internal/pub/lib/src/command/run.dart:70: // Wire up pub's pipes to the spawned ...
6 years, 6 months ago (2014-06-12 21:17:50 UTC) #8
Bob Nystrom
Committed patchset #5 manually as r37292 (presubmit successful).
6 years, 6 months ago (2014-06-12 21:22:37 UTC) #9
nweiz
https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart File sdk/lib/_internal/pub/lib/src/command/run.dart (right): https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart#newcode70 sdk/lib/_internal/pub/lib/src/command/run.dart:70: // Wire up pub's pipes to the spawned process. ...
6 years, 6 months ago (2014-06-12 21:22:53 UTC) #10
Bob Nystrom
On 2014/06/12 21:22:53, nweiz wrote: > https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart > File sdk/lib/_internal/pub/lib/src/command/run.dart (right): > > https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/src/command/run.dart#newcode70 > ...
6 years, 6 months ago (2014-06-12 21:49:47 UTC) #11
nweiz
6 years, 6 months ago (2014-06-12 22:29:32 UTC) #12
Message was sent while issue was closed.
On 2014/06/12 21:49:47, Bob Nystrom wrote:
> On 2014/06/12 21:22:53, nweiz wrote:
> >
>
https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/sr...
> > File sdk/lib/_internal/pub/lib/src/command/run.dart (right):
> > 
> >
>
https://codereview.chromium.org/301063002/diff/1/sdk/lib/_internal/pub/lib/sr...
> > sdk/lib/_internal/pub/lib/src/command/run.dart:70: // Wire up pub's pipes to
> the
> > spawned process.
> > On 2014/06/12 21:17:50, Bob Nystrom wrote:
> > > On 2014/06/12 01:17:37, nweiz wrote:
> > > > On 2014/06/11 18:07:33, Bob Nystrom wrote:
> > > > > On 2014/06/10 20:20:18, nweiz wrote:
> > > > > > On 2014/05/30 18:17:47, Bob Nystrom wrote:
> > > > > > > On 2014/05/29 19:30:09, nweiz wrote:
> > > > > > > > File a bug against dart:io to support "exec()" on applicable
> > platforms
> > > > and
> > > > > > add
> > > > > > > a
> > > > > > > > TODO to use it here.
> > > > > > > 
> > > > > > > I could be wrong, but I don't think we'd be able to use exec()
here,
> > > even
> > > > if
> > > > > > > supported. We need pub to stick around so that it can continue to
> > serve
> > > > the
> > > > > > Dart
> > > > > > > files that the spawned VM imports.
> > > > > > 
> > > > > > There's a trick to making it work, although we'll also need fork()
> which
> > I
> > > > > > forgot to mention. We fork the process, serve the assets from the
> forked
> > > > > child,
> > > > > > and call exec in the parent process.
> > > > > > 
> > > > > > That said, any sort of process spawning will only work with HTTP
> > imports,
> > > > not
> > > > > > import hooks. Why aren't we just spawning an isolate here?
> > > > > 
> > > > > I figured we're eventually want to support running non-Dart
executables
> > > (shell
> > > > > scripts, etc.) from other packages too, so spawning a process seemed
> more
> > > > > amenable for that.
> > > > 
> > > > Okay, but for Dart processes we'll definitely need to use isolates so we
> can
> > > > control the imports, right?
> > > 
> > > Do you mean non-package absolute path imports?
> > 
> > No, I mean any imports that go through barback.
> > 
> > > The "package:" ones are handled here. Since we spawn it with an HTTP
> > entrypoint,
> > > all of the "package:" imports are resolved relative to that and bounce
back
> to
> > > pub so we can handle them.
> > 
> > For now, yes, but HTTP imports are going away. 
> 
> You get your $20 yet? :)
> 
> > Why design towards them?
> 
> There's not much code based on them here, it was just the simplest
> implementation that worked. I don't think it would be too hard to switch to an
> isolate later.

I'm mostly worried about the user-visible differences between running in the
top-level process vs running in a nested process, such as the stdio stuff I
mentioned above. I don't want users to get the impression that they can't use
[stdioType] in a "pub run" process.

Powered by Google App Engine
This is Rietveld 408576698