Commit Graph

154 Commits

Author SHA1 Message Date
Paul Berry 58dc586929 Remove redundant line number from referencedBeforeDeclaration.
Context messages are already displayed in a way that makes it easy for
the user to locate the line of code in question; it's unnecessary to
include the line number in the context message itself.

See discussion at
https://buganizer.corp.google.com/issues/179782591#comment9.

Change-Id: I2d1383c4cee0ece0d302449302d1f1902fbf136c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-24 14:07:51 +00:00
Ben Konyi a49bea950d [ CLI ] Use 'project' instead of 'package' in CLI help messages
Initial updates, related to
https://github.com/dart-lang/sdk/issues/45279.

Change-Id: I459e719ad6e92378f9240a612e0bd8229d0fcb2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192727
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-03-23 23:05:33 +00:00
Brian Wilkerson bd19cbf1d2 Add a json format to the dart analyze command
Change-Id: I5667d845d305fa087934f73fbf09cc9b166c8461
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192240
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-03-23 18:21:51 +00:00
Konstantin Shcheglov 1712737dea Support for single file analysis in 'dart analyze'.
Bug: https://github.com/dart-lang/sdk/issues/43891
Bug: https://github.com/dart-lang/sdk/issues/43271
Change-Id: Ifb3c0c10eabaabb19777838bccf7851199b8c778
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-11 17:21:50 +00:00
Ben Konyi 8bd3088588 [ CLI ] Update analytics messaging
Fixes https://github.com/dart-lang/sdk/issues/45252

Change-Id: I38d4d0b1abde8c2fa3cd7ed3ed1014453bcc6744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190540
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Franklin Yow <frankyow@google.com>
2021-03-10 19:44:44 +00:00
Devon Carew bb3167fe53 [analyzer] always show context messages for 'dart analyze'
Change-Id: Ifda063de48a968f7ef013c501f6db9bec7f13246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188001
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-04 01:00:16 +00:00
Sigurd Meldgaard e7fdd7b693 Let experimental features specify an example for tooling to have generic
tests.

Bug: https://github.com/dart-lang/sdk/issues/44937
Change-Id: I309e6e4299b09705f653d59c7842a05fdf7cdaa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184790
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-02-23 13:57:29 +00:00
Ben Konyi 410f242ebc [ CLI ] Fix issue where analytics were not correctly being disabled
Fixes https://github.com/dart-lang/sdk/issues/45077

TEST=VM -> CLI --analytics flag smoke test in analytics_test.dart

Change-Id: Ic8d796fbc21402adfde72e9697124e144a417260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186381
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-02-22 20:27:29 +00:00
William Hesse 88b6c207e7 [dartdev] Fix analytics test on Windows
The default Process.runSync doesn't expect utf-8 on stdout on Windows.

Fixes: https://github.com/dart-lang/sdk/issues/44981
Change-Id: If80fcaa9ce54fdd64c2c8f40779c646f1c37fdea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184468
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-02-12 18:37:52 +00:00
Lasse R.H. Nielsen d352bc28b8 Remove (most) uses of the "non-nullable" experiment flag.
Since the flag is now enabled by default, there should be no mention of it.
There are still some uses in front_end/testcases that are not just removable
(it also uses `no-non-nullable`). There migth be more uses that are not
as easily found as grepping for `--enable-experiment

Removes two VM tests where fixing them meant they were just duplicating
the corresponding non *_2/ tests.
Fixes #44941

TEST= Large number of tests chaged.=(no-)?non-nullable`.

Change-Id: Ief755981ccde9a5482fcdf408c2929c74433a710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183688
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-12 17:16:54 +00:00
Ben Konyi 7ce8e3ba2e [ DartDev / CLI ] Fixed issue where analytics flags were not being forwarded to the CLI
Forwarding logic seems to have been accidentally removed in
f3fe9dc3b3.

Fixes https://github.com/dart-lang/sdk/issues/44968

TEST=pkg/dartdev/test/analytics_test.dart

