Commit Graph

779 Commits

Author SHA1 Message Date
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 592e5c144a [native assets] Support PATHEXT invocations with appended snapshot
This CL introduces an `IsolateData::asset_base_path` which contains
the fully resolved base path used for assets which are loaded with a
relative path. (Resolving both PATHEXT and symlinks.)

The asset base path is now only resolved once, instead of on every
relative asset load.

The asset base path is now eagerly resolved.
To prevent existing error messages for files not existing changing in
`dartdev` and `Isolate.spawnUri`, files not existing errors are
ignored.
To prevent `tests/standalone/io/named_pipe_script_test.dart` from
failing, failing to canonicalize a file path is treated as no asset
base path rather than reporting a failure.

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

Bug: https://github.com/dart-lang/sdk/issues/60946
Change-Id: I79a9144d220dfb3e54311725d41f8f91c88db3a1
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-win-release-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-android-release-arm64c-try,vm-aot-linux-debug-x64-try,vm-aot-mac-debug-arm64-try,vm-aot-win-debug-arm64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-msan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435421
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-06-26 07:47:32 -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
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
Nate Biggs c51bc84694 [dart2wasm] Add '--enable-bulk-memory' to set of features used in wasm.
This feature is required to support DataSegments in wasm which we use for large constant arrays:
https://github.com/dart-lang/sdk/blob/main/pkg/dart2wasm/lib/constants.dart#L793

Change-Id: Icda6745860da6d3f24632fc589b1796491819179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436743
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-06-25 00:25:10 -07:00
Martin Kustermann 0ff6daa3dd [dart2wasm] Enable specific binaryen features and not blindly enable all features
We should not blindly use `--all-features` as that will tell
binaryen that it may use any features in the resulting wasm file
(even features not even finalized yet).

The default dart2wasm (without extra opt-in by the user into more
wasm features) should only enable wasm features that we require
and are available in browsers at the point when they shipped
WasmGC.

Change-Id: Ifdcc31d938e29048b50be3fd5692693dc80ecbd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436604
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-06-24 06:50:33 -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
Daco Harkes bed1101ecf [native assets] Propagate OS error on invocation via PATHEXT
Native assets resolution will now fail with an error message similar
to:

```
Invalid argument(s): Couldn't resolve native function '<...>' in
'<...>' : Failed to canonicalize the script uri
'<path without extension>'. OS error: 'The system cannot find the file
specified.
```

Supporting PATHEXT will be done in a follow up CL.

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

Bug: https://github.com/dart-lang/sdk/issues/60946
Change-Id: I7db07b6c310ca8badd509c1d5d0595f671f1062d
Cq-Include-Trybots: luci.dart.try:pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435162
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-06-18 02:10:55 -07:00
Michael Goderbauer 77d75fc735 [dartdev] Use underscore for output dir name of dart build
Follow-up to https://dart-review.googlesource.com/c/sdk/+/433160.

This aligns us with how `dart --version` and `Abi.current` prints the
OS/architecture pair.

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
Bug: https://github.com/dart-lang/sdk/issues/60730
Change-Id: I8c56da29e5cd7c6222a7c5ed7e685501a279030f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435123
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Michael Goderbauer <goderbauer@google.com>
2025-06-17 09:40:13 -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
Daco Harkes 2bc4081118 [dartdev] dart build cli (Removes dart build)
This PR changes `dart build` to have subcommands, so that we can
have different bundle formats in the future.

