Skip to content

Commit b8c5ecd

Browse files
emmanuel-pcommit-bot@chromium.org
authored andcommitted
Revert "[ package:dds ] Add null safety support"
This reverts commit a527411. Reason for revert: depends on package 'devtools_shared' that is not yet migrated. Original change's description: > [ package:dds ] Add null safety support > > Fixes #45756 > > TEST=service + DDS tests > > Change-Id: I6dd14d7f9fdee479a830c3b053dc3b00aa635202 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199800 > Commit-Queue: Ben Konyi <[email protected]> > Reviewed-by: Devon Carew <[email protected]> # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Icdaef3ac55d7ef302acd3f9c2538a41e52e4253a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200180 Reviewed-by: David Morgan <[email protected]> Commit-Queue: David Morgan <[email protected]>
1 parent 18483f3 commit b8c5ecd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+348
-298
lines changed

.dart_tool/package_config.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"constraint, update this by running tools/generate_package_config.dart."
1212
],
1313
"configVersion": 2,
14-
"generated": "2021-05-13T13:57:59.578937",
14+
"generated": "2021-05-11T11:47:02.674706",
1515
"generator": "tools/generate_package_config.dart",
1616
"packages": [
1717
{
@@ -252,11 +252,17 @@
252252
"packageUri": "lib/",
253253
"languageVersion": "2.3"
254254
},
255+
{
256+
"name": "devtools_server",
257+
"rootUri": "../third_party/devtools/devtools_server",
258+
"packageUri": "lib/",
259+
"languageVersion": "2.6"
260+
},
255261
{
256262
"name": "devtools_shared",
257263
"rootUri": "../third_party/devtools/devtools_shared",
258264
"packageUri": "lib/",
259-
"languageVersion": "2.12"
265+
"languageVersion": "2.3"
260266
},
261267
{
262268
"name": "diagnostic",

DEPS

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ vars = {
107107

108108
"chromedriver_tag": "83.0.4103.39",
109109
"dartdoc_rev" : "e6a9b7c536a85e49233c97bb892bbb0ab778e425",
110-
"devtools_rev" : "e138d55437a59838607415ef21f20bd6c4955dbc",
110+
"devtools_rev" : "12ad5341ae0a275042c84a4e7be9a6c98db65612",
111111
"jsshell_tag": "version:88.0",
112112
"ffi_rev": "f3346299c55669cc0db48afae85b8110088bf8da",
113113
"fixnum_rev": "16d3890c6dc82ca629659da1934e412292508bba",

pkg/dds/CHANGELOG.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# 2.0.0
2-
- **Breaking change:** add null safety support.
3-
- **Breaking change:** minimum Dart SDK revision bumped to 2.12.0.
4-
51
# 1.8.0
62
- Add support for launching DevTools from DDS.
73
- Fixed issue where two clients subscribing to the same stream in close succession

pkg/dds/bin/dds.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.10
6+
57
import 'dart:convert';
68
import 'dart:io';
79

@@ -26,7 +28,7 @@ Future<void> main(List<String> args) async {
2628
final remoteVmServiceUri = Uri.parse(args.first);
2729

2830
// Resolve the address which is potentially provided by the user.
29-
late InternetAddress address;
31+
InternetAddress address;
3032
final addresses = await InternetAddress.lookup(args[1]);
3133
// Prefer IPv4 addresses.
3234
for (int i = 0; i < addresses.length; i++) {
@@ -41,7 +43,7 @@ Future<void> main(List<String> args) async {
4143
final disableServiceAuthCodes = args[3] == 'true';
4244

4345
final startDevTools = args[4] == 'true';
44-
Uri? devToolsBuildDirectory;
46+
Uri devToolsBuildDirectory;
4547
if (args[5].isNotEmpty) {
4648
devToolsBuildDirectory = Uri.file(args[5]);
4749
}
@@ -53,7 +55,7 @@ Future<void> main(List<String> args) async {
5355
remoteVmServiceUri,
5456
serviceUri: serviceUri,
5557
enableAuthCodes: !disableServiceAuthCodes,
56-
devToolsConfiguration: startDevTools && devToolsBuildDirectory != null
58+
devToolsConfiguration: startDevTools
5759
? DevToolsConfiguration(
5860
enable: startDevTools,
5961
customBuildDirectoryPath: devToolsBuildDirectory,

pkg/dds/example/example.dart

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.10
6+
57
import 'package:dds/dds.dart';
68
import 'package:vm_service/vm_service_io.dart';
79

pkg/dds/lib/dds.dart

+18-16
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.10
6+
57
/// A library used to spawn the Dart Developer Service, used to communicate
68
/// with a Dart VM Service instance.
79
library dds;
@@ -39,12 +41,15 @@ abstract class DartDevelopmentService {
3941
/// default.
4042
static Future<DartDevelopmentService> startDartDevelopmentService(
4143
Uri remoteVmServiceUri, {
42-
Uri? serviceUri,
44+
Uri serviceUri,
4345
bool enableAuthCodes = true,
4446
bool ipv6 = false,
45-
DevToolsConfiguration? devToolsConfiguration,
47+
DevToolsConfiguration devToolsConfiguration = const DevToolsConfiguration(),
4648
bool logRequests = false,
4749
}) async {
50+
if (remoteVmServiceUri == null) {
51+
throw ArgumentError.notNull('remoteVmServiceUri');
52+
}
4853
if (remoteVmServiceUri.scheme != 'http') {
4954
throw ArgumentError(
5055
'remoteVmServiceUri must have an HTTP scheme. Actual: ${remoteVmServiceUri.scheme}',
@@ -60,15 +65,12 @@ abstract class DartDevelopmentService {
6065
// If provided an address to bind to, ensure it uses a protocol consistent
6166
// with that used to spawn DDS.
6267
final addresses = await InternetAddress.lookup(serviceUri.host);
63-
64-
try {
65-
// Check to see if there's a valid address.
66-
addresses.firstWhere(
67-
(a) => (a.type ==
68-
(ipv6 ? InternetAddressType.IPv6 : InternetAddressType.IPv4)),
69-
);
70-
} on StateError {
71-
// Could not find a valid address.
68+
final address = addresses.firstWhere(
69+
(a) => (a.type ==
70+
(ipv6 ? InternetAddressType.IPv6 : InternetAddressType.IPv4)),
71+
orElse: () => null,
72+
);
73+
if (address == null) {
7274
throw ArgumentError(
7375
"serviceUri '$serviceUri' is not an IPv${ipv6 ? "6" : "4"} address.",
7476
);
@@ -113,24 +115,24 @@ abstract class DartDevelopmentService {
113115
/// [DartDevelopmentService] via HTTP.
114116
///
115117
/// Returns `null` if the service is not running.
116-
Uri? get uri;
118+
Uri get uri;
117119

118120
/// The [Uri] VM service clients can use to communicate with this
119121
/// [DartDevelopmentService] via server-sent events (SSE).
120122
///
121123
/// Returns `null` if the service is not running.
122-
Uri? get sseUri;
124+
Uri get sseUri;
123125

124126
/// The [Uri] VM service clients can use to communicate with this
125127
/// [DartDevelopmentService] via a [WebSocket].
126128
///
127129
/// Returns `null` if the service is not running.
128-
Uri? get wsUri;
130+
Uri get wsUri;
129131

130132
/// The HTTP [Uri] of the hosted DevTools instance.
131133
///
132134
/// Returns `null` if DevTools is not running.
133-
Uri? get devToolsUri;
135+
Uri get devToolsUri;
134136

135137
/// Set to `true` if this instance of [DartDevelopmentService] is accepting
136138
/// requests.
@@ -178,8 +180,8 @@ class DartDevelopmentServiceException implements Exception {
178180

179181
class DevToolsConfiguration {
180182
const DevToolsConfiguration({
181-
required this.customBuildDirectoryPath,
182183
this.enable = false,
184+
this.customBuildDirectoryPath,
183185
});
184186

185187
final bool enable;

pkg/dds/lib/src/binary_compatible_peer.dart

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.10
6+
57
import 'dart:async';
68
import 'dart:convert';
79
import 'dart:typed_data';

pkg/dds/lib/src/client.dart

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.10
6+
57
import 'dart:async';
68

79
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
@@ -24,7 +26,7 @@ class DartDevelopmentServiceClient {
2426
WebSocketChannel ws,
2527
json_rpc.Peer vmServicePeer,
2628
) : this._(
27-
dds as DartDevelopmentServiceImpl,
29+
dds,
2830
ws,
2931
vmServicePeer,
3032
);
@@ -34,7 +36,7 @@ class DartDevelopmentServiceClient {
3436
SseConnection sse,
3537
json_rpc.Peer vmServicePeer,
3638
) : this._(
37-
dds as DartDevelopmentServiceImpl,
39+
dds,
3840
sse,
3941
vmServicePeer,
4042
);
@@ -165,8 +167,7 @@ class DartDevelopmentServiceClient {
165167
(parameters) => {
166168
'type': 'Size',
167169
'size': StreamManager
168-
.loggingRepositories[StreamManager.kLoggingStream]!
169-
.bufferSize,
170+
.loggingRepositories[StreamManager.kLoggingStream].bufferSize,
170171
});
171172

172173
_clientPeer.registerMethod('setLogHistorySize', (parameters) {
@@ -176,7 +177,7 @@ class DartDevelopmentServiceClient {
176177
"'size' must be greater or equal to zero",
177178
);
178179
}
179-
StreamManager.loggingRepositories[StreamManager.kLoggingStream]!
180+
StreamManager.loggingRepositories[StreamManager.kLoggingStream]
180181
.resize(size);
181182
return RPCResponses.success;
182183
});
@@ -192,8 +193,8 @@ class DartDevelopmentServiceClient {
192193
});
193194

194195
_clientPeer.registerMethod('getSupportedProtocols', (parameters) async {
195-
final Map<String, dynamic> supportedProtocols = (await _vmServicePeer
196-
.sendRequest('getSupportedProtocols')) as Map<String, dynamic>;
196+
final Map<String, dynamic> supportedProtocols =
197+
await _vmServicePeer.sendRequest('getSupportedProtocols');
197198
final ddsVersion = DartDevelopmentService.protocolVersion.split('.');
198199
final ddsProtocol = {
199200
'protocolName': 'DDS',
@@ -288,17 +289,17 @@ class DartDevelopmentServiceClient {
288289
String get defaultClientName => 'client$_id';
289290

290291
/// The current name associated with this client.
291-
String? get name => _name;
292+
String get name => _name;
292293

293294
// NOTE: this should not be called directly except from:
294295
// - `ClientManager._clearClientName`
295296
// - `ClientManager._setClientNameHelper`
296-
set name(String? n) => _name = n ?? defaultClientName;
297-
String? _name;
297+
set name(String n) => _name = n ?? defaultClientName;
298+
String _name;
298299

299300
final DartDevelopmentServiceImpl dds;
300301
final StreamChannel connection;
301302
final Map<String, String> services = {};
302303
final json_rpc.Peer _vmServicePeer;
303-
late json_rpc.Peer _clientPeer;
304+
json_rpc.Peer _clientPeer;
304305
}

pkg/dds/lib/src/client_manager.dart

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.10
6+
57
import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
68

79
import 'client.dart';
@@ -96,7 +98,7 @@ class ClientManager {
9698
pauseTypeMask |= PauseTypeMasks.pauseOnExitMask;
9799
}
98100

99-
clientResumePermissions[client.name!]!.permissionsMask = pauseTypeMask;
101+
clientResumePermissions[client.name].permissionsMask = pauseTypeMask;
100102
return RPCResponses.success;
101103
}
102104

@@ -109,10 +111,10 @@ class ClientManager {
109111
_clearClientName(client);
110112
client.name = name.isEmpty ? client.defaultClientName : name;
111113
clientResumePermissions.putIfAbsent(
112-
client.name!,
114+
client.name,
113115
() => _ClientResumePermissions(),
114116
);
115-
clientResumePermissions[client.name!]!.clients.add(client);
117+
clientResumePermissions[client.name].clients.add(client);
116118
}
117119

118120
/// Resets the client's name while also cleaning up resume permissions and
@@ -153,7 +155,7 @@ class ClientManager {
153155
}
154156
}
155157

156-
DartDevelopmentServiceClient? findFirstClientThatHandlesService(
158+
DartDevelopmentServiceClient findFirstClientThatHandlesService(
157159
String service) {
158160
for (final client in clients) {
159161
if (client.services.containsKey(service)) {
@@ -171,7 +173,7 @@ class ClientManager {
171173

172174
/// Mapping of client names to all clients of that name and their resume
173175
/// permissions.
174-
final Map<String?, _ClientResumePermissions> clientResumePermissions = {};
176+
final Map<String, _ClientResumePermissions> clientResumePermissions = {};
175177

176178
final DartDevelopmentServiceImpl dds;
177179
}

pkg/dds/lib/src/constants.dart

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.10
6+
57
abstract class RPCResponses {
68
static const success = <String, dynamic>{
79
'type': 'Success',

0 commit comments

Comments
 (0)