Fixed: 44968
Change-Id: Ib3c107233276ca6592247e23268f9af7ede52285
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184502
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-02-11 18:45:06 +00:00
Devon Carew 6e9ba7f66a [dart analyze] tweak the context message presentation for dart analyze
Change-Id: I27dc1317b2dba3a1ff23a46b4db5d32405aa8aa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184104
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-02-10 16:57:53 +00:00
Ben Konyi 848121e6d4 Reland "[ CLI ] Improved consistency of -D and --define across tools and commands"
- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

This reverts commit e49937769f.

Change-Id: I5f9275b829665eb5e8695403d67f230e752ab0e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183180
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 23:53:28 +00:00
Alexander Markov 55daf05f4f Add --[no-]sound-null-safety option to dart2native and dart compile exe
Fixes https://github.com/dart-lang/sdk/issues/44553

Change-Id: Id461550e7761d874719220a5cb7a6b2c9ac421a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181020
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-01-26 19:16:30 +00:00
asiva ac520f984d [ VM / CLI ] Add --verbosity to VM options
The verbosity option allows for specifying the CFE output verbosity

Fixes https://github.com/dart-lang/sdk/issues/44727

TEST=existing tests compile_test.dart and run_test.dart have new tests

Change-Id: I3d4e50811f84650aacf774ddb370a6eb765b9b24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181100
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-01-26 03:01:58 +00:00
Johnni Winther 97a4280e52 [cfe,dartdev,dart2js] Add support for --verbosity option
In response to https://github.com/dart-lang/sdk/issues/44727

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I56b67d9362a415acd721c1cce2f7e2232d2493df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180566
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-22 18:33:44 +00:00
Johnni Winther 55b34a467c Reland "[vm] Pass snapshot flag to kernel_service"
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: Id9e72751068d5f208055ab953d2c8392e84c4798
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180187
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-21 21:18:32 +00:00
Johnni Winther 134a43707f [cfe] Update compiling without sound null safety message
In response to https://github.com/dart-lang/sdk/issues/44234#issuecomment-763455719

Change-Id: I88ab66199217e817edead394ccc74a3f3b49ba15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180143
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-20 15:53:25 +00:00
Devon Carew dbe5039f15 [dartdev] remove the disclaimer for dart fix
Change-Id: Id1a2cc48c30e50850d79e26d39783b5c8ea03b4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180040
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-01-19 19:28:12 +00:00
Aske Simon Christensen 903e92a196 Revert "[vm] Pass snapshot flag to kernel_service"
This reverts commit f8b0d26cc3.

Reason for revert: Multiple test failures in app-jit and simarm(64)

Original change's description:
> [vm] Pass snapshot flag to kernel_service
>
> Enable reporting of null safety compilation mode when running
> `dart compile aot-snapshot`, `dart compile jit-snapshot`,
> and `dart compile kernel`.
>
> Closes #44234
>
> TEST=pkg/dartdev/test/commands/compile_test.dart
>
> Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,johnniwinther@google.com

Change-Id: I83aeaa8620c640d02d5ccfd1fe8112d8209a9ad4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179773
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-18 21:00:03 +00:00
Johnni Winther f8b0d26cc3 [vm] Pass snapshot flag to kernel_service
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-01-18 09:27:59 +00:00
Devon Carew 44cee12ebe [dartdev] skip a failing test on windows
Bug: https://github.com/dart-lang/sdk/issues/44679
Change-Id: Ibbb41f56ff8ee20567986a4497d14f43392acf90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179740
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-01-18 00:58:49 +00:00
Johnni Winther cad04f8604 [cfe,dart2js,dartdev] Show null safety mode for dart compile
This adds a new messages kind 'info' to the CFE for showing general
information during compilation. A 'configuration' options is added
to `CompilerOptions` for telling the CFE how it is run.

The configuration 'compile' is added for when the CFE is invoked to
produces an "executable" as when running `dart compile`. When
configuration is set, the CFE emits an info message about the
null safety compilation mode.

Support for `dart compile exe` and `dart compile js` is added in this
CL. Support for `dart compile kernel|app-jit|aot` is not included.

In response to https://github.com/dart-lang/sdk/issues/44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I08f51e2a3f5ad4841c4d703bcd266b7afb63c7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178982
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-15 11:28:13 +00:00
Ben Konyi e49937769f Revert "[ CLI ] Improved consistency of -D and --define across tools and"
This reverts commit e83e78431f.

