Commit Graph

136 Commits

Author SHA1 Message Date
Ben Konyi 8d41c9b677 [dartdev] Synchronize environment variable modifications to fix getenv crash
Avoid a race condition between async setenv/unsetenv calls on the VM thread and concurrent getenv/environ reads on the main thread.

In glibc, setenv and getenv are not thread-safe against each other. VmInteropHandler.setEnvironmentVariable previously sent a message to the VM thread to call setenv/unsetenv asynchronously, while the main thread immediately proceeded to access Platform.environment or Platform.localeName (which calls getenv). This could cause a crash (SIGSEGV) in getenv.

This CL makes VmInteropHandler.setEnvironmentVariable synchronous by awaiting a reply from the VM thread before returning.

TEST=pkg/dartdev/test/environment_test.dart

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

Change-Id: Ic8211897ce26ffbdc142fa594cd397189a61f061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506800
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2026-05-29 10:26:54 -07:00
Jake Macdonald 06bdbd777f Update mcp-server command to be an alias for 'run dart_mcp_server@'
Strips the dart-lang/ai dependency from the SDK entirely, as well as the snapshot.

Bug: https://github.com/dart-lang/ai/issues/479
Change-Id: Id919c6a8fbf5fedeffb37e5181bc2fbd85adf986
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507220
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2026-05-28 12:06:25 -07:00
pq 04c6612781 [analytics] propagate analytics environment variables to subtools
Updates the main `dartdev` command runner to read and propagate the unified analytics environment variables (`DASH__SUPPRESS_ANALYTICS` and `DASH__TOOL`) to all spawned isolates and child processes using the handy new `VmInteropHandler.setEnvironmentVariable` support (see: https://dart-review.googlesource.com/c/sdk/+/499300).

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



Change-Id: Iae68790a2cf861dd01edbea81f9faf7d7529f5f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504321
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2026-05-19 11:57:42 -07:00
Ben Konyi c5a57427d1 [ CLI ] Add support for modifying the environment from package:dartdev
This change makes it possible to set environment variables for the
current process from package:dartdev.

As a proof of concept, package:dartdev now sets `DART_ROOT` to the path
of the Dart SDK in the environment.

Related to https://github.com/dart-lang/sdk/issues/63210 and https://github.com/dart-lang/sdk/issues/62876

TEST=pkg/dartdev/test/environment_test.dart
Change-Id: If3a90279e99dadaba435ae3e43a752dcfda69227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499300
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-05-05 10:03:41 -07:00
Paul Berry 7465a0b6a7 Bump eng packages to language version 3.12.
This CL is part of an effort to bump the SDK requirement to `3.12.0-0`
for all the packages in `pkg` that are not published to `pub`, so that
we can get better testing of the "private named parameters" feature.

(Packages that *are* published to `pub` can't be safely bumped yet,
because SDK 3.12 hasn't been released, and I don't want to block those
packages' ability to publish useful updates to customers.)

This change covers the following packages, which are owned by OWNERS_ENG:
- pkg/async_helper
- pkg/bisect_dart
- pkg/dartdev
- pkg/expect

Changes to `pubspec.yaml` files were made manually.

Changes to `.dart` files were made automatically, using `dart fix` to
migrate to using private named parameters where it is possible to do
so without changing semantics. Note that this migration is
conservative; see https://github.com/dart-lang/sdk/issues/58607 for
details.

Change-Id: I56bdd1f2665b0a0b79ebb8484e49ce176a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487940
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-03-16 01:11:16 -07:00
Sigurd Meldgaard 65c4d768f1 Upgrade language version of dartdev to 3.11
Changes are reformatting and using the nullable list element operator.

Change-Id: Iea1f4d2fcb06056f14804c8fe8b33c0b4d9037f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2026-02-02 06:47:50 -08:00
Moritz 7ab10ef0a4 [hooks] Add data-assets flag
Add an experimental data-assets flag to enable data assets in hooks.

Change-Id: I0df53c225638414db625a0433498ef2c10d31d96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450781
Commit-Queue: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-09-23 01:02:15 -07:00
Daco Harkes 94894b1796 [dartdev] dart install
This CL adds three new commands to `dart`:

```
Global
  install     Install a Dart CLI tool for global use.
  installed   List globally installed Dart CLI tools.
  uninstall   Remove a globally installed Dart CLI tool.
```

These commands are intended to replace `dart pub global` subcommands
while adding support for `hook/build.dart` and building packages in
AOT instead of running them with JIT.

Internal design doc: http://go/dart-install-cli.

Implementation details:
* The source of truth is the state of the file system. These commands
  write and read directories, files, and symlinks.
* App bundles and symlinks are placed in `DART_DATA_HOME` as per
  http://go/dart-data-home.
* On Unix systems we use symlinks and on Windows batchfiles to place
  executables in the bin directory that point to an application
  bundle. (These OS differences have been encapsulated in a single
  class.)
* On Windows, when an application is running, trying to re-install it
  will fail.

Test coverage:
* Installing from hosted, git, and local paths.
* Installing a package with hooks.
* Installing a package with hooks and user-defines.
* Surfacing build hook failures during install.
* Installing packages with conflicting executables names. This tests
  `--overwrite` flag behavior.
* Installing a new or the same version, this should simply succeed.
* A warning is shown if the bin directory is not on the `PATH`.
* Running an installed app reports the correct exit code on exit.
* Listing all installed versions, including the versions not on
  the`PATH`.
* Uninstalling, which uninstalls all versions.
* Re-installing while it is running.
* Uninstalling while it is running.

Out of scope for initial version:
* Saving the SDK version (to display in `dart installed`).
* Short-circuiting if re-installing an exactly installed version.

Bug: https://github.com/dart-lang/sdk/issues/60889
Change-Id: I8f3a60d26e013957ce6fd7f52e564bcaaff30509
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441581
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
2025-08-13 01:33:59 -07:00
Daco Harkes 59ed4ebde9 [dartdev] Organize dart --help commands into categories (2)
TEST=pkg/dartdev/test/commands/help_test.dart

Change-Id: I4e6eed1093412c8b307713c0faf95a84d56b5f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436905
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-06-25 08:39:04 -07:00
Daco Harkes 2273611355 [dartdev] Organize dart --help commands into categories
This CL organizes the commands in the Dart CLI to categories. It
mirrors the categories used in `flutter --help`: `SDK`, `Project`, and
`Tools`. The available command section will now look as follows in
verbose mode:

```
Available commands:

Project
  build                 Build a Dart application including native assets.
  compile               Compile Dart to various formats.
  create                Create a new Dart project.
  pub                   Work with packages.
  run                   Run a Dart program.
  test                  Run tests for a project.

Source code
  analyze               Analyze Dart code in a directory.
  doc                   Generate API documentation for Dart projects.
  fix                   Apply automated fixes to Dart source code.
  format                Idiomatically format Dart source code.

Tools
  compilation-server    Control resident frontend compilers.
  development-service   Start Dart's development service.
  devtools              Open DevTools (optionally connecting to an existing application).
  info                  Show diagnostic information about the installed tooling.
  language-server       Start Dart's analysis server.
  tooling-daemon        Start Dart's tooling daemon.
```

Bug: https://github.com/dart-lang/sdk/issues/60980
Change-Id: Ic9da297fcdd0f8e85d619632ba8ec30fd2c32666
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436382
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-06-25 03:08:50 -07:00
Jake Macdonald d828c36cec Add a dart mcp-server command per go/dart-mcp-server-release-plan.
- Adds `dart_mcp` and `dart_mcp_server` as DEPS
- Build an AOT snapshot for the dart_mcp_server executable
- Add top level `mcp-server` command to dartdev (hidden).
- I also did add an `--experimental-mcp-server` flag which is required for this command to actually work. We had initially discussed not doing this due to complexity but I was able to keep it completely scoped to just this command. I can remove it if there are strong opinions though.

Change-Id: I737a5625507f69a904ccd1012682764eb360a2c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430900
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2025-05-27 10:14:26 -07:00
Daco Harkes 98e29db45c [native_assets] Disable experiment on stable and beta channel
We want to avoid users passing `--enable-experiment=native-assets` on
stable and beta, as we'd like to move fast and break things on the
experiment. This aligns the experiment with how the experiment is
working in Flutter: main and dev branch only.

Before this CL, dartdev did not check experiment flags. Unknown
experiments would fail in the VM. After this CL, dartdev checks the
experiment flags and errors out early.

Change-Id: I875ea3272f4b67342da19ea2e4be329a4b380573
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406660
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-02-04 03:36:43 -08:00
Moritz 81daf8e563 Use package:record_use
- Rename resource identifiers in the VM to usage recordings.
- Use package:record_use for serialization.
- Rename and use the experimental flag for this feature.
- Recognize tear-offs and top-level methods as well.

Next steps:

- Add constant instance recording.
- Expose API in package:native_assets_cli's link callback.

TEST=pkg/vm/test/transformations/record_use_test.dart

Change-Id: I8af3625165f78925ae943711245af93a239d1012
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2024-09-12 08:47:53 +00:00
Parker Lougheed fef2ba30a6 [dartdev] Avoid unnecessary uses of late
Change-Id: I702e5c91e803b06dd1321efe563c104bc00c19d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368740
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-05-30 14:55:21 +00:00
Ben Konyi e82ff48027 [ CLI ] Add dart development-service command
The `dart development-service` command will be used by tooling to launch
DDS from the SDK instead of shipping DDS via package:dds.

TEST=Existing service test suite

Change-Id: Ib928aa5b8961caf87d7074884c3d226b5c096ccd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361180
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-04-05 16:30:11 +00:00
Sigurd Meldgaard bc555a8ddb Don't run file named <command> with `dart <command>
Bug: https://github.com/dart-lang/sdk/issues/55370
Change-Id: I32561ea3f410495540b7cc3810b6635396d884de
Tested: In pkg/dartdev/test/no_such_file_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361363
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2024-04-05 15:16:39 +00:00
Devon Carew 87df8c4691 rev to the latest package:args; update pkg/dartdev
Change-Id: I7535e4c9cd9afb78905525fc0986dc6d60894362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358225
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-03-21 17:15:58 +00:00
Ben Konyi 3495a21fc8 [ CLI ] Don't strip specific flags from argument list
Arguments matching the following patterns were being removed from the
argument list before being processed by DartDev's argument parser:

 --observe
 --enable-vm-service
 --devtools

This was due to these arguments having non-standard formats that caused
parsing issues in the past. However, these arguments are now completely
parsed by the VM and not actually decoded in the CLI, so there's no need
to blindly remove them. This was causing issues when passing arguments
to user processes (e.g., `dart run foo.dart --devtools-port` would drop
the `--devtools-port` argument due to this logic).

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

Change-Id: I09358d7f5004483ad3b457ba74229c940d9a0d75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350360
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-02-05 19:12:50 +00:00
Ben Konyi 3c42222b7e [ CLI ] Add tooling-daemon command to support launching the Dart Tooling Daemon (DTD)
This change includes the following:
 - A new `tooling-daemon` CLI command to launch DTD
 - Minor refactoring of package:dtd_impl to better match expected
   Dart package structure
 - Updated build rules to create dart_tooling_daemon.dart.snapshot

Change-Id: Idd91bc4ce64ce790db5bad323a50d9cf65523dc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344800
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-01-08 17:07:55 +00:00
Parker Lougheed 5592a0fd5f [dartdev] Roll pub to a3689f03168c896dd1cb0db8a60c568b38ee16bf
It's been a few months since pub was updated and there are some good enhancements that would benefit from larger testing. Happy to close this if pub hasn't been updated in a while on purpose though!

Diff: https://github.com/dart-lang/pub/compare/1779628b386819675130f14326f1e8812901c48f...a3689f03168c896dd1cb0db8a60c568b38ee16bf/
Change-Id: I69ee1fcf8df8ed61fffa7729c36a214cb1871230
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345101
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Sarah Zakarias <zarah@google.com>
2024-01-08 10:40:37 +00:00
Ben Konyi 2ede541780 [ CLI ] Don't throw an error when --disable-analytics is provided when running in a CI environment
--suppress-analytics is implicitly set when we detect we're running in a
CI environment, but providing --{disable,enable}-analytics conjunction
with --suppress analytics was considered an error.

This change allows for --{disable,enable}-analytics to be provided when
running in a CI environment without causing a fatal error to be thrown.

Change-Id: I07fbbe7aeb8632c6f432d4feeb79d8ee3cf190c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341401
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Elias Yishak <eliasyishak@google.com>
2023-12-14 15:15:10 +00:00
Ben Konyi afb529a671 [ CLI ] Fix analytics_test
--analytics doesn't enable analytics (it's no longer a valid VM flag), so
we're safe to remove related tests.

Change-Id: I50bfb7c6da8c2596b9f95969d6a5b6927e15a900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341400
Reviewed-by: Elias Yishak <eliasyishak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-12-12 18:45:51 +00:00
Ben Konyi 7b25ff461d [ CLI ] Disable analytics collection on bots
Change-Id: Ifc038d08cd2c427ba3541ef8eed39b97481766e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341040
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Elias Yishak <eliasyishak@google.com>
2023-12-11 18:47:32 +00:00
Parker Lougheed 44c27644c1 [dartdev] Await analytics closure to reduce hanging
Recently commands have been hanging after completion occasionally. I couldn't find any culprit besides this and its dartdocs suggest awaiting as well.

Behavior should be covered by the increased analytics testing added with the recently unified migration.

Change-Id: I143c0bfc3648e19f528c45ebf056e5a3c7c095ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339500
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Elias Yishak <eliasyishak@google.com>
2023-12-04 15:55:43 +00:00
Ben Konyi 12e52d8fde Reland "[ CLI ] Migrate to use package:unified_analytics"
This reverts commit b0abe686fc.

Change-Id: I0a94061ade8ccdec84a90e782fa50eb68c1bcc1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338700
Reviewed-by: Elias Yishak <eliasyishak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-11-28 19:26:51 +00:00
Ben Konyi b0abe686fc Revert "[ CLI ] Migrate to use package:unified_analytics"
This reverts commit 756675bcdb.

Reason for revert: Breaking analyzer bots

Original change's description:
> [ CLI ] Migrate to use package:unified_analytics
>
> Change-Id: I542fe1e17f728e027c3769d931d13257ef24c496
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317461
> Reviewed-by: Elias Yishak <eliasyishak@google.com>

Change-Id: Ie9ba2955a0661011adbb6786df2e01c7601e06fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338500
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Elias Yishak <eliasyishak@google.com>
Commit-Queue: Elias Yishak <eliasyishak@google.com>
2023-11-27 21:00:17 +00:00
Ben Konyi 756675bcdb [ CLI ] Migrate to use package:unified_analytics
Change-Id: I542fe1e17f728e027c3769d931d13257ef24c496
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317461
Reviewed-by: Elias Yishak <eliasyishak@google.com>
2023-11-27 19:52:42 +00:00
Daco Harkes 72f847f458 [dartdev] Error on dart compile if native assets build fails
`dart run` and `dart build` already checked.

`dart compile` only checked if there are no native assets. However,
it should also error if native assets builds failed, as there could
have been native assets resulting from those builds.

Change-Id: Id90eb9b58675856421b793b271bf627506effe3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334223
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-11-08 11:13:10 +00:00
Daco Harkes e1ae1b48ae [vm/ffi] dartdev CLI native-assets
This CL introduces native assets suport for `dart run` and introduces
`dart build` which is similar to `dart compile` but outputs a folder
instead to that native assets can be bundled with an executable.

Change-Id: Ib6cfb95539f0adee46c99e531e440928c3f72f2b
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267340
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-05-30 09:10:28 +00:00
Danny Tuppeny 3149f813bb [dartdev] Update --enable-analytics to re-enable unified analytics
Previously, running `dart --disable-analytics` would disable this, but `dart --enable-analytics` would not re-enable.

Change-Id: I3da33f0c0ed9a3e29ff4fbbfd66ceeb030014c4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-17 19:54:17 +00:00
Janice Collins 62edbb5a81 Adjust legacy analytics timeout to improve performance.
This may have the result of dropping any analytics for fast-exiting
commands such as --help.

TEST=manual testing

Bug: https://github.com/dart-lang/sdk/issues/50360
Change-Id: I9ffa81d37a70a4a6c862f9bc5893d8521dc4022e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294940
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
2023-04-13 14:36:01 +00:00
Keerti Parthasarathy e31afcb0b1 Add a disable-telemetry option to dart.
Change-Id: I7295a60fbbf90ed95abcb39abc86a1f8427cab89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292202
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-03-31 14:45:07 +00:00
Janice Collins 68353d76a4 Add a flag to disable the new unified_analytics for a single session.
- Adds a new flag, `--suppress-analytics` to the `dart` command to
  disable both the unified and the legacy analytics for a single
  session while deprecating the existing flag, `--[no-]analytics` used
  for disabling the legacy analytics on a single pass.
- Pipelines the flag from `dart` through `dart analyze` and `dart fix`
  to the execution of the analysis server.
- Updates all applicable uses of `dart analyze`, `dart fix`, and the
  analysis_server binary entry points in the SDK to disable analytics
  for the test infrastructure.

Bug: https://github.com/dart-lang/sdk/issues/49445
Change-Id: I1302cad7e04b21454aa7d9e8ee72a876b231377d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287661
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2023-03-16 18:00:57 +00:00
Keerti Parthasarathy 3ad45940d6 Add ability to disable sending analytics using the unified analytics package on --disable-analytics option.
Currently users can enable analytics using the unified analytics package in VS Code, but there is no option the disable from the UI. Adding this allows users to disable analytics by running `dart --disable-analytics`.

Change-Id: Ieff4281ab3fbdccee7ec7a05b185f5c4f9da6f76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289082
Reviewed-by: Elias Yishak <eliasyishak@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-03-15 21:01:47 +00:00
Sigurd Meldgaard 1e80548c5f Remove support for dart __deprecated_pub
This is no longer used after https://github.com/flutter/flutter/pull/121605

Change-Id: Ifc33004dd3a87612bf7b92a50587d68a37d629d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286927
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2023-03-13 12:06:08 +00:00
Ben Konyi 5ee55a8b6d [ CLI ] Rename compile-server-shutdown to compilation-server with start and shutdown subcommands
This will make compilation server related commands more consistent with
other commands in the CLI.

In order to make use of the compilation server for faster runs, users
will still need to pass `--resident` to `dart run` until we decide if we
want this functionality made more visible.

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

Change-Id: If9855ce1cc614c1c3ea6c4426dd4fad8f45c2495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284500
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-02-22 20:40:48 +00:00
Paul Berry 5d7b701d12 Remove dart migrate command.
Bug: https://github.com/dart-lang/sdk/issues/50319
Change-Id: I216a20afe8382eab5872672b2e01ed1daf7ac78d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278367
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-01-06 17:21:35 +00:00
Devon Carew 793367c498 [pkg/dartdev] add windows support for 'dart bug'
Change-Id: Id94a4d9e4a485350cbe37f78d5395e093ccf5892
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272741
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-11-30 20:13:05 +00:00
Devon Carew 1dd71b412f [dartdev] contribute a 'dart bug' command
Change-Id: Ib5557711df23d3a3e0485378c04ff6264194717f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269750
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-11-29 16:58:58 +00:00
Michael Richards 8d262e2944 [dartdev] This adds the ability for the Dart CLI to use the Resident Frontend Compiler for faster start times.
Dartdev will use the user's home directory to store the server information and will keep a directory for cached kernel files in each dart package's .dart_tool directory and in the .dart directory for stand alone dart programs.

This functionality is accessed by providing the --resident flag to the Dart CLI, and the server can be manually shutdown with the new shutdown command.

Change-Id: I5231a00b7535266ab0704ca3ae35c039738bd38b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254341
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Michael Richards <msrichards@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-08-18 17:01:34 +00:00
Ben Konyi 887601b726 [ CLI ] Add better logging to the DartDev isolate
Should make debugging unhandled errors in the CLI easier.

Related issue: https://github.com/flutter/flutter/issues/106753

Change-Id: I6cfc88a52c0af756c0d7a00fc1a2edcf61b86538
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252464
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-25 14:44:59 +00:00
Ben Konyi cc92eb0a7f [ CLI ] Fix LateInitializationError in DartDev when passed an invalid flag
`log` was previously initialized after argument parsing had already
taken place, which caused an exception when an invalid flag was passed
to DartDev as `log` was referenced in the `dart fix` command
description, which is accessed when building the usage message.

Also fixes a minor test failure related to usage line lengths not being
set correctly for `dart devtools`.

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

Fixed: 49437
Change-Id: Ib367677db5f34d7b6da31e51dbe717c954298ecf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251241
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-12 18:22:42 +00:00
Sigurd Meldgaard bc7554107b Bump pub to 8f5ab7b1aba3b9f66b56246d77e167990339d317
Changes:
```
> git log --format="%C(auto) %h %s" dcb6aba..8f5ab7b
 https://dart.googlesource.com/pub.git/+/8f5ab7b1 Avoid raceconditions in `global activate`, `run` and `global run` (#3285)
 https://dart.googlesource.com/pub.git/+/6e03ec02 Support multiple packages in 'dart pub add' (#3283)
 https://dart.googlesource.com/pub.git/+/1a298f4d Fix --verbose doc, and accept verboseness setting from embedder (#3279)
 https://dart.googlesource.com/pub.git/+/5bda798c Avoid race condition for hosted source on package extraction (#3277)
 https://dart.googlesource.com/pub.git/+/17c5addb Error on acquireDependencies when the root pubspec has an unknown sdk in the environment. (#3271)
 https://dart.googlesource.com/pub.git/+/0a32ae4a folder/* should not ignore the folder itself, only the contents (#3267)
 https://dart.googlesource.com/pub.git/+/44b785aa Normalize file names for tar.gz (#3268)
 https://dart.googlesource.com/pub.git/+/2fd6b5f0 Fix repository specification: isRetracted -> retracted (#3249)
 https://dart.googlesource.com/pub.git/+/0fc71db4 Write log trace to $PUB_CACHE/log/pub_log.txt when crashing (#3240)

```

Diff: https://dart.googlesource.com/pub.git/+/dcb6abac2d7d43258c03b348be42bf4aab9529b1~..8f5ab7b1aba3b9f66b56246d77e167990339d317/
Change-Id: I54f1fde0f50ca19ca036bb1e6d9b166455031183
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229542
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2022-01-27 11:17:00 +00:00
Ben Konyi 1c571a12fa [ CLI ] Migrate package:dartdev to null safety
Fixes https://github.com/dart-lang/sdk/issues/47964

TEST=CQ

Change-Id: I4ee57bc5739835824b0052bd9470a0d52ccf161b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229948
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-01-26 21:16:49 +00:00
Ben Konyi 3b736b8460 [ package:dds ] Migrate package:devtools_server functionality under package:dds/devtools_server.dart
Will allow for us to remove dependencies on package:devtools_server in
various packages.

Change-Id: I055cc7bb05d5b4ce0071e3f88a71cb9596e76c74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228022
Reviewed-by: Kenzie (Schmoll) Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-01-18 22:42:05 +00:00
Michael Thomsen 7da2117892 Initial 'dart doc' developer command
Initial 'dart doc' command for the unified 'dart' developer tool,
over time replacing the exiting 'bin/dartdoc' tool.

This is a second attempt after the previous got reverted:
https://dart-review.googlesource.com/c/sdk/+/217980

The first attempt, which was already reviewed, is
in patchset 1.

Change-Id: Id9e0e572944ba032c32f3cebec579ab23d0df036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220744
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-12-06 10:26:09 +00:00
Michael Thomsen 5075cb7a50 Revert "Initial 'dart doc' developer command"
This reverts commit 916a43a1c8.

Reason for revert: command fails in built SDK, see https://github.com/dart-lang/sdk/issues/47677

Original change's description:
> Initial 'dart doc' developer command
>
> Initial 'dart doc' command for the unified 'dart' developer tool,
> over time replacing the exiting 'bin/dartdoc' tool.
>
> Change-Id: Ib5639f9329bf5ed86375c97c5e485471934c56ff
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217980
> Commit-Queue: Michael Thomsen <mit@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I5eb04c68cb80b1e2b95642e9e7904ad86c603315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220006
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2021-11-11 15:39:43 +00:00
Michael Thomsen 916a43a1c8 Initial 'dart doc' developer command
Initial 'dart doc' command for the unified 'dart' developer tool,
over time replacing the exiting 'bin/dartdoc' tool.

Change-Id: Ib5639f9329bf5ed86375c97c5e485471934c56ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217980
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-11-09 21:27:53 +00:00
Sigurd Meldgaard 86b7480b8c Start a new analytics session for each dartdev run
Change-Id: I0deb0ed7834361506ca6f67d5a8a77d40ea286a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218643
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Sigurd Meldgaard <sigurdm@google.com>
2021-11-01 20:46:11 +00:00
Sigurd Meldgaard ecc6ed1b32 Send resolution analytics from dart pub get/upgrade/...
Also enables batched analytics (up to 20 events will be sent together in
one request if they are all issued before control is returned to the
async queue).

Change-Id: Ic23429d4981bc33a34cb19ffc00affdd09dfe511
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217014
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2021-10-25 12:35:30 +00:00