Commit Graph

629 Commits

Author SHA1 Message Date
Daco Harkes 3e020921c6 [dartdev] Delete and create dylibs instead of truncate
TEST=Tested locally. Will add a test case upstream in dart-lang/native
     and roll that in.

Bug: https://github.com/dart-lang/native/issues/2921
Change-Id: I8010131cc70afe5bcee30edf076f18efe0c9a8c4
Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-01-07 03:52:21 -08:00
Daco Harkes 42249a3713 [dartdev] dart compile report which packages have hooks
Closes: https://github.com/dart-lang/sdk/issues/62320

Change-Id: I45d51abf0d50725f57cabe7e0b662ceaad88edc0
Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471180
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Michael Goderbauer <goderbauer@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2026-01-07 01:23:35 -08:00
Simon Binder d2ee7a3207 [dartdev] Use dart build cli in Dockerfile template
This updates the `Dockerfile` generated by `dart create` with the
`server-shelf` template to use `dart build cli` instead of `dart
compile exe`. The benefit of using the `build` command is that it runs
hooks and bundles code assets. These assets should also be present in
the container image.

TEST=Tested manually (create template, build image, run)

Change-Id: Ia8ccbba4ea6631ec6d5bb8866fd59ae4821375ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470661
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2026-01-05 03:29:09 -08:00
Ömer Ağacan 7213d50d92 [dart2wasm] Fix --strip-wasm handling in dart compile CLI
`dart compile wasm` currently checks `--strip-wasm` and passes it along
if it's set.

This doesn't do anything because `--strip-wasm` is already the default
in dart2wasm, and `dart compile wasm` never passes `--no-strip-wasm`.

Instead of passing `--strip-wasm`, pass `--no-strip-wasm`.

To help debugging this kind of thing future, `--verbose` output is
improved:

- Print `--strip-wasm` flag value with other flag values.
- When running `wasm-opt` print the `wasm-opt` flags.

Change-Id: Iaa24836a439294badf5470446a2bb83031a79a98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/469582
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-12-29 01:59:03 -08:00
Slava Egorov c058785219 [dartdev] Add info record-performance subcommand
This subcommand uses perf_witness recording functionality to record
performance timelines of all processes that opted into the recording.

Change-Id: I37fd9fc88e38853a77a105370e2020fc6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459745
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-12-16 06:19:25 -08:00
Daco Harkes 10373c30e8 [dartdev] Run remote empty version
Fixes: https://github.com/dart-lang/sdk/issues/62122
Change-Id: Id8331c58d968b6c92cfe7c1ae9be75d80260e772
Cq-Include-Trybots: luci.dart.try:pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-linux-release-try,pkg-linux-debug-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467803
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-12-15 06:39:16 -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
Moritz 0ccb213c8f Fix new lines in build.dart
Fixes errors of the sort

```
mosum@mosum2:~/projects/i18n/pkgs/intl4x/example$ dart --enable-experiment=record-use build cli example.dart
There are multiple possible targets in the `bin/` directory, and the 'target' argument wasn't specified.mosum@mosum2
```

Change-Id: I7ed6dbd21838506c1fe60b6d69d6066406d3b7c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467842
Auto-Submit: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2025-12-12 09:35:19 -08:00
Ryan Macnak bfeebf0579 [dartdev] Fix dart compile with the simulators.
Change-Id: Id27ca35f440ee71e0d91e2f8a851dc8269de24e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466921
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-12-08 15:33:42 -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
Nate Biggs fdeb9dc575 [dart2wasm] Introduce an opt phase to dart2wasm.
To help facilitate this we move all IO into a separate helper
library/class. This makes it easier to have symmetric read/write
functions and to do IO within compile.dart where necessary.

Adding the new `opt` phase allows us to remove the duplicated code
between dartdev and compile_benchmark simplifying those two files a lot.
It will also allow us to more easily invoke wasm-opt within our internal
build pipeline.

For compile_benchmark we still run the opt phase independently (but
through dart2wasm) to keep the benchmark data as consistent as possible.

Change-Id: Iaa855dbc3a05abfedbc3eea4af32e3ba27e84600
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464640
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-12-01 21:50:29 -08:00
Daco Harkes d114ce5579 [dartdev] dart run <remote> --verbosity=error hide build hooks
progress

This enables running one-off commands via `dart run <remote>` and
only having the stdout from the program.