Moreover, it changes the following:
* `exe` to `cli`. This mirrors `dart create --template cli`
* The output executable no longer has `.exe` on MacOS and Linux.
* The output bundle now contains a `bin/` dir with the executable.
* It removes the `--target-os` option, it would simply error on
  cross compilation. (And we don't want API parity with `dart
  compile exe`.)
* The default output directory is somewhere in `build/`. This aligns
  the behavior with Flutter. (`dart compile` puts the file next to
  the Dart file, which is a source directory.)

The executables and dylibs are signed with the ad hoc code signing
`"-"`. Users will need to resign in order to distribute.

New CLI interface:

```
$ dart build cli --help
Build a Dart application for the command line.

The CLI app bundle is structured in the following manner:

bundle/
  bin/
    <executable>
  lib/
    <dynamic libraries>


Usage: dart build cli [arguments]
-h, --help                   Print this usage information.
-o, --output=<path>          Write the output to <output>/bundle/.
                             This can be an absolute or relative path.
                             (defaults to "build/cli/macos-arm64/")
-t, --target=<path>          The main entry-point file of the command-line application.
                             Must be a Dart file in the bin/ directory.
                             If the "--target" option is omitted, and there is a single Dart file in bin/,
                             then that is used instead.
                             (defaults to "bin/native_add_app.dart")
    --verbosity=<level>      Sets the verbosity level of the compilation.

          [error]            Show only error messages
          [warning]          Show only error and warning messages
          [info]             Show error, warning, and info messages
          [all] (default)    Show all messages
```

This PR removes support for `dart build -f exe <target>`, as
`package:args` does not support having subcommands and not
having subcommands: `Could not find a subcommand named
"bin/native_add_app.dart" for "dart build".`

Bug: https://github.com/dart-lang/sdk/issues/60730
Change-Id: I2b527754f3186ec6d0809d7ac45e05984d5c0a02
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/+/433160
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-06-13 08:04:34 -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
Daco Harkes da5ae4786c [deps] Roll dart-lang/native
Adds support for dev dependencies with build hooks in `dart test`.

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

Change-Id: Ia05497ef5e1ec2bf11454fde8660b6626dcc524e
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/+/432621
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2025-06-03 02:47:25 -07:00
Konstantin Shcheglov 4580a03480 Roll dartdoc to 4ceea6b8240bf1dd9694a170368264e40c67d66b
Related to https://dart-review.googlesource.com/c/sdk/+/432125

Change-Id: I52f74bb83508469fc73373c3b849707b8aa914d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-02 13:30:51 -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 8ac2279b07 [native assets] Graduate to preview
This PR enables native assets on the main and dev channel by default,
and make native assets available on the beta channel.

This PR removes the flag from invocations.

The helper packages (`package:hooks` and `package:code_assets`) will
stay 0.x for now, until the SDK constraint can be bumped to a beta
release and we're happy with the Dart API.

`dart build` is also made available as preview (without a flag on
the main, dev, and beta channels). We're still finalizing the spec for
this command. (https://github.com/dart-lang/sdk/issues/60730)

`dart test` will need https://github.com/dart-lang/test/pull/2501.
This means users will need to update their `package:test` dependency.

This PR refactors the way that invalid `package_config.json`s are
handled: they are now loaded in the dartdev commands and handled there.

Bug: https://github.com/dart-lang/sdk/issues/50565
Project: https://github.com/orgs/dart-lang/projects/99/

Change-Id: I7db9ff6d7196750cab9379a4605c6bbf89a974d7
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/+/429920
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-05-21 06:10:19 -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 70a56b3947 [deps] Roll dart-lang/native
`dart pub get` will create a `package_graph.json` now. Ensure this
file exists (besides the `package_config.json`).

Change-Id: I6ed5e395f101c298a999f51d61b096659db70930
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/+/428600
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-05-15 03:08:52 -07:00
Derek Xu 0ead16d05b [VM] Make it so that --profile-microtasks is processed by the code in both runtime/bin/main_options.h and runtime/vm/flags.h
TEST=pkg/vm_service/test/timeline_events_for_completed_microtasks_test

Change-Id: Ia544cabc7bfe6e322955d16d3078cab461b803ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425100
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-05-13 14:29:37 -07:00
Sam Rawlins ac18236b6a dartdev: avoid mutating an immutable list
Not sure how I missed this error before. I may have not been
manually testing the right thing earlier.

Change-Id: I4516e646cd0b0ada9590c53ad39c0dc2cc60c6c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426700
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-05-08 11:14:42 -07:00
Sam Rawlins 80ad4befd6 dartdev: Add an AOT option to 'dart fix'
Work towards https://github.com/dart-lang/sdk/issues/50498

Change-Id: Ie09063325062e1b2c3b70d3a2a65df4c33c74095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425981
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-05-05 10:10:49 -07:00
Sam Rawlins 060e4e208c dartdev: Support running the AOT analyis_server snapshot for analyze command
The `dart analyze` command is quite separate from the `dart language-server` command. This CL adds support for `dart analyze`.

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

Change-Id: I60a846ae5d3452c2bb050bd07502084ff44b82c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425188
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-05-02 11:49:21 -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
Sam Rawlins a67b8c503e DAS AOT: check artifact exists; remove negated flag
Change-Id: Ic222050fd5a2e091ab8e2063c018fa8707614168
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424705
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-28 19:28:28 -07:00
Sam Rawlins 7e8f84b571 Add DAS AOT snapshot to SDK; can toggle with runtime dartdev flag
Change-Id: Idbef46ca62045022458d6d951f301ff4d6895cfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-24 18:06:38 -07:00
Ivan Inozemtsev c5dc292196 Remove --experimental-cross-compilation flag
The cross compilation will be supported in 3.8.

Change-Id: Icedd1fe51198558b5a62fc431d4699e63557a2ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424442
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-04-24 08:40:58 -07:00
Derek Xu 75311aefa8 [VM/Timeline] Add Microtask stream
TEST=runtime/vm/dart_api_impl_test.cc

Change-Id: Icb078489f3600ac0fb8b314ca3bf748f482a687e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422860
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-22 07:42:27 -07:00
Daco Harkes 6a74c59033 [deps] Roll dart-lang/native
Roll for https://github.com/dart-lang/native/issues/2187.

The `NativeAssetsBuildRunner` now checks the pubspec for valid
user-defines, errors if they are not valid, and loads them.
So, delete all code in dartdev which did this.

Change-Id: I34f5bba3f4a7c4847c9cd33901c2f0a2f915ea22
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/+/422720
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-04-16 09:53:33 -07:00
Danny Tuppeny f24d4d1653 [dartdev] Fix some tests to work under 'dart test'
Now that the SDK uses Pub Workspaces, using the test runner is enabled in Dart-Code. However there are some differences when using 'dart test' that caused some of these tests to fail - this change addresses them:

- Don't use Platform.script because it won't be the source Dart filename
- Make any `args` to `main()` optional
- Add calls to `test()` around some regression tests

I still have a few remaining failures locally, but I'm not yet sure if they're related to the test runner and will troubleshoot them separately.

Change-Id: I01efc5517174ae7e8146892bba1d84cc69029fd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421162
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-04-15 07:45:39 -07:00
Daco Harkes e5d926da8c [native assets] Use workspace pubspec for user-defines
Native assets are cached for the whole pub workspace. So to avoid
invalidating caches for running hooks from different root packages,
only read user-defines from the workspace `pubspec.yaml`.

Bug: https://github.com/dart-lang/native/issues/39
Bug: https://github.com/dart-lang/native/issues/2187

Change-Id: I3aeb91455a418004d3e28c231dc1f5d002c15739
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/+/422101
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-04-11 12:04:21 -07:00
Daco Harkes 423479c4c9 [native assets] Fix pub workspaces in dart test
Bug: https://github.com/dart-lang/sdk/issues/60489

We can land a fix in `package:test` as well. However, projects
referring to an older version of test will not see such fixes.
So, land a workaround here that is picked up by older versions of test.

Change-Id: Ib26be2c0edc1bccf58b7231e05896cd55ac0cf19
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/+/421741
Reviewed-by: Hossein Yousefi <yousefi@google.com>
2025-04-11 12:04:21 -07:00
Parker Lougheed f0eeb22579 [dartdev] Update dependencies of 'web' template
Primarily updates package:web past v1 to avoid usages of the major deprecation removals.

Change-Id: Iadf614c533a043ba3821d241548cc47a68a30558
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421500
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2025-04-11 11:05:50 -07:00
Robert Nystrom 1345cdf399 Roll dart_style 3.1.0 into the SDK.
Change-Id: I6392327cadce5194dabaa719bff945868a690225
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419990
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2025-04-10 23:55:02 -07:00
Daco Harkes edde8133b7 [deps] Roll dart-lang/native
The dart-lang/native packages do no longer have path dependencies in
them. So instead of rewriting those paths in the tests, write
dependency overrides into the test projects.

To simplify path handling, use absolute paths in the dependency
overrides.

Change-Id: I0db8529543a280fe937465e9a9c9aa4bb8fd0ee1
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/+/420900
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2025-04-08 23:37:10 -07:00
Derek Xu 9d2f622f38 [dartdev] Introduce dart run --resident --quiet
Fixes: https://github.com/dart-lang/sdk/issues/56865
Change-Id: I1a88ba40351ed1b42bb1a800b384a00eb7548225
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418740
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-07 11:49:24 -07:00
Daco Harkes 17558d5f9d [native assets] Support user-defines from pubspec
Change-Id: I9978bbb3bae0170b76f9419e18f4b18f75dab577
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/+/420700
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
2025-04-07 09:58:40 -07:00
Daco Harkes 8e71bac222 [deps] Roll dart-lang/native
Change-Id: Iafb418d4769de9d4fdf000e29de51bfcdef5b67b
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/+/420661
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
2025-04-07 09:58:40 -07:00
Ivan Inozemtsev 2d80285a45 SDK Cache fixes for dartdev cross compilation
- Use `signed` stage only for executables (dartaotruntime is not signed)
- Ensure user-executable bit only for executables
- Fix Windows path issue (https://github.com/dart-lang/sdk/issues/60462)

Change-Id: I012c6df34174e292979610dabf1e9a5f486ef39e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420101
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2025-04-03 06:50:10 -07:00
Ivan Inozemtsev 9c88769967 Dartdev cross compilation support
- Add `target-arch` option to `dart compile exe|aot-snapshot`
- Add artifacts cache in `~/.dart`, and download gen_snapshot and
  dartaotruntime from cloud storage if necessary

I've manually built an aot snapshot and exe on macOS ARM64 for Linux
X64, copied them over to a linux machine, and made sure they work.

Change-Id: I74dd581ecb573ff4069a2fe19f9d04aaa352538e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417801
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-02 08:14:28 -07:00
Daco Harkes 90aecc4fe8 [deps] Roll dart-lang/native
Change-Id: Ic8a01cf2cd93d0f4ad89478efc0d412b2ab39039
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/+/418580
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-03-31 02:34:09 -07:00
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -07:00
Ömer Ağacan 55d57541cb [dart2wasm] Fix --extra-compiler-option parsing
Don't split the `--extra-compiler-option` values by commas, to allow
passing `-D`/`--define` flags like `-DFOO=a, b` as one argument.

Fixes the dart2wasm failure in #60346.

Change-Id: I9c621f93d4bcd4e35926e495735c8d15a3bac212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416581
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-03-19 05:36:17 -07:00
Ömer Ağacan f4b41f0902 [dart2wasm] Fix handling of --define/-D
When parsing `--define` or `-D` arguments don't split the the value by
commas.

This is consistent with how dart2js handles `-D`, but inconsistent with
how VM handles it.

Example:

    void main() {
      print(const String.fromEnvironment("FOO"));
    }

When compiled with `dart compile js -DFOO="a, b"` and run, dart2js
prints

    a, b

VM prints (when compiled to exe)

    a

Between these two, I think dart2js' behavior is more common, so we
follow dart2js.

Also update compile_benchmark to avoid splitting a single argument "a b"
into "a" and "b" when parsing the arguments and then splicing them back
before calling `dart2wasm`.

Also update the test runner and ddc batch mode argument parser to handle
splitting quoted arguments in `// dart2jsOption = ...` and the same
options for ddc and dart2wasm, by moving dart2js's `splitLine` to a new
library and reusing it in the test runner and ddc.

Fixes https://github.com/flutter/flutter/issues/164873.

See also https://github.com/dart-lang/sdk/issues/60341 for relevant
future work.

Change-Id: Idbdf69072fa212c8e4a390990577eb5a57b49e8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415280
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2025-03-18 04:11:41 -07:00
Sigurd Meldgaard 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00