@@ -30,6 +30,8 @@ const argHelp = 'help';
30
30
const argVmUri = 'vm-uri' ;
31
31
const argEnableNotifications = 'enable-notifications' ;
32
32
const argAllowEmbedding = 'allow-embedding' ;
33
+ const argAppSizeBase = 'appSizeBase' ;
34
+ const argAppSizeTest = 'appSizeTest' ;
33
35
const argHeadlessMode = 'headless' ;
34
36
const argDebugMode = 'debug' ;
35
37
const argLaunchBrowser = 'launch-browser' ;
@@ -90,6 +92,8 @@ Future<void> _serveDevToolsWithArgs(
90
92
: defaultTryPorts;
91
93
final bool verboseMode = args[argVerbose];
92
94
final String hostname = args[argHost];
95
+ final String appSizeBase = args[argAppSizeBase];
96
+ final String appSizeTest = args[argAppSizeTest];
93
97
94
98
if (help) {
95
99
print ('Dart DevTools version ${await _getVersion ()}' );
@@ -132,6 +136,8 @@ Future<void> _serveDevToolsWithArgs(
132
136
profileFilename: profileFilename,
133
137
verboseMode: verboseMode,
134
138
hostname: hostname,
139
+ appSizeBase: appSizeBase,
140
+ appSizeTest: appSizeTest,
135
141
);
136
142
}
137
143
@@ -155,6 +161,8 @@ Future<HttpServer> serveDevTools({
155
161
shelf.Handler handler,
156
162
String serviceProtocolUri,
157
163
String profileFilename,
164
+ String appSizeBase,
165
+ String appSizeTest,
158
166
}) async {
159
167
hostname ?? = 'localhost' ;
160
168
@@ -208,12 +216,27 @@ Future<HttpServer> serveDevTools({
208
216
_normalizeVmServiceUri (serviceProtocolUri).toString ();
209
217
}
210
218
211
- String url = devToolsUrl.toString ();
212
- // If serviceProtocolUri != null, add it to the url.
213
- if (serviceProtocolUri != null ) {
214
- url = Uri .parse (devToolsUrl).replace (queryParameters: {
215
- 'uri' : serviceProtocolUri,
216
- }).toString ();
219
+ final queryParameters = {
220
+ if (serviceProtocolUri != null ) 'uri' : serviceProtocolUri,
221
+ if (appSizeBase != null ) 'appSizeBase' : appSizeBase,
222
+ if (appSizeTest != null ) 'appSizeTest' : appSizeTest,
223
+ };
224
+ String url = Uri .parse (devToolsUrl)
225
+ .replace (queryParameters: queryParameters)
226
+ .toString ();
227
+
228
+ // If app size parameters are present, open to the standalone `appsize`
229
+ // page, regardless if there is a vm service uri specified. We only check
230
+ // for the presence of [appSizeBase] here because [appSizeTest] may or may
231
+ // not be specified (it should only be present for diffs). If [appSizeTest]
232
+ // is present without [appSizeBase], we will ignore the parameter.
233
+ if (appSizeBase != null ) {
234
+ final startQueryParamIndex = url.indexOf ('?' );
235
+ if (startQueryParamIndex != - 1 ) {
236
+ url = '${url .substring (0 , startQueryParamIndex )}'
237
+ '/#/appsize'
238
+ '${url .substring (startQueryParamIndex )}' ;
239
+ }
217
240
}
218
241
219
242
try {
@@ -494,6 +517,20 @@ ArgParser _createArgsParser(bool verbose) {
494
517
argProfileMemoryOld,
495
518
defaultsTo: 'memory_samples.json' ,
496
519
hide: true ,
520
+ )
521
+ ..addOption (
522
+ argAppSizeBase,
523
+ valueHelp: 'appSizeBase' ,
524
+ help: 'Path to the base app size file used for app size debugging.' ,
525
+ hide: true ,
526
+ )
527
+ ..addOption (
528
+ argAppSizeTest,
529
+ valueHelp: 'appSizeTest' ,
530
+ help: 'Path to the test app size file used for app size debugging. This '
531
+ 'file should only be specified if a base app size file (appSizeBase) '
532
+ 'is also specified.' ,
533
+ hide: true ,
497
534
);
498
535
499
536
// Args to show for verbose mode.
0 commit comments