TEST=pkg/dartdev/test/native_assets/run_remote_test.dart

Bug: https://github.com/dart-lang/sdk/issues/61996
Change-Id: Ia60bd2b3754b407686718b33b1934d8687dac8d4
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-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464384
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
2025-11-26 02:16:19 -08:00
Daco Harkes 3785c8f4ea [dartdev] dart run --verbosity=error hide build hooks progress
This enables running `dart run` without the `stdout` containing
progress outputs.

TEST=pkg/dartdev/test/native_assets/run_test.dart

Closes: https://github.com/dart-lang/sdk/issues/61996
Change-Id: I35835db5be8e17623bdee0fc78b6a8e789a268e0
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-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464421
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
2025-11-26 02:16:19 -08:00
Daco Harkes b2e58f8467 [dartdev] Run hooks for dev dependencies in dart run
The user might want to access the assets from dev dependencies.
The Dart code might want to use dev dependencies. `dart run test`.

Closes: https://github.com/dart-lang/tools/issues/2237
Change-Id: Ib8c9b4a7f3f2dedb33777e1f29cb82fc678edd4f
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/+/462980
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
2025-11-24 02:18:01 -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
Martin Kustermann 72e3f7a0d4 [dart2wasm] Fix web/wasm/flute_stress_test in SDK mode
Currently `web/wasm/flute_stress_test` is failing on
`dart2wasm-linux-optimized-jsc` mode.

That mode runs with `--use-sdk` which makes it use `dart compile wasm`.

The reason the test is failing is because it passes both
`--enable-deferred-loading` and `--multi-module-stress-test` flags to
dart2wasm. This causes us to trigger the deferred module flow instead
of the specialized multi-module flow.

Those two flags should be independent.

Change-Id: I8cac976cd91d4e585f38632ada3062e41fce401f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458800
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-11-04 05:17:51 -08:00
Martin Kustermann d1e7fa76de Reland "[dart2wasm] Also use --traps-never-happen in deferred loading mode"
The dart2wasm compiler - when used in -O2 sound mode - should guarantee
that no wasm traps happen. So we should  be able to use
`--traps-never-happen` in deferred loading mode just like in normal
mode.

This saves around 1.2% in ACX Gallery

The original revert was done due to other reasons, not this CL.

Change-Id: I0c836c21cacf7a50417011aadac346f12b827a2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459280
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-11-03 03:27:39 -08:00
Paul Berry 475efb1708 Revert "[dart2wasm] Also use --traps-never-happen in deferred loading mode"
This reverts commit 6bcbc740e5.

Reason for revert: Broke pkg/dart2wasm/test/ir_test

Original change's description:
> [dart2wasm] Also use --traps-never-happen in deferred loading mode
>
> The dar2wasm compiler - when used in -O2 sound mode - should guarantee
> that no wasm traps happen. So we should  be able to use
> `--traps-never-happen` in deferred loading mode just like in normal
> mode.
>
> This saves around 1.2% in ACX Gallery
>
> Change-Id: I3d214b636b0bc2e8b18c2ef8c4bf0c86b19c23c8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458720
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Nate Biggs <natebiggs@google.com>

Change-Id: If51986574a7dc587b64b258278d763d51b3d28df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458900
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Paul Berry <paulberry@google.com>
2025-10-31 12:04:10 -07:00
Martin Kustermann 6bcbc740e5 [dart2wasm] Also use --traps-never-happen in deferred loading mode
The dar2wasm compiler - when used in -O2 sound mode - should guarantee
that no wasm traps happen. So we should  be able to use
`--traps-never-happen` in deferred loading mode just like in normal
mode.

This saves around 1.2% in ACX Gallery

Change-Id: I3d214b636b0bc2e8b18c2ef8c4bf0c86b19c23c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458720
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-10-31 01:22:55 -07:00
Sam Rawlins ac841ae559 DAS: use lowerCamelCase names in top-level driver
Change-Id: I24a99d8b94b291ab0c306456f89ff6cdcd4d148b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458065
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-29 08:37:10 -07: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
Martin Kustermann 6c228bff4a [dart2wasm] Add simple way to test IR changes
In order to test generated code for a function one can

  * place a dart file in `pkg/dart2wasm/tets/ir_tests`
  * annotate functions that shouldn't be inlined
  * describe which functions we want to dump in the expectation file
  * generate an expectation file.

This will allow generating renatively small expectation files for only
functions we care about and types/globals/... those functions need.

