Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tool/lib/commands/run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import '../utils.dart';
/// flag to this command.
class RunCommand extends Command {
RunCommand() {
argParser.addDebugServerFlag();
argParser
..addDebugServerFlag()
..addServeWithSdkOption();
}

@override
Expand Down
15 changes: 6 additions & 9 deletions tool/lib/commands/serve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const _buildAppFlag = 'build-app';
const _machineFlag = 'machine';
const _dtdUriFlag = 'dtd-uri';
const _allowEmbeddingFlag = 'allow-embedding';
const _serveWithDartSdkFlag = 'serve-with-dart-sdk';

/// This command builds DevTools in release mode by running the
/// `dt build` command and then serves DevTools with a locally
Expand Down Expand Up @@ -86,6 +85,7 @@ class ServeCommand extends Command {
' directly from the DevTools server.',
)
..addDebugServerFlag()
..addServeWithSdkOption()
..addUpdateFlutterFlag()
..addUpdatePerfettoFlag()
..addPubGetFlag()
Expand All @@ -105,12 +105,6 @@ class ServeCommand extends Command {
..addFlag(
_allowEmbeddingFlag,
help: 'Allow embedding DevTools inside an iframe.',
)
..addOption(
_serveWithDartSdkFlag,
help: 'Uses the specified Dart SDK to serve the DevTools server',
valueHelp:
'/Users/me/absolute_path_to/sdk/xcodebuild/ReleaseX64/dart-sdk/bin/dart',
);
}

Expand Down Expand Up @@ -156,7 +150,8 @@ class ServeCommand extends Command {
final runPubGet = results[SharedCommandArgs.pubGet.flagName] as bool;
final devToolsAppBuildMode =
results[SharedCommandArgs.buildMode.flagName] as String;
final serveWithDartSdk = results[_serveWithDartSdkFlag] as String?;
final serveWithDartSdk =
results[SharedCommandArgs.serveWithDartSdk.flagName] as String?;
final forMachine = results[_machineFlag] as bool;

// TODO(https://github.com/flutter/devtools/issues/8643): Support running in
Expand Down Expand Up @@ -188,7 +183,9 @@ class ServeCommand extends Command {
element.startsWith(SharedCommandArgs.buildMode.asArg()),
)
..removeWhere(
(element) => element.startsWith(valueAsArg(_serveWithDartSdkFlag)),
(element) => element.startsWith(
valueAsArg(SharedCommandArgs.serveWithDartSdk.flagName),
),
);

final localDartSdkLocation = Platform.environment['LOCAL_DART_SDK'];
Expand Down
10 changes: 10 additions & 0 deletions tool/lib/commands/shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ extension BuildCommandArgsExtension on ArgParser {
help: 'Enable debugging for the DevTools server.',
);
}

void addServeWithSdkOption() {
addOption(
SharedCommandArgs.serveWithDartSdk.flagName,
help: 'Uses the specified Dart SDK to serve the DevTools server',
valueHelp:
'/Users/me/absolute_path_to/sdk/xcodebuild/ReleaseX64/dart-sdk/bin/dart',
);
}
}

enum SharedCommandArgs {
Expand All @@ -89,6 +98,7 @@ enum SharedCommandArgs {
wasm('wasm'),
noStripWasm('no-strip-wasm'),
runApp('run-app'),
serveWithDartSdk('serve-with-dart-sdk'),
updateFlutter('update-flutter'),
updatePerfetto('update-perfetto');

Expand Down
Loading