Reason for revert: Failing on SIMARM and AOT bots

Original change's description:
> [ CLI ] Improved consistency of -D and --define across tools and
> commands
>
> - Added support for --define to the VM and dart2js
> - Added support for -D and --define for `dart run` and `dart compile js`
>
> Remaining improvements:
> - Add support for providing multiple comma separated values for `dart
>   run`, `dart`, and `dart2js`
>
> Related issue: https://github.com/dart-lang/sdk/issues/44562
>
> TEST=Updated CLI tests and added new dart2js tests.
>
> Change-Id: I9379c7aee1eab377adb3438393d9ad79c4938cc4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178262
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,asiva@google.com,sigmund@google.com

Change-Id: I1c594ae7db551619cc3191ff7f832c4fc61a4171
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179081
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-01-14 01:05:29 +00:00
Ben Konyi e83e78431f [ CLI ] Improved consistency of -D and --define across tools and
commands

- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

Change-Id: I9379c7aee1eab377adb3438393d9ad79c4938cc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178262
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-01-13 23:33:17 +00:00
Ben Konyi c42c76f590 [ VM / CLI ] Run DartDev isolate from snapshot when possible
This change tries to run from dartdev.dart.snapshot and falls back to
running from dartdev.dill if incompatible VM flags are provided.

Fixes https://github.com/dart-lang/sdk/issues/43969

Performance results:

dart test.dart (no CLI isolate): 0.167s
dart run test (from snapshot):   0.208s
dart run test (from kernel):     0.326s

TEST=pkg/dartdev/test/load_from_dill_test.dart

Change-Id: I3195886b86676580ef2a0221f0284328964ef061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178300
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-01-11 19:41:50 +00:00
Devon Carew ad3c3644a4 Add an initial version of a 'dart language-server' command.
Change-Id: Iffb8dedf7419a421e5282e09b4584e768c47e53f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176485
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-06 18:14:51 +00:00
Sigurd Meldgaard 8a71e75a46 Detect pubspec presence and dependency on package:test from dart test --help
One shortcoming is that `dart help test` doesn't follow the same rules.
This is harder to address.

Bug:https://github.com/dart-lang/sdk/issues/44369
Change-Id: Idb5b86251ebbe71ecb70292ee93d26b3d71263fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175060
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2021-01-05 14:09:39 +00:00
Brian Wilkerson b0efb3738f Add enhanced testing support for dart fix
Change-Id: I8cf49b85142c242597542eae9306eb09be5e4149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175920
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-12-12 16:46:10 +00:00
pq 9cc78dce1f tweak description/disclaimer
Removes API migration from the description and ensures the disclaimer appears when run in a help context.

Sample output:


```
$ dart bin/dartdev.dart fix
Fix Dart source code.

This tool looks for and fixes analysis issues that have associated automated fixes.

To use the tool, run either 'dart fix --dry-run' for a preview of the proposed changes for a project, or
'dart fix --apply' to apply the changes.

Note: The `fix` command is provisional and subject to change or removal in future releases. Feedback is
welcome!

Usage: dart fix [arguments]
-h, --help       Print this usage information.
-n, --dry-run    Preview the proposed changes but make no changes.
    --apply      Apply the proposed changes.

Run "dart help" to see global options.

$ dart bin/dartdev.dart fix -n

Note: The `fix` command is provisional and subject to change or removal in future releases. Feedback is welcome!

Computing fixes in dartdev (dry run)... 15.2s
Nothing to fix!


$ dart bin/dartdev.dart fix --help
Fix Dart source code.

This tool looks for and fixes analysis issues that have associated automated fixes.

To use the tool, run either 'dart fix --dry-run' for a preview of the proposed changes for a project, or
'dart fix --apply' to apply the changes.

Note: The `fix` command is provisional and subject to change or removal in future releases. Feedback is
welcome!

Usage: dart fix [arguments]
-h, --help       Print this usage information.
-n, --dry-run    Preview the proposed changes but make no changes.
    --apply      Apply the proposed changes.

Run "dart help" to see global options.
```