Change-Id: Ic7b6b6dece16ab453202aa2c4f9412de2fc251ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454840
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-10-15 14:25:20 -07:00
Daco Harkes 75da4db50a [dartdev] Fix pub get in dart build
The pub get was wrong on the wrong path, and the subsequent error was
not displayed.

Prevent the tests from not testing this scenario.

Closes: https://github.com/dart-lang/sdk/issues/61721
Change-Id: I88755251086f3d520fd97273f7703f6d85441692
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/+/454602
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
2025-10-14 02:41:02 -07:00
Danny Tuppeny da8ed2208e [dds/dap] Prevent exceptions writing to stdout.nonBlocking from going unhandled
Because we use `nonBlocking`, the stream closing with unflushed data can result in an unhandled exception. Since we're never interested in errors writing to the stream (there's nothing we can do if the output stream is closed, and it happens at the end of every session), we just discard the error.

Fixes https://github.com/dart-lang/sdk/issues/61193
Fixes https://github.com/dart-lang/sdk/issues/55685
Fixes https://github.com/dart-lang/sdk/issues/55313

Change-Id: I6e0a332708cd6e8eb3ae8bd60d45c9e117d897a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452440
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2025-10-13 09:19:06 -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
Nate Biggs 10be4da5dc [dart2wasm] Run wasm-opt local optimizations on deferred loading modules.
Output for ACX gallery (monolith):
```
acx_gallery.Time.Total(CompileTime): 216.80 s
acx_gallery.Time.Dart2Wasm(CompileTime): 88.37 s
acx_gallery.Time.Wasm2WasmOpt(CompileTime): 128.43 s
acx_gallery.Size.mjs(CodeSize): 421228 bytes
acx_gallery.Size.mjs.gz(CodeSize): 29255 bytes
acx_gallery.Size.wasm(CodeSize): 38083554 bytes
acx_gallery.Size.wasm.gz(CodeSize): 9040482 bytes
acx_gallery.Size.wasm.opt(CodeSize): 13147207 bytes
acx_gallery.Size.wasm.opt.gz(CodeSize): 3288834 bytes
acx_gallery.MemoryUse.Max(MemoryUse): 2398687232 bytes
acx_gallery.MemoryUse.Dart2Wasm(MemoryUse): 2359529472 bytes
acx_gallery.MemoryUse.Wasm2WasmOpt(MemoryUse): 2398687232 bytes
```

Output for ACX gallery (monolith -O0):
```
acx_gallery.Time.Dart2Wasm(CompileTime): 87.49 s
acx_gallery.Size.mjs(CodeSize): 421228 bytes
acx_gallery.Size.mjs.gz(CodeSize): 29255 bytes
acx_gallery.Size.wasm(CodeSize): 38466066 bytes
acx_gallery.Size.wasm.gz(CodeSize): 8509479 bytes
acx_gallery.MemoryUse.Dart2Wasm(MemoryUse): 2261155840 bytes
```

Output for ACX gallery (deferred):
```
acx_gallery.Time.Total(CompileTime): 138.03 s
acx_gallery.Time.Dart2Wasm(CompileTime): 92.67 s
acx_gallery.Time.Wasm2WasmOpt(CompileTime): 45.36 s
acx_gallery.Size.mjs(CodeSize): 422584 bytes
acx_gallery.Size.mjs.gz(CodeSize): 29610 bytes
acx_gallery.Size.wasm(CodeSize): 50639314 bytes
acx_gallery.Size.wasm.gz(CodeSize): 13063929 bytes
acx_gallery.Size.wasm.opt(CodeSize): 20308884 bytes
acx_gallery.Size.wasm.opt.gz(CodeSize): 5569508 bytes
acx_gallery.MemoryUse.Max(MemoryUse): 2165276672 bytes
acx_gallery.MemoryUse.Dart2Wasm(MemoryUse): 2165276672 bytes
acx_gallery.MemoryUse.Wasm2WasmOpt(MemoryUse): 454402048 bytes
```

Change-Id: Ia6627b94ff80019b3c180850a3940d7e714c068b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-10-06 10:28:40 -07:00
Daco Harkes b92bc35709 [dartdev] Make dart install from git test hermetic
Don't depend on an external repo, instead create a git repo locally.

