Commit Graph

491 Commits

Author SHA1 Message Date
Moritz 81daf8e563 Use package:record_use
- Rename resource identifiers in the VM to usage recordings.
- Use package:record_use for serialization.
- Rename and use the experimental flag for this feature.
- Recognize tear-offs and top-level methods as well.

Next steps:

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

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

Change-Id: I8af3625165f78925ae943711245af93a239d1012
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2024-09-12 08:47:53 +00:00
Daco Harkes 086b7d00ee [dartdev] dart build error on conflicting dylib names
Change-Id: I4fcb5ac774719d237f437af66ffe4f9783a6dd0c
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/+/383986
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-09-06 19:30:31 +00:00
Daco Harkes 5f93efd89c [dartdev] Run pub get on dart test with native assets
Closes: https://github.com/dart-lang/sdk/issues/54160
Change-Id: Ic66fc1bc235ebcd869e779624dbf7f0aee4425a4
Cq-Include-Trybots: luci.dart.try:pkg-linux-release-arm64-try,pkg-linux-debug-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/+/383985
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-09-06 19:29:57 +00:00
Daco Harkes a261846de1 [dartdev] Don't delete project with dart build
Closes: https://github.com/dart-lang/sdk/issues/54144
Change-Id: I23f423d273427d4a2d5fd34053dfbe06b5917fda
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/+/384060
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-09-06 19:29:04 +00:00
Martin Kustermann 0e620b27a0 [dart2wasm] Align test outcomes of dart2wasm across configurations
Aligns exit codes of

  * `dart compile wasm` and
  * `pkg/dart2wasm/tool/compile_benchmark`

Also make them use exit codes recognized by the test runner to
distinguish CFE crashes, CFE compile-time-errors and other failures.

Also update status file entries to from D8 specific entries
to JS commandline shell entries

=> Step towards aligning D8 & JSC test results

Change-Id: I1acb8803f5db7c732ad546d5989b1c555583e7c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383660
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-09-05 11:22:18 +00:00
Konstantin Shcheglov 2aa54ab42c Parts. Fix unnecessary_import before landing the reporting CL.
https://dart-review.googlesource.com/c/sdk/+/382901 will start
reporting it in more cases.

Change-Id: I3ae1d407f37a317f33cb98977b0e6eb08de75065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383221
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-03 03:51:29 +00:00
Martin Kustermann 98cf417f4d [dart2wasm] Align -O4 flag in dart2wasm with dart2js behavior
Change-Id: I3a122639258570d7abbbd4f727760533f658b090
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382564
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-08-30 13:25:39 +00:00
Nate Biggs f00e9b1b29 [dart2wasm] Add --minimize-rec-groups to binaryen flags
This new flag uses a new algorithm to generate the module's type section. The new algorithm is able to produce smaller type sections reducing the overall size of the wasm binary.

For flute.complex at -O4 using this flag produced a wasm file 2.5% smaller.

Change-Id: Iaa7905174c496d637dc3d8d4533df6fd6f056597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382462
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-08-28 15:14:39 +00:00
Simon Binder ca77beac58 [dart2wasm] Fix multi root invocations
`dart2wasm` supports the `--multi-root` argument and respective URIs as
inputs.
`build_runner` uses the multi root argument when compiling with dart2js
as it allows a file system layout like this, placing `lib/` contents of
packages into folders next to non-lib assets of the root package being
compiled:

```
input/
  args/
  async/
  .../
  other_packages/
  web/
    index.html
    main.dart
```

While it looks like `dart2wasm` is supposed to support the same
arguments as well, the way it parses URI flags and a pre-check in
`dartdev` unfortunately prevent this.
This fixes `dartdev` to not check for inputs when a multi-root argument
is given, as the paths are not physical paths from the operating system
in that case.
It also fixes the `UriOption` in `dart2wasm` to be consistent with how
input arguments are resolved, allowing multi-root scheme URIs to be
used as arguments for e.g. `--packages`.

Change-Id: If751a5ee58938d5c7c62e27a69957456d8eea860
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377662
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-08-15 17:24:37 +00:00
Martin Kustermann 07da83d321 [dart2wasm] Simplify source map flag code in dart compile wasm
After [0] lands we can remove a workaround in `dart compile wasm` that
checks for `--extra-compiler-option=--no-source-maps`.

[0] https://github.com/flutter/flutter/pull/153417

