Commit Graph

371 Commits

Author SHA1 Message Date
Jens Johansen b32e313620 [vm] Introduce --script_uri_override to support Platform.script in dart run -r
If a script uses `Platform.script` running it with as `dart
<script.dart>` and `dart run <script.dart>` would give the correct
script ("<script.dart>"), but running it with `dart run -r
<script.dart>` would report a dill file in the temp directory which is
not only surprising, but also breaking and for instance running the CFEs
strong_suite.dart via `dart run -r` didn't work.

This CL introduces --script_uri_override to the VM and makes the
resident compiler setup pass it so that when running `dart run -r
<script.dart>`, even though the vm is actually launched from a dill file
that resides in temp, `Platform.script` will actually return
`<script.dart>` - and running the CFEs strong_suite.dart via `dart run
-r` now actually works.

Tested: Added pkg/dartdev/test/commands/run_test.dart and manual testing.
Change-Id: Ia65c01834485fe06af63584baf0448dd5b9ffdb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510343
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-06-11 06:34:20 -07:00
Simon Binder 567bf3337b [dart2wasm] Document standalone platform and include it in SDK
Given that the standalone target for dart2wasm is feature-complete now,
it makes sense to include it in released SDKs.

This adds the platform and outline files to built SDKs and exposes the
`--standalone` flag in `dart compile wasm`.
It also documents the standalone target in `pkg/dart2wasm/doc`, which
should be helpful as a starting point to use these compiled modules.

Change-Id: I5bd86e9670f03f2955e31789095dd5c462bf149e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506920
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-06-02 00:56:35 -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
Brian Wilkerson 291730c940 Fix the windows bot
The CL https://dart-review.git.corp.google.com/c/sdk/+/505045 broke the
windows bot because the file path is different. It's different by more
than just the path separator, and given that the point of the test isn't
to ensure that the right file path is being printed, I decided to
remove the file path check from the expectations.

Change-Id: Ie5aef4beddb2051c63b2d1686664afb8841297fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505383
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-22 07:00:21 -07:00
Brian Wilkerson f2319d4ed4 Support fixing codes not enabled in the options file
Codes specified on the command-line are force-enabled in all of the
analysis options for all of the files. This is done in a brute force
way, but it should be safe because the code is creating an analysis
context collection just for this one run, so the options objects
should be short lived.

Closes https://github.com/dart-lang/sdk/issues/63345

Change-Id: I8925da426d6cb5b9ce686725e3b95696b552cae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505045
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-21 12:57:18 -07:00
Kenzie Davisson a0e0688b21 Update DevTools rev to 23a1bf0ff30bc83b1dc16045d6d9b15da9b4bc9c
Change-Id: Ib46dfa0b30de394665ad6b0fb4f55cc5b0f93add
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499801
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2026-05-05 17:30:59 -07:00
Alexander Markov b540d7e135 [vm] Fix parsing of DART_VM_OPTIONS environment variable
This change fixes the following problems when parsing DART_VM_OPTIONS
environment variable:

* Resize vm_options to accomodate for extra flags from
  DART_VM_OPTIONS.

* Prepend executable name to the argv to be compatible with
  implementation of Platform.executableArguments.

* Use strchr instead of strtok_r to avoid modifying value of
  DART_VM_OPTIONS environment variable in place.

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

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

Change-Id: I86e0ece20844888333b2a0765c82a5ad1fba54b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491001
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-03-26 19:52:00 -07:00
Lasse R.H. Nielsen 56505e0575 Stop using Match.group.
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)

Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-20 09:09:46 -07:00
Daco Harkes 2d94b0cbb8 [dartdev] dart run progress updates to stderr
Stream various updates from different components to `stderr` instead
of `stdout` on `dart run`.

TEST=pkg/dartdev/test/

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

Change-Id: Icd5caa65aab092341d370b09c016f89ae2a57987
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/+/486203
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-03-09 11:05:28 -07:00
Daco Harkes 769752be6f [dartdev] Fix resident compiler tests
Explicitly set `--resident-compiler-info-file`.

Closes: https://github.com/dart-lang/sdk/issues/62598
Closes: https://github.com/dart-lang/sdk/issues/62599

