Commit Graph

27 Commits

Author SHA1 Message Date
Michael Goderbauer
5491c8c146
Auto-format Framework (#160545)
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>
2024-12-19 20:06:21 +00:00
Parker Lougheed
1995a6cba1
Migrate away from deprecated whereNotNull (#157250) 2024-10-21 19:25:54 +00:00
Andrew Kolos
91813060c0
[tool] Guard more write/writeln calls on Process.stdin (#151146)
Contributes to fixing https://github.com/flutter/flutter/issues/137184.

This PR guards write calls in non-test files. This PR excludes
* packages/flutter_tools/lib/src/dart/analysis.dart due to a test timeout I would like to figure out in a separate PR and
* packages/flutter_tools/lib/src/compile.dart due to https://github.com/flutter/flutter/issues/151255
2024-07-23 19:27:52 +00:00
Danny Tuppeny
ce0e5c4330
[flutter_tools] Update the mapping for the Dart SDK internal URI (#151170)
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.
2024-07-02 22:56:17 +00:00
Danny Tuppeny
eb58fe16b6
[flutter_tools] Include more details in structured errors sent to a DAP client (#150698)
The debug adapter converts Flutter's structured errors into a text format to be sent to the debug client and shown in the console. When an error is not the first error since the last reload, it is shown as just a summary (since it may be caused by a prior error). In this mode, the filter was causing some important information (the erroring widget) to be omitted.

This tweaks the logic to include child nodes of a `DiagnosticBlock` in this mode.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4743

## Before:

![image](https://github.com/flutter/flutter/assets/1078012/46ccd2ef-b165-46b4-a8ab-4473f82a904c)

## After:

![image](https://github.com/flutter/flutter/assets/1078012/232f866e-cf6f-4016-9d1d-49323204da04)
2024-06-28 06:36:03 +00:00
Danny Tuppeny
e250c655d1
[flutter_tools/dap] Handle app.stop errors when launching/attaching (#149734)
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
2024-06-25 10:56:29 +00:00
Danny Tuppeny
89ef73e068
Roll pub packages + update DAP tests (#145349)
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).
2024-03-18 21:39:21 +00:00
Danny Tuppeny
86613d198e
[flutter_tool] [dap] Forward Flutter progress events to DAP client (#142524)
Builds can be slow and the legacy debug adapter would handle Flutter's `app.progress` events to update the toast notification during builds. This was lost in the new adapters - we should only a single "Launching.." notification for the whole progress.

This change listens to `app.progress` events and forwards those with `finished=false` to the client if the launch progress is still active.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4938

https://github.com/flutter/flutter/assets/1078012/8c60cf08-e034-4a72-b31e-9c61dca388bf
2024-02-15 22:22:48 +00:00
Alexander Aprelev
3b8f6c4020
Upgrade framework pub dependencies, roll engine with rolled dart sdk (#130163)
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.
2023-07-07 13:55:35 -07:00
Danny Tuppeny
dc4541fa05
[flutter_tools] Add support for vmServiceFileInfo when attaching (#128503)
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.
2023-06-16 18:00:21 +00:00
Danny Tuppeny
46007d61d2
[flutter_tools] [DAP] Don't try to restart/reload if app hasn't started yet (#128267)
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

![image](https://github.com/flutter/flutter/assets/1078012/a125b455-a46d-4993-98d8-5d8ae7237a00)

This change skips the call to `app.restart` if the app hasn't started yet to avoid printing an error.
2023-06-09 09:41:07 +00:00
Danny Tuppeny
1a6a20cdc6
[flutter_tools] Include mode in app.start event, and forward app.start to DAP clients (#121239)
[flutter_tools] Include mode in app.start event, and forward app.start to DAP clients
2023-04-05 05:39:09 +00:00
Danny Tuppeny
3494c08448
[flutter_tools/dap] Inform DAP client whether restart is supported (#121610)
[flutter_tools/dap] Inform DAP client whether restart is supported
2023-03-03 12:54:23 +00:00
Lioness100
26b6c1bedd
Fix typos (#121171)
* Fix typos

* lowercase animated & opacity

* Undo typo fix

---------

Co-authored-by: Michael Goderbauer <goderbauer@google.com>
2023-02-23 19:43:21 +00:00
Danny Tuppeny
09bd0f6613
Support logging 'flutter run' communication to DAP clients (#118674)
* Support logging 'flutter run' communication to DAP clients

Fixes https://github.com/Dart-Code/Dart-Code/issues/4266.

* Fix test
2023-01-19 23:50:33 +00:00
Helin Shiah
46e48ba3b4
Use program during attach if provided (#118130) 2023-01-09 11:27:47 -08:00
Ahmed Ashour
b9ead37244
Simplify null check. (#117026)
* Simplify null check.

* Simplify null check.

* Simplify null check.

* Fix.
2023-01-03 20:51:48 +00:00
Danny Tuppeny
9f9010f5e8
[flutter_tools] Update DAP progress when waiting for Dart Debug extension connection (#116892)
Fixes https://github.com/Dart-Code/Dart-Code/issues/4293.
2022-12-19 11:33:26 -05:00
Danny Tuppeny
a29796e339
[flutter_tools] Forward app.webLaunchUrl event from Flutter to DAP clients (#116275)
* [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>
2022-11-30 21:25:07 +00:00
Danny Tuppeny
51c517c03c
[flutter_tools/dap] Add support for forwarding flutter run --machine exposeUrl requests to the DAP client (#114539)
* [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
2022-11-09 19:16:47 +00:00
Danny Tuppeny
3b0f8335ee
[flutter_tools/dap] Add a base Flutter adapter class to avoid duplication between adapters (#114533) 2022-11-02 18:38:46 +00:00
Danny Tuppeny
307987339e
[flutter_tools/dap] Map org-dartlang-sdk URIs to the location of the source files found by the analyzer (#114369) 2022-11-02 17:07:58 +00:00
Danny Tuppeny
676a4264aa
[dap] Don't wait for appStarted before responding to launch/attach + don't call app.stop for unstarted app (#109386) 2022-08-25 15:35:09 +00:00
Danny Tuppeny
5d31b07ed5
[flutter_tools] [dap] Ensure DAP sends app.stop/app.detach during terminate (#108310)
* [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
2022-07-26 10:48:38 +01:00
Danny Tuppeny
78d924af1d
[flutter_tools] [dap] Add support for passing env variables to spawned processes (#107415)
* [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
2022-07-12 10:04:08 +01:00
Danny Tuppeny
801ad5cd5a
Don't terminate Dart process pids from VM Service, record flutter_tools VM pid (#100223)
* 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.
2022-03-23 16:31:31 +00:00
Danny Tuppeny
76758ef960
[dap] Don't use --start-paused when running in Profile/Release mode (#98926) 2022-02-24 17:06:24 -08:00