@@ -48,52 +48,43 @@ void main() async {
4848 final result = await _runDartdev (
4949 fromDartdevSource,
5050 'run' ,
51- ['--help' ],
51+ ['--help' , '-v' ],
5252 null ,
5353 {},
5454 );
55+ print (result.stdout);
5556 expect (
5657 result.stdout,
57- stringContainsInOrder (
58- [
59- '''Run a Dart program from a file, a local package, or a remote package.
60-
61- Usage: dart [vm-options] run [arguments] [<dart-file>|<local-package>|<remote-executable> [args]]
62- ''' ,
63- '''
64- <remote-executable>
65- An executable from a remote package. This can be from a hosted package server
66- (like pub.dev) or a git repository.
67-
68- When running a remote executable, all other command-line flags are disabled,
69- except for the options for remote executables. `dart run <remote-executable>`
70- uses `dart install` under the hood and compiles the app into a standalone
71- executable, preventing passing VM options.
72-
73- From a hosted package server:
74- <hosted-url>/<package>[@<version>][:<executable>]
75-
76- Downloads the package from a hosted package server and runs the specified
77- executable.
78- If a version is provided, the specified version is downloaded.
79- If an executable is not specified, the package name is used.
80- For example, `https://pub.dev/[email protected] :dcli_complete` runs the 81- `dcli_complete` executable from version 1.0.0 of the `dcli` package.
82-
83- From a git repository:
84- <git-url>[:<executable>]
85-
86- Clones the git repository and runs the specified executable from it.
87- If an executable is not specified, the package name from the cloned
88- repository's pubspec.yaml is used.
89- The git url can be any valid git url.
90- ''' ,
91- '''
92- Options for remote executables:
93- --git-path Path of git package in repository. Only applies when using a git url for <remote-executable>.
94- --git-ref Git branch or commit to be retrieved. Only applies when using a git url for <remote-executable>.
95- '''
96- ],
58+ contains (
59+ '''
60+ --enable-experiment-remote-run Enables running executables from remote packages.
61+
62+ When running a remote executable, all other command-line flags are disabled,
63+ except for the options for remote executables. `dart run <remote-executable>`
64+ uses `dart install` under the hood and compiles the app into a standalone
65+ executable, preventing passing VM options.
66+
67+ (Syntax is expected to change in the future.)
68+
69+ From a hosted package server:
70+ <hosted-url>/<package>[@<version>][:<executable>]
71+
72+ Downloads the package from a hosted package server and runs the specified
73+ executable.
74+ If a version is provided, the specified version is downloaded.
75+ If an executable is not specified, the package name is used.
76+ For example, `https://pub.dev/[email protected] :dcli_complete` runs the 77+ `dcli_complete` executable from version 1.0.0 of the `dcli` package.
78+
79+ From a git repository:
80+ <git-url>[:<executable>]
81+
82+ Clones the git repository and runs the specified executable from it.
83+ If an executable is not specified, the package name from the cloned
84+ repository's pubspec.yaml is used.
85+ The git url can be any valid git url.
86+ --git-path Path of git package in repository. Only applies when using a git url for <remote-executable>.
87+ --git-ref Git branch or commit to be retrieved. Only applies when using a git url for <remote-executable>.''' ,
9788 ),
9889 );
9990 });
@@ -117,6 +108,7 @@ Options for remote executables:
117108 fromDartdevSource,
118109 'run' ,
119110 [
111+ '--enable-experiment-remote-run' ,
120112 'https://pub.dev/$_packageForTest $version :$_cliToolForTest ' ,
121113 // Make sure to pass arguments that influence stdout.
122114 'compare' ,
@@ -153,6 +145,7 @@ Options for remote executables:
153145 final (gitUri, gitRef) = await _setupSimpleGitRepo (tempUri);
154146 final gitPath = './' ;
155147 final arguments = [
148+ '--enable-experiment-remote-run' ,
156149 if (testArguments.contains ('--git-path' )) ...[
157150 '--git-path' ,
158151 gitPath,
@@ -199,22 +192,34 @@ Options for remote executables:
199192
200193 final errorArgumentss = [
201194 (
202- ['https://pub.dev/this_package_does_not_exist_12345' ],
195+ [
196+ '--enable-experiment-remote-run' ,
197+ 'https://pub.dev/this_package_does_not_exist_12345'
198+ ],
203199 'could not find package this_package_does_not_exist_12345 at' ,
204200 errorExitCode,
205201 ),
206202 (
207- ['--git-path' , 'foo/' , 'https://pub.dev/vm_snapshot_analysis' ],
203+ [
204+ '--enable-experiment-remote-run' ,
205+ '--git-path' ,
206+ 'foo/' ,
207+ 'https://pub.dev/vm_snapshot_analysis'
208+ ],
208209 'git-path' ,
209210 usageExitCode,
210211 ),
211212 (
212- ['--enable-asserts' , 'https://pub.dev/vm_snapshot_analysis' ],
213+ [
214+ '--enable-experiment-remote-run' ,
215+ '--enable-asserts' ,
216+ 'https://pub.dev/vm_snapshot_analysis'
217+ ],
213218 'enable-asserts' ,
214219 usageExitCode,
215220 ),
216221 (
217- ['--git-path' , 'foo/' ],
222+ ['--enable-experiment-remote-run' , '-- git-path' , 'foo/' ],
218223 'git-path' ,
219224 usageExitCode,
220225 ),
@@ -292,7 +297,10 @@ void main(List<String> args) async {
292297 final runResult = await _runDartdev (
293298 fromDartdevSource,
294299 'run' ,
295- ['${gitUri .toFilePath ()}:$packageName ' ],
300+ [
301+ '--enable-experiment-remote-run' ,
302+ '${gitUri .toFilePath ()}:$packageName '
303+ ],
296304 null ,
297305 environment,
298306 expectedExitCode: errorExitCode,
@@ -309,6 +317,7 @@ void main(List<String> args) async {
309317 final (gitUri, gitRef) = await _setupSimpleGitRepo (tempUri);
310318
311319 final arguments = [
320+ '--enable-experiment-remote-run' ,
312321 '--git-ref' ,
313322 gitRef,
314323 '${gitUri .toFilePath ()}:$_gitPackageForTest ' ,
@@ -368,6 +377,7 @@ void main(List<String> args) async {
368377 );
369378
370379 final arguments = [
380+ '--enable-experiment-remote-run' ,
371381 if (verbosityError) '--verbosity=error' ,
372382 '--git-ref' ,
373383 gitRef,
0 commit comments