Change-Id: Iefd6ab479c2f5a4291156f453e2f3f4f5fc66fc3
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/+/486181
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2026-03-06 12:23:07 -08:00
Robert Nystrom 207e8f6f3c Change the ConvertToInitializingFormal availability to allow it in dart fix.
Change-Id: I9dc2a579f5c7a832bc3ba2adc4ea0ad965845397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-24 17:13:50 -08:00
Sigurd Meldgaard 528d4faff6 dart install and dart remote run with descriptors
Bug: https://github.com/dart-lang/sdk/issues/62123
Change-Id: I16e4fc0c20b9728e8357b6f67540aec73b2804ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477560
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2026-02-10 05:50:12 -08: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
Johnni Winther 62a646220a [dartdev] Handle upper case letters in dart create
This adds handling of upper case letters in `dart create`. This command is run from IDEs (IntelliJ, atleast) and if you use upper case letters in the directory, the `dart create` would (silently) fail instead of normalizing the directing to a valid package name, leaving the created project folder with no content.

All upper case names are normalized to all lower case, and mixed case are normalized to snake case, as if it was from camel case.

Change-Id: If854e17a0273eb0d02f4f0c5dcd4b50752e57bd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474641
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-01-22 07:36:14 -08:00
Sigurd Meldgaard a22f4d3924 Hide remote run behind flag (until aligned)
Prevent introducing a breaking change later by removing the current incantation
of remote run before it goes into stable.

See: https://github.com/dart-lang/sdk/issues/62123 for details.
Change-Id: I53e0ba84a9317bd16d1249d2bcf1b07a0467a49d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467021
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2025-12-15 01:55:31 -08:00
Ryan Macnak 8dbd8bb913 [dart] dart compile aot-snapshot --target-sanitizer=asan,msan,tsan
Bug: https://github.com/dart-lang/sdk/issues/61352
Change-Id: I7ac6228352706581b18d4394a854f45c1d08c347
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465986
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-12-08 10:57:03 -08:00
Brian Wilkerson af83bcb046 Add documentation for most of the errors and warnings in analysis options files
We don't have a way to mechanically verify the exampes and fixed code,
so please look to see whether any of it looks wrong. And, of course, let
me know if any of the text appears to be incorrect or could be better.

Change-Id: I9b059524ffcedc1e3b8a7602b7124f419095a702
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455481
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-03 13:03:12 -08:00
Alexander Aprelev 7cf7000a41 [vm/dartdev] Pass package_config option to spawned executable.
Fixes https://github.com/dart-lang/sdk/issues/62009
TEST=dartdev/run_test

Change-Id: I8fc114268d2f438fc78fa6b32f2d50e4b85cde91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464660
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-12-01 11:28:58 -08:00
Daco Harkes 991c48f689 [dartdev] dart run remote
Enables "run-from-remote" with `dart run`.

```
Run a Dart program from a file, a local package, or a remote package.

Usage: dart [vm-options] run [arguments] [<dart-file>|<local-package>|<remote-executable> [args]]

<dart-file>
  A path to a Dart script (e.g., `bin/main.dart`).

<local-package>
  An executable from a local package dependency, in the format <package>[:<executable>].
  For example, `test:test` runs the `test` executable from the `test` package.
  If the executable is not specified, the package name is used.

<remote-executable>
  An executable from a remote package. This can be from a hosted package server
  (like pub.dev) or a git repository.

  When running a remote executable, all other command-line flags are disabled,
  except for the options for remote executables. `dart run <remote-executable>`
  uses `dart install` under the hood and compiles the app into a standalone
  executable, preventing passing VM options.

  From a hosted package server:
    <hosted-url>/<package>[@<version>][:<executable>]

    Downloads the package from a hosted package server and runs the specified
    executable.
    If a version is provided, the specified version is downloaded.
    If an executable is not specified, the package name is used.
    For example, `https://pub.dev/dcli@1.0.0:dcli_complete` runs the
    `dcli_complete` executable from version 1.0.0 of the `dcli` package.

  From a git repository:
    <git-url>[:<executable>]

    Clones the git repository and runs the specified executable from it.
    If an executable is not specified, the package name from the cloned
    repository's pubspec.yaml is used.
    The git url can be any valid git url.
```

Notable implementation decisions:

* Does not redownload if the pubspec.lock is identical from the last
  remote run. Always does a pub resolve to see if the pubspec.lock
  would be identical.
* pub urls must start with `https://`. This makes parsing with local
  file paths more tractible.
