mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Revert "Revert "Send DAP events through DDS"" - only check for event handler when DDS URI is also set.
Original change reverted due to test failure: https://github.com/dart-lang/sdk/issues/43743#issuecomment-1601278402
This reverts commit 02b10e1321
.
Change-Id: Idb2cbffe18342c76d0cc062e5855c10a6df0e8f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310780
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
This commit is contained in:
parent
e56ef707eb
commit
5b3f7990e8
|
@ -6,6 +6,7 @@
|
|||
- [DAP] Fixed an issue that could leave breakpoints unresolved when adding/removing other breakpoints in a file.
|
||||
- Fixed a bug that was preventing clients from receiving `IsolateReload` events
|
||||
(see https://dartbug.com/49491).
|
||||
- Added notifications for DAP events.
|
||||
|
||||
# 2.9.0
|
||||
- Updated DDS protocol to version 1.6.
|
||||
|
|
|
@ -45,6 +45,8 @@ class DdsHostedAdapter extends DartDebugAdapter<DartLaunchRequestArguments,
|
|||
@override
|
||||
bool get terminateOnVmServiceClose => true;
|
||||
|
||||
final _dapEventsController = StreamController<Event>();
|
||||
|
||||
@override
|
||||
Future<void> debuggerConnected(vm.VM vmInfo) async {}
|
||||
|
||||
|
@ -121,4 +123,13 @@ class DdsHostedAdapter extends DartDebugAdapter<DartLaunchRequestArguments,
|
|||
throw potentialException;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void sendEventToChannel(Event event) {
|
||||
_dapEventsController.add(event);
|
||||
}
|
||||
|
||||
void setEventHandler(void Function(Event) eventHandler) {
|
||||
_dapEventsController.stream.listen(eventHandler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,6 +205,10 @@ abstract class BaseDebugAdapter<TLaunchArgs extends LaunchRequestArguments,
|
|||
event: eventType ?? eventTypes[body.runtimeType]!,
|
||||
body: body,
|
||||
);
|
||||
sendEventToChannel(event);
|
||||
}
|
||||
|
||||
void sendEventToChannel(Event event) {
|
||||
_channel.sendEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:dds_service_extensions/dap.dart';
|
||||
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
|
||||
|
||||
import '../dap.dart';
|
||||
|
@ -41,8 +43,20 @@ class DapHandler {
|
|||
};
|
||||
}
|
||||
|
||||
_handleEvent(Event event) {
|
||||
dds.streamManager.streamNotify(DapEventStreams.kDAP, {
|
||||
'streamId': DapEventStreams.kDAP,
|
||||
'event': {
|
||||
'kind': DapEventKind.kDAPEvent,
|
||||
'timestamp': DateTime.now().millisecondsSinceEpoch,
|
||||
'dapData': event,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _startAdapter(DdsHostedAdapter adapter) async {
|
||||
adapter.ddsUri = dds.uri;
|
||||
adapter.setEventHandler(_handleEvent);
|
||||
|
||||
// TODO(helin24): Most likely we'll want the client to do these
|
||||
// initialization steps so that clients can differentiate capabilities. This
|
||||
|
|
|
@ -13,7 +13,7 @@ dependencies:
|
|||
async: ^2.4.1
|
||||
browser_launcher: ^1.0.0
|
||||
collection: ^1.15.0
|
||||
dds_service_extensions: ^1.3.0
|
||||
dds_service_extensions: ^1.6.0
|
||||
dap: ^1.1.0
|
||||
devtools_shared: ^2.14.1
|
||||
http_multi_server: ^3.0.0
|
||||
|
@ -27,7 +27,7 @@ dependencies:
|
|||
sse: ^4.0.0
|
||||
stack_trace: ^1.10.0
|
||||
stream_channel: ^2.0.0
|
||||
vm_service: '>=11.0.0 <12.0.0'
|
||||
vm_service: '>=11.7.2 <12.0.0'
|
||||
web_socket_channel: ^2.0.0
|
||||
|
||||
# We use 'any' version constraints here as we get our package versions from
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:dap/dap.dart';
|
||||
import 'package:dds/dds.dart';
|
||||
import 'package:dds_service_extensions/src/dap.dart';
|
||||
import 'package:dds_service_extensions/dap.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:vm_service/vm_service_io.dart';
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
## 1.6.0
|
||||
- Made DAP extensions methods accessible in lib.
|
||||
|
||||
## 1.5.0
|
||||
- Added `DdsExtension.postEvent`.
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ extension DapExtension on vm.VmService {
|
|||
vm.addTypeFactory('DapResponse', DapResponse.parse);
|
||||
_factoriesRegistered = true;
|
||||
}
|
||||
|
||||
Stream<vm.Event> get onDAPEvent => onEvent(DapEventStreams.kDAP);
|
||||
}
|
||||
|
||||
class DapResponse extends vm.Response {
|
||||
|
@ -50,3 +52,19 @@ class DapResponse extends vm.Response {
|
|||
|
||||
final dap.Response dapResponse;
|
||||
}
|
||||
|
||||
extension DapEvents on vm.Event {
|
||||
dap.Event get dapData {
|
||||
assert(json != null);
|
||||
return dap.Event.fromJson(json!['dapData']);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class DapEventStreams extends vm.EventStreams {
|
||||
static const String kDAP = 'DAP';
|
||||
}
|
||||
|
||||
abstract class DapEventKind extends vm.EventKind {
|
||||
/// Notification that a DAP event occurred.
|
||||
static const String kDAPEvent = 'DAPEvent';
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
name: dds_service_extensions
|
||||
version: 1.5.0
|
||||
version: 1.6.0
|
||||
description: >-
|
||||
Extension methods for `package:vm_service`, used to make requests a
|
||||
Dart Development Service (DDS) instance.
|
||||
|
@ -11,7 +11,7 @@ environment:
|
|||
dependencies:
|
||||
async: ^2.4.1
|
||||
dap: ^1.0.0
|
||||
vm_service: ^11.0.0
|
||||
vm_service: ^11.7.2
|
||||
|
||||
# We use 'any' version constraints here as we get our package versions from
|
||||
# the dart-lang/sdk repo's DEPS file. Note that this is a special case; the
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
## 11.7.2
|
||||
- Make Event classes abstract to permit `dap` event stream extensions.
|
||||
|
||||
## 11.7.1
|
||||
- Expose RPC error codes that were defined in `package:dds`.
|
||||
|
||||
|
|
|
@ -2834,9 +2834,7 @@ class ErrorKind {
|
|||
}
|
||||
|
||||
/// An enum of available event streams.
|
||||
class EventStreams {
|
||||
EventStreams._();
|
||||
|
||||
abstract class EventStreams {
|
||||
static const String kVM = 'VM';
|
||||
static const String kIsolate = 'Isolate';
|
||||
static const String kDebug = 'Debug';
|
||||
|
@ -2853,9 +2851,7 @@ class EventStreams {
|
|||
|
||||
/// Adding new values to `EventKind` is considered a backwards compatible
|
||||
/// change. Clients should ignore unrecognized events.
|
||||
class EventKind {
|
||||
EventKind._();
|
||||
|
||||
abstract class EventKind {
|
||||
/// Notification that VM identifying information has changed. Currently used
|
||||
/// to notify of changes to the VM debugging name via setVMName.
|
||||
static const String kVMUpdate = 'VMUpdate';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: vm_service
|
||||
version: 11.7.1
|
||||
version: 11.7.2
|
||||
description: >-
|
||||
A library to communicate with a service implementing the Dart VM
|
||||
service protocol.
|
||||
|
|
Loading…
Reference in a new issue