Change-Id: I2fc03651d8a1605a9729bb4d62e382f533509d99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175343
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2020-12-08 19:39:05 +00:00
Sigurd Meldgaard f3fe9dc3b3 Reland "Improve handling of disable-dartdev-analytics"
This is a reland of 58860f4814

Original change's description:
> Improve handling of disable-dartdev-analytics
>
> This is second try of https://dart-review.googlesource.com/c/sdk/+/171284
> that was reverted to to faulty logic in main_options.
>
> Some other refactorings are piggy-backed along.
>
> TestProject.runSync no longer takes a 'command' argument. It was anyway
> often not an argument.
>
> Also stop the messy handling of pub arguments. It is no longer needed.
>
> BUG: https://github.com/dart-lang/sdk/issues/44135
> Change-Id: I49abf5810d9ea262409ba9d93f0471037cb8a753
> TEST=The VM change is tested via all the pkg/dartdev/test/command/* tests that invoke dart with the --no-analytics flag.
> TEST=Furthermore manual test that the --no-analytics flag is passed to dartdev.
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174261
> Reviewed-by: Jonas Jensen <jonasfj@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

Change-Id: I725662f578d061f87171ceffe9aff3de83688f58
TEST=Furthermore run the vm-kernel-precomp-obfuscate-linux-release-x64-try trybot
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174473
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2020-12-04 14:22:10 +00:00
pq c7f364562c simple fix driver tool
Work to support https://github.com/dart-lang/sdk/issues/44272.

(Sure to evolve w/ some testing but I think there's enough to iterate on.)


Change-Id: Ieaab218ad8850631f4b16838d3b3821eaf7bd747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175005
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-12-04 02:00:43 +00:00
Devon Carew cec14bbf71 [dart analyze] wrap longer error correction messages
Change-Id: Ibed3e696c1eef76034ecc66b0156fe3cb7e61d35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174862
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-12-03 03:13:17 +00:00
Sigurd Meldgaard 97baa6efd1 Revert "Improve handling of disable-dartdev-analytics"
This reverts commit 58860f4814.

Reason for revert: Broke bots. Will investigate.

Original change's description:
> Improve handling of disable-dartdev-analytics
>
> This is second try of https://dart-review.googlesource.com/c/sdk/+/171284
> that was reverted to to faulty logic in main_options.
>
> Some other refactorings are piggy-backed along.
>
> TestProject.runSync no longer takes a 'command' argument. It was anyway
> often not an argument.
>
> Also stop the messy handling of pub arguments. It is no longer needed.
>
> BUG: https://github.com/dart-lang/sdk/issues/44135
> Change-Id: I49abf5810d9ea262409ba9d93f0471037cb8a753
> TEST=The VM change is tested via all the pkg/dartdev/test/command/* tests that invoke dart with the --no-analytics flag.
> TEST=Furthermore manual test that the --no-analytics flag is passed to dartdev.
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174261
> Reviewed-by: Jonas Jensen <jonasfj@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

TBR=bkonyi@google.com,sigurdm@google.com,jonasfj@google.com

Change-Id: I754bcebdcfc595158b04d431662b65bf25f5b89d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174466
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2020-12-01 13:11:16 +00:00
Sigurd Meldgaard 58860f4814 Improve handling of disable-dartdev-analytics
This is second try of https://dart-review.googlesource.com/c/sdk/+/171284
that was reverted to to faulty logic in main_options.

Some other refactorings are piggy-backed along.

TestProject.runSync no longer takes a 'command' argument. It was anyway
often not an argument.

Also stop the messy handling of pub arguments. It is no longer needed.

BUG: https://github.com/dart-lang/sdk/issues/44135
Change-Id: I49abf5810d9ea262409ba9d93f0471037cb8a753
TEST=The VM change is tested via all the pkg/dartdev/test/command/* tests that invoke dart with the --no-analytics flag.
TEST=Furthermore manual test that the --no-analytics flag is passed to dartdev.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174261
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2020-12-01 10:25:55 +00:00
Devon Carew 81986f4a36 [dartdev] add a --format option to dart analyze
Change-Id: Iad7d14b12892ce2121430f0cd94a2b0cd0d8e978
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174384
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-01 01:32:34 +00:00
Devon Carew 281cd02293 [dart fix] some tweaks to the cli ui for dart fix
Change-Id: I62e22e7f177f87e0f71b5275cdecb3e1da787de2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173401
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2020-11-21 15:29:43 +00:00
pq 818b66544c make dart fix apply opt-in
Change-Id: I4d9f53fdf7ceaf41de6455118adfa23afbc087eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173200
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2020-11-20 04:33:46 +00:00
Brian Wilkerson 3c5333558a Initial support for testing data-driven fixes through dart fix
Change-Id: I8197c83ef409ad5df1dda623c773846961916e09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172684
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2020-11-19 22:43:06 +00:00
pq 9219128bde summary presentation tweaks
See: https://github.com/dart-lang/sdk/issues/43746

Dry run:

```
Computing fixes in tmp_proj (dry run)...

3 proposed fixes in 1 file.

lib/main.dart
  annotate_overrides - 1 fix
  prefer_single_quotes - 2 fixes
```

Regular run:

```
Computing fixes in tmp_proj...
Applying fixes...

lib/main.dart
  prefer_single_quotes - 1 fix

1 fix made in 1 file.
```

Change-Id: I569b945027c807e4ff47c0eed99b7d9a64d4b8f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172823
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-19 00:09:11 +00:00
Ben Konyi 1d1137666c [ CLI ] Fix issue where test was expecting different error message than
that reported on Windows

Change-Id: Ib907f4d8afd50456ff962a7769a1f79d9b150c87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172824
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-11-18 22:18:12 +00:00
Ben Konyi b0ccaf75a3 [ VM / CLI ] Fix issue where trying to snapshot a non-existent script would cause an assertion failure
Passing --snapshot should result in the CLI being bypassed (`dart compile`
should be used otherwise). Check to see if this option is provided when
attempting to parse the script name and always populate script_name in
that case.

Fixes https://github.com/dart-lang/sdk/issues/43785

TEST=Added regression test to the CLI package to exercise this path.

Fixed: 43785
Change-Id: Ifb67a5880f6b83c54e6deb6b0785b61fdcfc0ada
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172820
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-11-18 20:01:04 +00:00
Ben Konyi 2a6971cba3 [ CLI ] Don't parse arguments when trying to run non-existent file
File checks are done after the initial argument parsing, so argument
parsing should stop once the first non-valid command/flag is reached.

Fixes https://github.com/dart-lang/sdk/issues/43991

Fixed: 43991
Change-Id: I42ac2d44eecc9b0bb32bb92f365bee30d173ee42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172744
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-11-18 20:01:03 +00:00
pq 4301645712 use ansi bullet
Fixes: https://github.com/dart-lang/sdk/issues/44241

Change-Id: Ia4d5daf92dea4ef15b8e38d07532caa1ece93f92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172742
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-11-18 16:28:30 +00:00
pq f8c6ffb68b add dry-run summary details
See: https://github.com/dart-lang/sdk/issues/43746

Sample run (snipped):


[_fe_analyzer_shared] (master) $ dart ../dartdev/bin/dartdev.dart fix --dry-run

*** The `fix` command is provisional and subject to change or removal in future releases. ***

Computing fixes in _fe_analyzer_shared (dry run)... 18.5s

5945 proposed fixes in 115 files.

lib/src/base/errors.dart
  prefer_single_quotes • 9 fixes
  unnecessary_const • 14 fixes
  slash_for_doc_comments • 35 fixes
  prefer_equal_for_default_values • 1 fix
  unnecessary_this • 1 fix
lib/src/base/syntactic_entity.dart
  slash_for_doc_comments • 4 fixes
lib/src/flow_analysis/factory_type_test_helper.dart
  omit_local_variable_types • 2 fixes
lib/src/flow_analysis/flow_analysis.dart
  omit_local_variable_types • 189 fixes
  unnecessary_new • 73 fixes
  prefer_single_quotes • 7 fixes
  unnecessary_const • 1 fix
  avoid_init_to_null • 1 fix
  annotate_overrides • 3 fixes
  prefer_equal_for_default_values • 3 fixes
lib/src/messages/codes.dart
  omit_local_variable_types • 14 fixes
  prefer_single_quotes • 31 fixes
  annotate_overrides • 11 fixes
  unnecessary_new • 12 fixes
  prefer_equal_for_default_values • 2 fixes
  unnecessary_this • 1 fix
lib/src/messages/codes_generated.dart
  prefer_single_quotes • 1150 fixes
  unnecessary_new • 244 fixes
  unnecessary_const • 835 fixes
  omit_local_variable_types • 78 fixes
lib/src/messages/severity.dart
  unnecessary_const • 4 fixes
  prefer_single_quotes • 8 fixes

<snip>






Change-Id: Ic5b54771eeceeefeadd2d7de8023bdb5c9f45fa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-11-18 00:43:00 +00:00
Sigurd Meldgaard ce272daae8 [dart cli]: Use the correct package_config from dart run and dart test
Before `dart run` would always use the package config found by looking up the hierarchy from
whatever we got from getExecutableForCommand.

When that happened to be a precompiled snapshot this would work, because it would be ignored.

But if it would be a dart-file in another package (that would happen if that package is not cached)
we instead should resolve it relatively to the current working directory
(where the pubspec.yaml is also found).

Bug: https://github.com/dart-lang/sdk/issues/44214
Change-Id: Ib2e929c01ddc72babbcff91560236e08429f09f7
TEST=The new package config behavior is tested by the new test in: pkg/dartdev/test/commands/run_test.dart.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172181
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2020-11-17 10:20:00 +00:00
Sigurd Meldgaard 5cbb25f753 Revert "Improve handling of disable-dartdev-analytics"
This reverts commit cda994ffc8.

Reason for revert: This stopped all sending of analytics from dartdev.

The added flag in dartdev had an implicit default value of 'false' -> no analytics would be sent.

Also the main_options.cc change was broken and did not pass the argument on to dartdev.

This failed to be caught by tests because all test are run with analytics off, and that happened implicitly.

Original change's description:
> Improve handling of disable-dartdev-analytics
>
> Some other refactorings are piggy-backed along.
>
> TestProject.runSync no longer takes a 'command' argument. It was anyway
> often not an argument.
>
> Also stop the messy handling of pub arguments. It is no longer needed.
>
> BUG: https://github.com/dart-lang/sdk/issues/44135
> TEST=The VM change is tested via all the pkg/dartdev/test/command/* tests that invoke dart with the --no-analytics flag.
>
> Change-Id: Ib5a1a29841a5fdb28663b7f60c5d6fc31ba252d0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171284
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Jonas Jensen <jonasfj@google.com>

TBR=kustermann@google.com,bkonyi@google.com,sigurdm@google.com,jonasfj@google.com

Change-Id: I92ef65b16cdb75fb2475faf9f522fda62e181bab
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171941
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2020-11-13 14:30:46 +00:00
Sigurd Meldgaard 692b0070eb Fix test expectation on windows.
Change-Id: I33d86243ba57fedef1318983f4b467a1184bf62a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171882
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2020-11-13 09:42:06 +00:00
Sigurd Meldgaard cda994ffc8 Improve handling of disable-dartdev-analytics
Some other refactorings are piggy-backed along.

TestProject.runSync no longer takes a 'command' argument. It was anyway
often not an argument.

Also stop the messy handling of pub arguments. It is no longer needed.

BUG: https://github.com/dart-lang/sdk/issues/44135
TEST=The VM change is tested via all the pkg/dartdev/test/command/* tests that invoke dart with the --no-analytics flag.

Change-Id: Ib5a1a29841a5fdb28663b7f60c5d6fc31ba252d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171284
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2020-11-13 08:40:06 +00:00
Paul Berry 83cf6d67dc Migration: improve error/warning text when there are analysis errors.
Fixes #44144

Bug: https://github.com/dart-lang/sdk/issues/44144
Change-Id: I54ef9ca8f38335df2082d730ba558fd407a07767
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171643
Commit-Queue: Kathy Walrath <kathyw@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
2020-11-12 17:59:07 +00:00