* git urls may use either urls, or git ssh. (Git SSH is not tested due
  to not wanting to run an ssh server locally.)
* Shares as much implementation with `dart install` as possible. The
  `dart install` implementation was made public where necessary. The
  `dart install` implementation was kept in place to keep the git diff
  small.
* Test lives in pkg/dartdev/test/native_assets/ so that its not run
  on a shard and xcode and git commands are available.

TEST=pkg/dartdev/test/native_assets/run_remote_test.dart
Closes: https://github.com/dart-lang/sdk/issues/61588
Change-Id: I6a641c670a61da309027d3f82c90f4b59e70933b
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/+/457640
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-11-21 03:38:57 -08:00
Ryan Macnak 48d968e4e0 [dartdev] Use Mach-O for dart compile aot-snapshot on Mac.
Change-Id: I384955606f171bcdc2e9841dc0e315c62976a487
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456760
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-11-19 10:19:32 -08:00
Nate Biggs 79fa199a2b [dart2wasm] Introduce phases to dart2wasm.
To support internal compilations, dart2wasm must be able to run in
phases. There are a few reasons for this:

1) Kernel transforms are run on the program after the CFE has run. We
must emit a dill that frameworks can transform and then pass the
transformed dill back to dart2wasm.

2) This allows us to avoid forge limits by running each phase of the
compiler in separate blaze actions. TFA has the chance of running long
on large programs and so it might be beneficial to run it as its own
action.

This implementation currently supports 3 phases: "cfe", "tfa", "codegen"
They can be run collectively or in any consecutive combination. Phases
are specified via a '--phases' multi-option. Any data that needs to be
passed between the phases is encoded directly into the serialized dill.

This also opens up the opportunity to make "opt" its own phase that
runs wasm-opt on the wasm emitted from the codegen phase.

Change-Id: Ide830763f7063c7ab880e8e54dc47bd32fd4e7cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455280
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-10-17 09:38:40 -07:00
Daco Harkes de4e077ac6 [dartdev] Progress updates for running hooks
Shows a progress update on the interactive terminal for running hooks.
The progress update visually aligns with progress updates from pub
`Building package executable... (1.3s)` as
`Running build hooks... (0.7s)`.
Closes: https://github.com/dart-lang/native/issues/2439

Progress updates visibility:

* `dart run`, only if there are hooks to avoid cluttering stdout more.
  https://github.com/dart-lang/sdk/issues/61696
* `dart test`, also only if there are any hooks.
* `dart build`, always show progress update lines.
* `dart install`, always show progress updates lines.
* `dart compile`, changed the check to check for the existence of hooks
  but don't ever run them.

This CL also renames some "native assets" to "build hooks".

This CL also fixes an issue with `dart test` run without `pub get` in
a Flutter project.
Closes: https://github.com/dart-lang/sdk/issues/61697

Change-Id: I88f6e07dff1d4f5c0733f83f073640b75cc54e79
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/+/453920
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-10-09 05:42:33 -07:00
Ryan Macnak f1aa58931d [vm] Remove Isolate, IsolateGroup and global Random.
The per Thread instance is sufficient.

TEST=ci
Change-Id: Iff2c4279937637089f7ae4194cb1097b5e6eef67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452881
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-10-07 15:13:14 -07:00
Danny Tuppeny 8aa63bb86f [dartdev] Fix expected EOLs in some tests to prevent Windows failures
Not sure why these tests seemed to have only recently started failing, because `print` is documented as using `\r\n` on Windows so it seems like these should have always failed.

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

Change-Id: Ib5018394186583ae37fc17b51ec5ce4d25617494
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443300
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
2025-09-15 10:24:41 -07:00
Parker Lougheed 1368988487 [dartdev] Don't ignore the --define option in dart run
An earlier comment in the source specifies options have to be specified in both places to not be ignored.

Fixes https://github.com/dart-lang/sdk/issues/61373 which is a regression in current 3.10 beta and dev releases.

TEST=pkg/dartdev/test/commands/run_test.dart
Change-Id: Ideae8638dce8ff530f7c46735d6cd7e9cd9a2836
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446681
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-09-08 04:03:49 -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
Tess Strickland 7b70797304 [dartdev] Limit signed executable check in compile_test to ARM64 macOS.
On X64, executables are not required to be signed, and we only sign the
appended executable if the original dartaotruntime used for appending
was signed.

