Unverified Commit b080a476 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Fuchsia multiple devices and target (#24953)

parent f8a7abb6
...@@ -22,6 +22,8 @@ final ArgParser parser = ArgParser() ...@@ -22,6 +22,8 @@ final ArgParser parser = ArgParser()
..addOption('build-dir', help: 'The fuchsia build directory') ..addOption('build-dir', help: 'The fuchsia build directory')
..addOption('dart-sdk', help: 'The prebuilt dart SDK') ..addOption('dart-sdk', help: 'The prebuilt dart SDK')
..addOption('target', help: 'The GN target to attach to') ..addOption('target', help: 'The GN target to attach to')
..addOption('entrypoint', defaultsTo: 'main.dart', help: 'The filename of the main method. Defaults to main.dart')
..addOption('device', help: 'The device id to attach to')
..addFlag('verbose', negatable: true); ..addFlag('verbose', negatable: true);
// Track the original working directory so that the tool can find the // Track the original working directory so that the tool can find the
...@@ -50,10 +52,11 @@ Future<void> main(List<String> args) async { ...@@ -50,10 +52,11 @@ Future<void> main(List<String> args) async {
fs.currentDirectory = path; fs.currentDirectory = path;
// Check for a package with a lib directory. // Check for a package with a lib directory.
String targetFile = 'lib/main.dart'; final String entrypoint = argResults['entrypoint'];
String targetFile = 'lib/$entrypoint';
if (!fs.file(targetFile).existsSync()) { if (!fs.file(targetFile).existsSync()) {
// Otherwise assume the package is flat. // Otherwise assume the package is flat.
targetFile = 'main.dart'; targetFile = entrypoint;
} }
final List<String> command = <String>[ final List<String> command = <String>[
'attach', 'attach',
...@@ -70,6 +73,10 @@ Future<void> main(List<String> args) async { ...@@ -70,6 +73,10 @@ Future<void> main(List<String> args) async {
'--packages', '--packages',
packages, packages,
]; ];
final String deviceName = argResults['device'];
if (deviceName != null && deviceName.isNotEmpty) {
command.addAll(<String>['-d', deviceName]);
}
if (verbose) { if (verbose) {
command.add('--verbose'); command.add('--verbose');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment