Chromium Code Reviews| Index: pkg/analyzer/lib/src/command_line/arguments.dart |
| diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart |
| index 939623d9d8ccda6a3280c8e1127d4faa7c1e03af..9b6e9f81f69d57a9fed1a88de6fd72d9f490739c 100644 |
| --- a/pkg/analyzer/lib/src/command_line/arguments.dart |
| +++ b/pkg/analyzer/lib/src/command_line/arguments.dart |
| @@ -227,10 +227,13 @@ ArgResults parse( |
| } |
| /** |
| - * Preprocess the given list of command line [args] by checking whether the real |
| - * arguments are in a file (Bazel worker mode). |
| + * Preprocess the given list of command line [args]. |
| + * If the final arg is `@file_path` (Bazel worker mode), |
| + * then read in all the lines of that file and add those as args. |
| + * Always returns a new modifiable list. |
| */ |
| List<String> preprocessArgs(ResourceProvider provider, List<String> args) { |
| + args = new List.from(args); |
|
Brian Wilkerson
2016/12/13 18:48:20
Is there a reason for creating a copy of the args
danrubel
2016/12/13 18:50:08
Yes. DDC expects that.
Brian Wilkerson
2016/12/13 19:02:16
I was looking for an answer to the question of "wh
danrubel
2016/12/13 19:09:13
Yes, they modify it :-)
I can revert this code ch
vsm
2016/12/13 19:14:33
Either is fine by me.
Brian Wilkerson
2016/12/13 19:18:33
Modifying the list seems strange, but given that,
|
| if (args.isEmpty) { |
| return args; |
| } |
| @@ -238,16 +241,15 @@ List<String> preprocessArgs(ResourceProvider provider, List<String> args) { |
| if (lastArg.startsWith('@')) { |
| File argsFile = provider.getFile(lastArg.substring(1)); |
| try { |
| - List<String> newArgs = args.sublist(0, args.length - 1).toList(); |
| - newArgs.addAll(argsFile |
| + args.removeLast(); |
| + args.addAll(argsFile |
| .readAsStringSync() |
| .replaceAll('\r\n', '\n') |
| .replaceAll('\r', '\n') |
| .split('\n') |
| .where((String line) => line.isNotEmpty)); |
| - return newArgs; |
| - } on FileSystemException { |
| - // Don't modify args if the file does not exist or cannot be read. |
| + } on FileSystemException catch (e) { |
| + throw new Exception('Failed to read file specified by $lastArg : $e'); |
|
Brian Wilkerson
2016/12/13 19:02:16
Also, it isn't clear to me that it helps to wrap t
danrubel
2016/12/13 19:09:13
I wanted it to be clear that the @filePath was the
Brian Wilkerson
2016/12/13 19:18:33
Ah. Makes sense.
|
| } |
| } |
| return args; |