This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.
**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.
---------
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This changes the mapping for the Dart SDK inside Flutter from `org-dartlang-sdk:///third_party/dart/sdk` to org-dartlang-sdk:///flutter/third_party/dart/sdk`. This URI changed in https://github.com/flutter/engine/pull/51917 but was not caught by tests because they only tested a specific set of mappings and there were no integration tests checking what URIs were actually produced by a running app.
So, this change also adds an integration tests that ensures that a real running app produces URIs that are then correctly mapped.
Fixes https://github.com/Dart-Code/Dart-Code/issues/5164.
Two issues I noticed when I hit the issue at https://github.com/flutter/flutter/issues/149258
1. When the an app.stop event arrives from Flutter with an error, DAP does not pass that error back to the client so there's no visibility of the error.
2. If app.stop occurs but no app.start ever did, we leave the progress notification hanging around
This fixes both by handling app.stop and closing any open launch progress as well as passing any error to the client.
Fixes https://github.com/Dart-Code/Dart-Code/issues/5124
This manually rolls pub packages and updates some calls to use updated APIs that use `Uri` instead of file paths (since macro-generated sources don't exist as files on disk).
Manual roll is needed because incoming dart sdk requires updated version
vm_snapshot_analysis (>=0.7.4).
5ae09b8b4f...7c83ea3e85
```
7c83ea3e85 Reland "Manual roll Dart SDK from 2d98d9e27dae to 0b07debd5862 (21 revisions) (#43457)" (#43472)
9ef3e8d533 Roll Skia from 5eba922297bb to 93c92f97f5ab (2 revisions) (#43471)
```
Remove implementation of SuitePlatform from the test as well. Remove use
of fake cwd from SuitePlatform as it can't be properly faked.
When building the new SDK DAPs, this functionality was missed from the Flutter adapter (but added to the Dart CLI adapter).
As well as passing a VM Service URI directly, we support passing a file that can be polled for it.
This uses the same mechanism we use to obtain the VM Service URI from a Dart debug session (we run `dart --write-service-info=foo.json my_file.dart` and then poll that file which the VM will write) and is useful for users that have their own mechanism for launching an app (for example using custom Flutter embedders - see https://github.com/Dart-Code/Dart-Code/issues/3353) to provide a VM Service URI once the app is up and running.
Fixes https://github.com/Dart-Code/Dart-Code/issues/4577.
The editor is set to hot-reload-on-save by default so saving while the debug session is starting currently prints an error:
Failed to Hot Reload: app 'null' not found

This change skips the call to `app.restart` if the app hasn't started yet to avoid printing an error.
* [flutter_tools] Forward app.webLaunchUrl event from Flutter to DAP clients
Fixes https://github.com/Dart-Code/Dart-Code/issues/4292.
* Update packages/flutter_tools/lib/src/debug_adapters/flutter_adapter.dart
Co-authored-by: Christopher Fujino <fujino@google.com>
* Another static const instead of final
Co-authored-by: Christopher Fujino <fujino@google.com>
* [flutter_tools/dap] Add support for forwarding `flutter run --machine` requests to the DAP client
Currently the only request that Flutter sends to the client is `app.exposeUrl` though most of this code is generic to support other requests that may be added in future.
* Improve comment
* Fix thrown strings
* StateError -> DebugAdapterException
* Add a non-null assertion and assert
* Use DebugAdapterException to handle restartRequests sent before process starts
* Fix typo + use local var
* Don't try to actually send Flutter messages in tests because there's no process
* [flutter_tools] [dap] Ensure DAP sends app.stop/app.detach during terminate
Fixes an issue where the flutter_tester device may not be cleaned up correctly if we just terminate the Flutter process.
* Update integration test expectations
* Revert accidental commit
* [flutter_tools] [dap] Add support for passing env variables to spawned processes
* Use named args
* Use in-memory fs and FakePlatform
* Pass filesystem style to MemoryFileSystem
* Don't terminate Dart process pids from VM Service
These processes may be on another device, and in the case of attach the debugee should not be terminated anyway.