TEST=pkg/dartdev/test/commands/compile_test

Issue: https://github.com/dart-lang/sdk/issues/55455
Change-Id: Iec8f866423a76b93bb3a3cb9befce009bbdc78ef
Cq-Include-Trybots: luci.dart.try:pkg-mac-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443100
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2025-07-31 06:56:00 -07:00
Tess Strickland 77850b7ae1 [dartdev] Remove signed dartaotruntime test.
Now that more of dartdev (e.g., generating kernel) uses dartaotruntime,
modifying the built dartaotruntime with a adhoc non-linker-signed
signature causes this test and other tests following it to fail.

Instead, remove this test and just check that the binary generated
by `dart compile exe` is signed on MacOS.

TEST=pkg/dartdev/test/commands/compile_test

Fixes: https://github.com/dart-lang/sdk/issues/55455
Change-Id: If8f645aeccac617a550db7740343327ca8cd1e4a
Cq-Include-Trybots: luci.dart.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/+/442840
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-07-31 04:06:52 -07:00
Danny Tuppeny a56db1a680 [dartdev] "dart language-server": Only skip --protocol=lsp if the --protocol flag is passed
... and not just any flag starting with "protocol".

I believe the original code used `startsWith()` to try and catch both `--protocol` as its own flag, and `--protocol=` when combined with the value. However, it also caught `--protocol-traffic-log`. `wasParsed()` should handle both of the first cases without the latter.

I also unskipped the tests for Windows because the skip was added in 44cee12ebe (Jan 2021) because the `deleteDirectory()` call failed on Windows (file locking) but f40b06a8ac (Jan 2022) already fixed that.

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

Change-Id: I931a3f12dca2683167e999e7fe59bed18159eb73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441780
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-07-25 11:40:50 -07:00
asiva ab44b20ab8 Reapply "[VM/dartdev] Switch dartdev to use an AOT runtime." and
Add the fixes that were done after original CL landed.

This reverts commit 97bc401163.

TEST=ci

Change-Id: I26373aecc325e4c0c379c92e779aa301e3a58c5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441700
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-24 14:48:03 -07:00
Tess Strickland 7da04d0144 [dartdev] Factor out cross compilation tests into a separate test file.
Since current cross compilation tests are flaky due to being dependent
on the uploaded artifacts, separate them out into a separate file that
can be approved without hiding other failures in the compile test suite
until they can be more properly fixed.

Do some cleanup and refactoring to abstract out the common parts of the
cross compilation failure tests as well.

TEST=pkg/dartdev

Issue: https://github.com/dart-lang/sdk/issues/61181
Change-Id: I1bee602f6d19ebd175bd27f6aded7a1909d1944f
Cq-Include-Trybots: luci.dart.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,dart-sdk-linux-riscv64-try,dart-sdk-linux-arm64-try,dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-arm64-try,dart-sdk-win-try,dart-sdk-mac-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442060
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-07-24 10:41:40 -07:00
Tess Strickland 76ca835ada [dartdev] Add tests for cross compilation.
Separated out from https://dart-review.googlesource.com/c/sdk/+/440224
because cross compilation requires the binaries to have been uploaded
and so Windows -> Linux ARM would fail.

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

Issue: https://github.com/dart-lang/sdk/issues/28617
Change-Id: I0720bf259dbaf6c834e375c5948e22ab4bfbd38d
Cq-Include-Trybots: luci.dart.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,dart-sdk-linux-riscv64-try,dart-sdk-linux-arm64-try,dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-arm64-try,dart-sdk-win-try,dart-sdk-mac-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441200
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-07-23 02:56:30 -07:00
Devon Carew 953ac25ad1 Bump ai to 61ba1ea081dbc83c89b62bd65336328a71fda858
Changes:
```
> git log --format="%C(auto) %h %s" 64dfa7f..61ba1ea
 https://dart.googlesource.com/ai.git/+/61ba1ea Add more and better examples (228)
 https://dart.googlesource.com/ai.git/+/b77cda5 add a CI check that the readme file is up-to-date (192)
 https://dart.googlesource.com/ai.git/+/9c62524 Allow multiple package arguments to pub commands (226)
 https://dart.googlesource.com/ai.git/+/c1a1027 Started omitting instructions if they are null. (221)
 https://dart.googlesource.com/ai.git/+/9b007b3 Add failure reasons to tool call analytics events (219)
 https://dart.googlesource.com/ai.git/+/c8dc5da don't bail early when running in multiple roots (218)
 https://dart.googlesource.com/ai.git/+/2541b6c Remove VS Code mcp instructions in favor of Dart-Code setting. (206)
 https://dart.googlesource.com/ai.git/+/70daa1f release dart_mcp 0.3.0 (216)
 https://dart.googlesource.com/ai.git/+/a252a46 add retry logic to try and make dtd_test less flaky (214)
 https://dart.googlesource.com/ai.git/+/9e0b973 add a test that the arg parser library only depends on package:args (213)

```