Change-Id: I19f4da96e198d73e2309652aa2aa08d5e2c72d48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380461
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-08-14 10:00:49 +00:00
Martin Kustermann 075c443f2e [dart2wasm] Make dart compile wasm understand not to generate source maps on --no-source-maps as well as --extra-compiler-option=--no-source-maps
When `flutter build web --wasm` run passed
`--extra-compiler-option=--no-source-maps` it caused the compiler not to
generate source maps, but `dart compile wasm` thought it does and tried
and use the file, which causses an issue.

We can remove this workaround once this CL rolls up to flutter and we
change `--extra-compiler-option=--no-source-maps` to `--no-source-maps`.

Bug: https://github.com/flutter/engine/pull/54487
Change-Id: I82c56ab7d1bc09e53919a6b72b0b1771215d8d25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380000
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-08-12 08:39:47 +00:00
Ömer Sinan Ağacan 1b1740e941 [dart2wasm] Pass source maps to wasm-opt when optimizing
To be able to know when we are generating a source map, make `dart
compile wasm` aware of the `--no-source-maps` flag.

The "name" segments of source mappings are also made `null` with this
patch. Browsers don't use that segment and binaryen doesn't support it.

Change-Id: I7b52c8fb7cef92ed60547e97ad137e0cd3967f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378421
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-08-09 14:23:29 +00:00
Keerti Parthasarathy 372099dd63 [dart fix]Check if both the apply and dry-run flags are specified.
Fixes https://github.com/dart-lang/sdk/issues/55524

Change-Id: Ia7c751adb2d52ea2dd9f3fdda21f1ea439a1f120
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-08-07 21:27:19 +00:00
Ben Konyi 639cc322f1 [ CLI ] Fix issue where Platform.executable on Windows could return 'dart'
When running the VM from PATH using 'dart', Platform.executable could report
the process name as 'dart' instead of 'dart.exe'. This change updates dartdev
to handle this case so the checkArtifactExists call doesn't fail to find the
'dart' binary.

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

Change-Id: I1d2e87e3f1b9841ca2b23d1e16bb53dc0f2183a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377542
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-08-01 18:59:34 +00:00
Ben Konyi e9be5dc4aa [ CLI ] Fix issue where 'dart build' would fail to find the 'dart' when run from PATH
Fixes https://github.com/dart-lang/sdk/issues/56080

Change-Id: I301b6959e372c2ad8b72ce055645b5affce5516e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376860
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-07-22 13:57:56 +00:00
Daco Harkes 7d4280022c [native_assets] Stop running link hooks in JIT mode
Note that the `add_asset_link` example project has it's build hook
`exit(nonZero)` because the project only works with link hooks
enabled.
Therefore, the test expectations for `dart run` is that it fails, and
for `dart build` that it succeeds.

Bug: https://github.com/dart-lang/native/issues/1252
Change-Id: I8566d1289a079078586a2e6149f5b77e641618f9
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/+/375100
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
2024-07-10 11:28:47 +00:00
Danny Tuppeny 3c66c16122 [dtd] Move DTD implementation classes from lib/ to lib/src/ to avoid src/ files importing from lib/
Fixes https://github.com/dart-lang/sdk/issues/56178

Change-Id: I1f461e0f9c787e69eade7a5e4806c0a85bb23c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374981
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2024-07-09 19:55:17 +00:00
Daco Harkes fb9cdeee2d [native_assets] Pass MacOS version to build and link hook
Also fixes the list of asset types supported.

Change-Id: If18704e8718a96ea07bad1758a84f3b8e625d059
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/+/374820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
2024-07-08 16:03:58 +00:00
Danny Tuppeny 499277c690 [dtd] Add support for '--disable-service-auth-codes'
See https://github.com/dart-lang/sdk/issues/54932

Change-Id: Ie85eb76eb5e8c01dda957d038286ae498748ca70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373340
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-07-03 14:51:43 +00:00
Ben Konyi 4abd615d32 [ CLI ] Update checkArtifactExists check to allow for Links in addition to Files
Related issue: https://github.com/dart-lang/sdk/issues/56080

Change-Id: I9b630ea3488e3f030cd92c593a4ee3bb4d718dd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373380
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-06-26 17:18:17 +00:00
Parker Lougheed 96eb11f052 Update various flutter.dev links to more stable destinations
Bug: https://github.com/flutter/website/issues/10363
CoreLibraryReviewExempt: Just updating link in API doc.
Change-Id: I6c4dc17206410fa86e88b4630c8056a994e18967
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372381
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2024-06-20 19:30:02 +00:00
Danny Tuppeny c001d5116a [analyzer] Prioritize errors in analysis_options/pubspec errors when running "dart analyze"
This changes the (non-machine/json) output of "dart analyze" when there are errors in pubspec.yaml/analysis_options.