TEST=pkg/dartdev/test/native_assets/install_test.dart
Closes: https://github.com/dart-lang/sdk/issues/61638
Change-Id: I61df102812814ba2b83fd65a6cc5f607daa531f7
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/+/453000
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-10-03 06:49:02 -07:00
Nate Biggs 5606a2640c [dartdev] Update dart install command to handle filesystem some errors
When running on a cloudtop, for example, the tmp space may be part of a
different filesystem than the user space where the package is being
registered. In this case a simple rename doesn't work, we have to copy
the files and delete the old one.

The script was also getting confused when a previous install failed. The
partial setup was leading to errors while trying to uninstall the old
verison.

Change-Id: I67f04547bc5279adc5f0d9f528cc9224c1f54e64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452000
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2025-09-29 09:13:36 -07: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
Nate Biggs 584cf9b608 [dartdev] Only require wasm-opt binary when compiling optimized wasm.
Passing tool test run: https://ci.chromium.org/ui/p/dart/builders/try.monorepo/flutter-linux-web-tool-tests-try/155/overview

Bug: https://github.com/dart-lang/sdk/issues/61540
Change-Id: I312d71bcb83ba5dd20a50e3934bf962217d1e88a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450580
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-09-19 10:45:14 -07:00
Daco Harkes 942989e76f [native_assets] Enable code assets for next stable release
Make it available on the stable branch.

Fix the version numbers for when it was enabled. (3.9 as experiment
enabled is not entirely correct, as the experiment was not available
on the stable channel in 3.9, only on betas of 3.9.)

And disable passing data assets under the same experiment flag.

Note: It seems that it was accidentally still marked as 3.9 and then
got swept up in https://dart-review.googlesource.com/c/sdk/+/443803.

TEST=dartdev native assets tests

Bug: https://github.com/dart-lang/sdk/issues/50565
Change-Id: I4c44ad22e32673d6a951017d0cf6d3374dd20429
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/+/449803
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-09-17 06:58:29 -07:00
Sigurd Meldgaard 42c214b96a Bump dartdoc to 53222e20f3a82211a038de4e1710fd57b0403652
Adapts dartdev to simplified interface

Changes:
```
> git log --format="%C(auto) %h %s" d683b47..53222e2
 https://dart.googlesource.com/dartdoc.git/+/53222e20 Small cleanup around generators (4096)
 https://dart.googlesource.com/dartdoc.git/+/43e623bc Remove duplicated getter in package_graph.dart (4094)
 https://dart.googlesource.com/dartdoc.git/+/435198fd Refactor handling of generateDocs:false (4095)
 https://dart.googlesource.com/dartdoc.git/+/8b4d03e6 Add test for dot shorthands in constant initializers (4093)
 https://dart.googlesource.com/dartdoc.git/+/e20f1beb Add tests for dot shorthands in annotations and default values (4092)
 https://dart.googlesource.com/dartdoc.git/+/4ac49cfd Remove unnecessary src imports (4090)
 https://dart.googlesource.com/dartdoc.git/+/64e4647d Add test for dot shorthands (4089)

```

Diff: https://dart.googlesource.com/dartdoc.git/+/d683b47abc407a3093c269f67ed4c66b98138d56..53222e20f3a82211a038de4e1710fd57b0403652/
Change-Id: Ieb533070f4943a525aab6f91fbc5cd01cd4a6fd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447720
Reviewed-by: Sarah Zakarias <zarah@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2025-09-05 03:12:21 -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 bb8df0760e [dart2native] Use Sdk for paths to host artifacts.
This allows `dart compile` to be used from the build root without a
fully built SDK.

Abstract out executable and dill retrieval in Sdk getters similar to how
snapshot retrieval was abstracted out.

Remove the hostDartAotRuntime parameter to generateKernelHelper, since
all callers always passed the same variable from generate.dart, and
instead retrieve it using Sdk.dartAotRuntime.

Remove all the top-level variables that contained paths in
dart2native.dart and generate.dart and replace their uses with
the appropriate Sdk getter.

TEST=ci

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
Change-Id: I92d8110faff135263a9fdf1c395759a52dab914b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442181
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2025-07-28 08:06:09 -07:00
Tess Strickland 63082bebbb [dartdev] Move sdk.dart from dartdev to dart2native.
Leave a stub in its place that re-exports package:dart2native/sdk.dart
and an implementation of checkArtifactExists, which used to be part of
the Sdk class, to limit the amount of changes needed.