Diff: https://dart.googlesource.com/ai.git/+/64dfa7f138aa4d9bcc06e807858136b7d4d296d3..61ba1ea081dbc83c89b62bd65336328a71fda858/
Change-Id: Ib63da49ddd084d89b0b9d9d664a7284c20e08f59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440684
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-07-16 11:55:50 -07:00
asiva 97bc401163 Revert "[VM/dartdev] Switch dartdev to use an AOT runtime."
This reverts commit 5399dbf6f6.

Reason for revert : Flutter rolls are failing

TEST=ci

Change-Id: I76fede849705514496adbc2ab7f6c262de4103ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439661
Reviewed-by: Jason Simmons <jsimmons@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-09 23:08:28 -07:00
asiva 5399dbf6f6 [VM/dartdev] Switch dartdev to use an AOT runtime.
- split the Dart CLI tool out of the VM into it's own embedder which
  runs in AOT mode. The pure Dart VM executable is called 'dartvm' and
  has no Dart CLI functionality in it
- the Dart CLI executable parses the CLI commands and invokes the rest
  of the AOT tools in the same process, for the 'run' and 'test'
  commands it execs a process which runs 'dartvm' to run
- 'dart hello.dart' execs the 'dartvm' process and runs 'hello.dart'
- the Dart CLI is not generated for ia32 as we are not shipping a
  Dart SDK for ia32 anymore (support to execute the 'dartvm' for ia32
  architecture is retained)
- the Dart CLI tool is not built in the internal Dart SDK builds

TEST=ci

Some performance improvement numbers
'dart format pkg/dartdev' goes from 1.17 secs to 0.22 secs
'dart doc pkg/dartdev' goes from 100.2 secs to 66.6 secs
'dart fix pkg/dartdev' goes from 19.3 secs to 14.5 secs

Change-Id: I66984a26cb2ab014b34dc1873f1f3d2884e13518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364202
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-07-04 13:22:13 -07:00
Parker Lougheed b9e9300b28 [dartdev] Update dependency constraints in templates
This primarily updates the templates to
use the v6 release of `package:lints`.

Change-Id: I8781b700a8719387827d14e7b4c35a349978f856
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437980
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2025-07-02 09:08:37 -07:00
Jake Macdonald 801fcf9277 Bump ai to 38734ffec837c55ecb8c657384c5db06d46ebd53
Changes:
```
> git log --format="%C(auto) %h %s" d0b89cf..38734ff
 https://dart.googlesource.com/ai.git/+/38734ff Migrate to the connected app service (208)
 https://dart.googlesource.com/ai.git/+/b7d438b disable the screenshots tool by default (210)
 https://dart.googlesource.com/ai.git/+/c230aaa expose public arg_parser.dart library (209)
 https://dart.googlesource.com/ai.git/+/7d7e7f9 Fix `--log-file` option so it doesn't crash the server. (207)
 https://dart.googlesource.com/ai.git/+/2676dec Add documentation for setting up the MCP server in popular clients (201)
 https://dart.googlesource.com/ai.git/+/6861301 Pin the SDK git ref and add caching on github actions (205)
 https://dart.googlesource.com/ai.git/+/6b84c96 update MCPClient.connectStdioServer to operate on streams and sinks (204)
 https://dart.googlesource.com/ai.git/+/04eee07 Fix readme link (203)
 https://dart.googlesource.com/ai.git/+/8aa3a8b add a github workflow for mcp_examples/ (191)
 https://dart.googlesource.com/ai.git/+/1af73bc auto validate tool arguments, improve validation messages (200)
 https://dart.googlesource.com/ai.git/+/0b22b67 Update to new MCP spec version (193)
 https://dart.googlesource.com/ai.git/+/a74efc3 Update `simple_client.dart` for updated `hello_world` tool name (194)

```