Before:

```
Analyzing myapp...

  error • analysis_options.yaml:3:1 • Expected ':'. Parse errors in analysis_options.yaml may result in other incorrect diagnostics. • parse_error
  error • lib\main.dart:1:16 • A value of type 'Null' can't be returned from the function 'foo' because it has a return type of 'int'. • return_of_invalid_type

2 issues found.
```

After:

```
Analyzing myapp...

Errors were found in pubspec.yaml or analysis_options.yaml which may result in other incorrect errors.

  error • analysis_options.yaml:3:1 • Expected ':'. Parse errors in analysis_options.yaml may result in other incorrect diagnostics. • parse_error

Errors in other files that might be caused by those above.

  error • lib\main.dart:1:16 • A value of type 'Null' can't be returned from the function 'foo' because it has a return type of 'int'. • return_of_invalid_type

2 issues found.
```

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

Change-Id: I25ae7b200463f2cd3f2046ea9f5f8ddc5c62cc60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372080
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-18 17:29:16 +00:00
Danny Tuppeny d4c2b91a14 [analyzer]/[analysis_server] Handle parse errors in analysis_options.yaml better + tweak unhandled exception text
Fixes the main issues at https://github.com/dart-lang/sdk/issues/55987

Change-Id: I5b86f7c0df4017c02b96e67d8d8d03b71933b318
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371861
Reviewed-by: Sam Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-17 23:15:51 +00:00
Martin Kustermann 18ffc284c3 [dart2wasm] Remove deprecated --name-section flag from dart compile wasm
Change-Id: I1e1746c408a704d23db1dbf05b554afda667a0ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371540
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-06-14 06:50:18 +00:00
Ben Konyi 6b788d2a77 [ Service / DDS ] Re-introduce explicit cast to remove dynamic invocation of operator[]
Fixes failures in type flow analysis tests introduced by https://dart.googlesource.com/sdk/+/cf9623f3d9520bc58b7d3cba146934b69dba1d8f

TEST=pkg/vm/testcases/transformations/type_flow/transformer/bench_vector.dart

Change-Id: I401d12d42a64c64537722ef346dd86b1eff78f84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371140
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-06-12 16:34:17 +00:00
Ben Konyi cf9623f3d9 [ DDS ] Update DDS launch sites to assume DDS process closes stderr
Removes risk of DDS connection information being split across two stream
events, causing JSON decoding to fail.

Also updates DDS to close stderr, even in the error case.

TEST=Existing service and dartdev tests

Change-Id: I5cceab899aac1fa63bd7578dd658b34096722bd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371000
Reviewed-by: Derek Xu <derekx@google.com>
2024-06-11 18:41:01 +00:00
Ben Konyi 8e00ebc689 [ CLI ] Fix snapshot detection logic for google3
google3 makes heavy use of symlinks, with no guarantee that the relative
location of files with respect to each other will be maintained after
the symlinks are resolved. This causes issues when trying to locate the
DartDev snapshot using the VM executables resolved path as a base.

This change updates the DartDev snapshot detection logic to first try to
find the snapshot using the resolved executable path before falling back
to using the unresolved path used to launch the VM (e.g., the path
specified by argv[0]).

TEST=pkg/dartdev/test/

Change-Id: I19a41c440ac82cbc671dafb3bda23a31fb4cdc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370000
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-06-06 19:10:19 +00:00
Martin Kustermann a98ce03e13 [dart2wasm] Add --(no-)strip-wasm flag and deprecate --(no-)name-section
`flutter build web --wasm`
  * uses the `--(no-)strip-wasm` flag for stripping
  * by default it strips the wasm file in `--release` mode

=> We align `dart compile wasm` to use the same flag and have the same
   default.

After this CL rolled into flutter, we can make flutter pass the new flag
down and remove the old `--name-section` flag.

Change-Id: I6dc6be86a3a90f14617bc795843b0e54f54fa761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369062
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-05-31 13:17:38 +00:00
Parker Lougheed fef2ba30a6 [dartdev] Avoid unnecessary uses of late
Change-Id: I702e5c91e803b06dd1321efe563c104bc00c19d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368740
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-05-30 14:55:21 +00:00
Danny Tuppeny 3833a7bd3e [dartdev]/[analysis_server] Report server errors to "dart analyze" to prevent misleading output for parse/analysis exceptions
If analysis failed due to an exception, "dart analyze" may still report "no issues found" because it didn't get any server errors.

It didn't get server errors for a number of reasons:

1. Analysis errors were silent (see https://github.com/dart-lang/sdk/issues/39284)
2. `server` in ErrorNotifier was always `null` because the code that set it did so too early
3. `ErrorNotifier` was never added to the instrumentation service, so never got called anyway

Additionally, "dart analyze" printed "No errors found!" even if server errors occurred (as long as the server didn't crash).

This change fixes up the server reference in ErrorNotifier, adds it to the instrumentation service and uses a new flag ("--disable-silent-analysis-exceptions") to allow opting-in to getting analysis errors to the client. It also updates "dart analyze" to not print "No errors found!" (and to not use a 0 exit code) when server errors occur.

Because this change "fixes" ErrorNotifier, it's possible that with this change clients will now get additional error notifications (non-silent exceptions that were being dropped previously) which could result in users seeing more errors - but presumably errors that should have been reported before anyway.

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

Change-Id: I4948117c78b8f382550b7641076de443250bba6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358902
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-05-28 19:10:40 +00:00
Martin Kustermann 004d6a3fad [dart2wasm] Remove experimental warning for dart compile wasm and make dart compile --help show the wasm subcommand
Closes https://github.com/dart-lang/sdk/issues/32894

Change-Id: Ief15c21bb28de8df6ef9aefbb8891d9af9368626
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368307
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-05-28 11:02:48 +00:00
Vyacheslav Egorov 945153584c [dartdev] Add --depfile option to dart compile
I would like to add an option to our BUILD
files to precompile gen_kernel and
compile_platform to speedup iteration cycles
when working on core library changes.

To make this robust I would like to use
depfile to track dependencies and know
when compile_platform should be
recompiled.

TEST=pkg/dartdev/test/commands/compile_test.dart
R=kustermann@google.com

Change-Id: Id674f7353342c8275a8a0c4a70e3f5eaeb7f05d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367023
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-05-23 12:58:29 +00:00
Martin Kustermann 8fa0675a6d [dart2wasm] Make optimized builders run with --use-sdk (and therefore dart compile wasm)
This gives some more coverage for `dart compile wasm`

Change-Id: I62e7f9c6ecbdf80a1445c35d1733a7f89e6bcf54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366623
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-05-17 13:08:31 +00:00
Martin Kustermann 328ae02be1 [dart2wasm] Remove --dart-sdk option from various places
The CFE's [CompilerOptions] object currently has 3 properties

* `CompilerOptions.sdkDir`: The sdk directory
   => Will use `<sdkDir>/lib/libraries.json` to compile corelibs

* `CompilerOptions.librariesSpecPath`: The libraries.json file
   => Will compile corelibs using this libraries.json

* `CompilerOptions.sdkSummary`: The platform.dill file
   => No need to compile corelibs as platform file is given.

=> Passing any of these is sufficient for the CFE to run.

This CL therefore mandates that either one passes the platform file or
the libraries.json file to dart2wasm. There's no need to also accept the
sdk dir.

As flutter still passes `--dart-sdk` (as well as platform file) - we
simply ignore that flag for the moment, until flutter's usage was
removed.

Change-Id: I4c3b1a7bf87f98e51ceb2e6adfaec4f4a6ce2202
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366821
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-05-17 11:31:58 +00:00
Martin Kustermann 3b02e41af1 [dart2wasm] Make dart compile wasm accept --enable-experiment flags and pass those to compiler
This is a preparation for making CI bot to run using `dart compile wasm`
instead of `pkg/dart2wasm/tool/compile_benchmark`.

Change-Id: I804d9392a8993cddc7a01afdd345ba9ee9a83374
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366820
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-05-17 08:29:20 +00:00
Martin Kustermann 110219a532 [dart2wasm] Make dart compile wasm use platform file instead of compiling SDK from sources
This shaves around 1 second of a `dart compile wasm hello.dart`

Change-Id: I6a7a7620d71c7af81b2617959f952f025dd25d4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366802
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-05-17 07:41:58 +00:00
Daco Harkes b6207ebdb4 [deps] Roll dart-lang/native
Adds the missing argument to `link`.

Change-Id: I8a9d167b046ac301e5274a5062e30d6c186ac257
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/+/366381
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Hossein Yousefi <yousefi@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-05-16 17:12:17 +00:00
Ben Konyi 219e61e0e8 [ CLI ] Simplify check for SDK root
Removes the check for the `gen` directory when trying to identify a
non-standard SDK root. This allows for the non-standard SDK in google3
to correctly load snapshots.

TEST=CQ

Change-Id: I9766ca83a02b19b1c059c13f06e4894e0ec03ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366200
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-05-13 19:21:30 +00:00
Ben Konyi 5f3cd4afe3 [ CLI ] Implicitly set --mark-main-isolate-as-system-isolate for dart test
Fixes https://github.com/flutter/flutter/issues/143170

TEST=test_test.dart

Change-Id: I98044ab2362adcdd55c4f6def0752a755b1385b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366040
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2024-05-10 19:28:45 +00:00
Devon Carew 16582003dd [dart cli] update to use package:lints 4.0.0
Change-Id: Ib32d88739b17aeb1a7aadc8b8650cd0c86161af9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365982
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-05-10 17:53:26 +00:00
Moritz ec4e420698 Add link.dart hook
Adding a linking script support, see go/resource-shaking. The goal is to run a `link.dart` script after kernel compilation complimentary to `build.dart` running before.

Change-Id: Iadc8648ae5fa2e823b6541c5bc08617bb860a017
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/+/338380
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2024-05-08 16:04:12 +00:00
Michael Thomsen 138573ebfd Update compile status output
Fixes https://github.com/dart-lang/sdk/issues/55526

Change-Id: I30515a7e104f62fc43f6abc018cbb0614b2ed5e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365462
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-05-06 17:46:41 +00:00
Alexander Markov 9ee25d3ce1 Cleanup unsound mode from pkg/vm, frontend_server and dart2native
TEST=ci

Change-Id: Ica8b8b68f69e8f4a8cd5af3375da4a9ff0947c35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364602
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-04-29 14:18:01 +00:00
Ben Konyi 7af23509d1 [ CLI ] Handle improperly formatted package_config.json in warnOnNativeAssets
Fixes https://github.com/dart-lang/sdk/issues/55490

Change-Id: I50a5fa43b79312c0d1236d543ad050de2ee6c9dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364240
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-04-23 20:16:12 +00:00
Kevin Moore 05764ff967 pkg/dartdev: drop pkg:usage
Remove unused events code that was the only thing referencing it

Change-Id: I1a0a4f40b95c2a1d3c8f0812ca278a282d9f4134
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363424
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2024-04-18 15:51:34 +00:00
Alexander Markov 6d4817b147 Disable --no-sound-null-safety in 'dart compile', front-end server and gen_kernel
Change 'dart compile', front-end server and gen_kernel tools to reject
--no-sound-null-safety option as unsound mode is no longer supported.

TEST=ci

Change-Id: I4f6e87865bf206a27958caee4088272b4e397608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363340
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-04-18 13:34:17 +00:00
Derek Xu defa4d76a3 [CLI] Account for SDK version changes that happen between when resident frontend compilers are started and when they are used
TEST=test case added to pkg/dartdev/test/commands/run_test.dart

Issue: https://github.com/dart-lang/sdk/issues/54245
Fixes: https://github.com/dart-lang/sdk/issues/55349
Change-Id: Ic3db064d0975e6b999beefed8b6fc32d2c603cff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362522
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-04-17 20:48:55 +00:00
Derek Xu aa4aa6975d [CLI] Add ResidentCompilerInfo class
TEST=test case added to
pkg/dartdev/test/resident_frontend_utils_test.dart

Issue: https://github.com/dart-lang/sdk/issues/54245
Change-Id: I5b1d5227657cb9c17d6c4e84be9e23d36c04571f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362521
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-04-12 21:23:59 +00:00
Derek Xu 48e13f6078 [CLI] Introduce shutDownOrForgetResidentFrontendCompiler utility
function

TEST=test cases added to
pkg/dartdev/test/commands/compilation_server_test.dart and
pkg/dartdev/test/commands/run_test.dart

This CL factors out shutDownOrForgetResidentFrontendCompiler from the
CompilationIssue.serverError handling code in RunCommand. This CL also
changes the error handling logic of `dart run --resident` and
`dart compilation-server shutdown` to stop them from displaying
unactionable errors to the user, and instead have them handle those
errors more gracefully.

Issue: https://github.com/dart-lang/sdk/issues/54245
Change-Id: I214392911dbb44e3273ffd36f8f59f791b33494c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362520
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-04-12 21:23:59 +00:00
Ben Konyi 802c80458e [ CLI ] Support --enable-asserts for aot-snapshot and exe compile modes
Fixes https://github.com/dart-lang/sdk/issues/53343

TEST=compile_test.dart

Change-Id: Ic99988fe253b8c6dd2a03121ba7d0a525633c7cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361960
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-04-09 17:58:02 +00:00