This move is made so that followup CLs can use the Sdk class from
dart2native without causing a cyclic dependency.

TEST=ci

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
Change-Id: I492084031efce1e6747f93f2067249425fe9b922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442220
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-07-28 07:58:06 -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
Derek Xu 9b89266f43 [VM] Introduce --profile-startup CLI flag
TEST=pkg/vm_service/test/profile_startup_cli_flag_test

Change-Id: I39bf67bf3157fe5700f1a62822f1dc3159c9bc96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438980
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-07-24 12:04:17 -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 475122269b [pkg/dartdev] Enable Linux ARM cross-compilation on Windows.
The #ifdef block that would stop ARM cross-compilation on Windows
has been outdated for a few years now, as getting the target CPU features via TargetCPUFeatures is now handled appropriately on Windows.

TEST=ci, actual test depends on upload so will be in a followup CL

Issue: https://github.com/dart-lang/sdk/issues/28617
Change-Id: I9907145ec8fb97007769276cb3c6c2442ac9e17c
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/+/440224
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-07-18 04:33:22 -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
Tess Strickland 09d354f788 [pkg/dartdev] Use ~/.dart/dartdev/sdk_cache as the SDK cache directory.
Currently, the SDK cache for cross compilers uses ~/.dart if the user's
home directory exists. Instead, use ~/.dart/dartdev/sdk_cache to avoid
polluting the top level of ~/.dart with cache directories.

TEST=pkg/dartdev

Issue: https://github.com/dart-lang/sdk/issues/60922
Change-Id: Ifc69e2a53abc6627c65f4fb30f94b1c3c25c7064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438701
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-07-03 05:38:58 -07:00
Nate Biggs addbdcbd59 [dart2wasm] Add --dry-run flag to dart2wasm.
This new flag will run the CFE to create a kernel and then run a series of checks over the resulting kernel to look for errors that could block a wasm migration.

The compiler will then exit before actually starting the wasm compilation process. This means no output file will be emitted so callers must be aware of this.

This first CL is not meant to cover every check we could add here. It adds some initial checks and we can expand on this to include more in follow-up changes.

One of the checks implemented here is also provided by a lint. While ideally we would share code between lints and these checks, the delta in the CFE vs analyzer model makes that infeasible today.

Sample output:
```
Found incompatibilities with WebAssembly.

package:dryrun/test.dart 5:15 - Cannot test a JS value against String (3)
package:dryrun/test.dart 6:7 - JS interop class 'B' cannot extend Dart class 'A'. (2)
```

Bug: https://github.com/dart-lang/sdk/issues/60050
Change-Id: Ib2c8e3501cc42d57b86ebaa749359ce6c5dba974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437960
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-07-02 09:44:43 -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 d4ce254e32 use createArgParser from package:dart_mcp_server to support all args automatically
Bump ai to 64dfa7f138aa4d9bcc06e807858136b7d4d296d3

Changes:
```
> git log --format="%C(auto) %h %s" 38734ff..64dfa7f
 https://dart.googlesource.com/ai.git/+/64dfa7f move static argParser variable to a createArgParser function (212)
 https://dart.googlesource.com/ai.git/+/a5aa053 Bump actions/cache from 4.2.2 to 4.2.3 in the github-actions group (211)

```

Diff: https://dart.googlesource.com/ai.git/+/38734ffec837c55ecb8c657384c5db06d46ebd53..64dfa7f138aa4d9bcc06e807858136b7d4d296d3/
Change-Id: Ibbf884d4eaaaf07664567fa2efb655ed9e90f9c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438280
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-07-02 08:47:09 -07:00
Tess Strickland 438a14ca39 [pkg/dartdev] Allow cross compilation to Linux ARM/RISCV64.
Note that Linux ARM cross compilation is not currently supported
on Windows.

Follow-up CL to:

* https://dart-review.googlesource.com/c/sdk/+/437720
* https://dart-review.googlesource.com/c/recipes/+/437740

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/28617
Change-Id: Ia91c9fa44101f7b4202ab717fe1cba6a3470bf31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437760
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2025-07-02 07:57:26 -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
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
Ömer Ağacan 560b017773 [dart2wasm] Pass --enable-threads to wasm-opt
With --import-shared-memory we import a memory, which requires
--enable-threads flag to be passed to wasm-opt.

Change-Id: I25198344f8c918cec28b2b22262e2b9d70a137ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436923
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-06-25 08:13:11 -07:00