Diff: https://dart.googlesource.com/ai.git/+/d0b89cffe58d208ba7070c784ed855820997b004..38734ffec837c55ecb8c657384c5db06d46ebd53/
Change-Id: I014869b4da5b5ba97fecb83a19f6cdb1c02be5f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437920
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2025-07-01 08:05:38 -07:00
Jake Macdonald f856d0bb58 remove the need for the experimental flag for the dart MCP server
Closes https://github.com/dart-lang/ai/issues/167

Change-Id: Ib3555f3ef9a89704f9b3a501e909fbb3e6dc3f0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437820
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2025-06-30 14:20:42 -07:00
asiva b0838eac58 [dartdev] Fix for issue https://github.com/dart-lang/sdk/issues/60988
Parse and accumulate VM options only for the 'run' and 'test' commands.

TEST=ci

Change-Id: I50a4c7e12d5b212723ce6b17e0c1882b172a3a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437128
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-06-27 10:01:02 -07:00
Jake Macdonald 5e562b2383 add basic tests for the dart mcp-server command
Change-Id: I7c6071fc7b015f8d7e0cbdf4b2cb2d31358d442c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437140
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2025-06-26 13:24:40 -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
Sam Rawlins 3736a2817b dartdev: flip AOT flag for analysis-server-based commands
Work towards https://github.com/dart-lang/sdk/issues/50498

Work towards https://github.com/dart-lang/sdk/issues/53576

Change-Id: Idc34d6e1f0b0107391d26d0b531329fbc9645a00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435445
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-06-23 10:06:24 -07:00
Brian Wilkerson f36297e552 Fix an exception in a lint rule
Fixes https://github.com/dart-lang/sdk/issues/60927

Change-Id: I042adc05b7ff237aa7316f4cd101e0ffb5f33fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435244
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-18 09:16:31 -07:00
Ben Konyi 5ce8093b12 [ DartDev ] Fix create_integration_test.dart
Failures started appearing after package:build_runner was updated to
2.5.0 and changed some log messages tests were relying on.

Change-Id: I3c3c4ee173b48de94d8e1342003ca4f3d839c891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434842
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2025-06-16 10:28:46 -07:00
Ben Konyi 17c5356048 [ CLI ] Add support for --enable-asserts to dart compile jit-snapshot
Makes jit-snapshot more consistent with other compilation modes (e.g.,
exe, aot-snapshot, wasm).

Change-Id: I6ede1b9cd54b2e2ed368b5c60ace1f8e41afd359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434500
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-06-12 14:17:16 -07:00
Ben Konyi 60b217ff2d [ Observatory ] Remove Observatory from the Dart VM
Also cleans up some references to Observatory in various places.

Work towards https://github.com/dart-lang/sdk/issues/50233

TEST=N/A
CoreLibraryReviewExempt: Not modifying public core libraries.
Change-Id: I1f36b4e6f1fd9a59a579d719aafa599906eedb3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429141
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-11 15:19:55 -07:00
Brian Wilkerson 0dd4a95b3c Display correct line and column offsets for context messages
The line and column offsets for the context messages were being computed
based on line information for the file in which the diagnostic was being
reported, which can be different than the file pointed to by the context
message. This ensures that we use the right line info.

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

Change-Id: I6dbc95bde5aeb1abc70d90767dc59082982a5a96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-19 09:23:59 -07:00
Daco Harkes 245498232c [deps] Roll dart-lang/native
`package:native_assets_cli` has been split up and
`package:native_assets_builder` has been renamed.

Change-Id: Ic9d5c21bb3c7ecf7924fdee6b4281153ad37fac5
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-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425504
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-05-01 02:18:11 -07:00
Sam Rawlins 06f5db3480 dartdev: Enforce strict-raw-types
Change-Id: I593497edfbb05f0b524de4d18dc87ef7d1efdd2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425583
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-30 14:06:44 -07:00
Daco Harkes 108e40f31b [deps] Roll dart-lang/native
Change-Id: I418ca4177b64ec566d6e5afa876f6ab23c77a4f9
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-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425040
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-04-29 05:54:11 -07:00