OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 import 'package:analyzer/src/generated/source.dart' show Source; | 6 import 'package:analyzer/src/generated/source.dart' show Source; |
7 import 'package:analyzer/src/summary/package_bundle_reader.dart' | 7 import 'package:analyzer/src/summary/package_bundle_reader.dart' |
8 show InSummarySource; | 8 show InSummarySource; |
9 import 'package:args/args.dart' show ArgParser, ArgResults; | 9 import 'package:args/args.dart' show ArgParser, ArgResults; |
10 import 'package:args/command_runner.dart' show UsageException; | 10 import 'package:args/command_runner.dart' show UsageException; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 bool _changed(List<int> list1, List<int> list2) { | 84 bool _changed(List<int> list1, List<int> list2) { |
85 var length = list1.length; | 85 var length = list1.length; |
86 if (length != list2.length) return true; | 86 if (length != list2.length) return true; |
87 for (var i = 0; i < length; ++i) { | 87 for (var i = 0; i < length; ++i) { |
88 if (list1[i] != list2[i]) return true; | 88 if (list1[i] != list2[i]) return true; |
89 } | 89 } |
90 return false; | 90 return false; |
91 } | 91 } |
92 | 92 |
93 void _compile(ArgResults argResults, void printFn(Object obj)) { | 93 void _compile(ArgResults argResults, void printFn(Object obj)) { |
94 var compiler = | |
95 new ModuleCompiler(new AnalyzerOptions.fromArguments(argResults)); | |
96 var compilerOpts = new CompilerOptions.fromArguments(argResults); | |
97 if (argResults['help']) { | 94 if (argResults['help']) { |
98 printFn(_usageMessage); | 95 printFn(_usageMessage); |
99 return; | 96 return; |
100 } | 97 } |
| 98 var compiler = |
| 99 new ModuleCompiler(new AnalyzerOptions.fromArguments(argResults)); |
| 100 var compilerOpts = new CompilerOptions.fromArguments(argResults); |
101 var outPaths = argResults['out'] as List<String>; | 101 var outPaths = argResults['out'] as List<String>; |
102 var moduleFormats = parseModuleFormatOption(argResults); | 102 var moduleFormats = parseModuleFormatOption(argResults); |
103 bool singleOutFile = argResults['single-out-file']; | 103 bool singleOutFile = argResults['single-out-file']; |
104 if (singleOutFile) { | 104 if (singleOutFile) { |
105 for (var format in moduleFormats) { | 105 for (var format in moduleFormats) { |
106 if (format != ModuleFormat.amd && format != ModuleFormat.legacy) { | 106 if (format != ModuleFormat.amd && format != ModuleFormat.legacy) { |
107 _usageException('Format $format cannot be combined with ' | 107 _usageException('Format $format cannot be combined with ' |
108 'single-out-file. Only amd and legacy modes are supported.'); | 108 'single-out-file. Only amd and legacy modes are supported.'); |
109 } | 109 } |
110 } | 110 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 '\n\n${_argParser.usage}'; | 203 '\n\n${_argParser.usage}'; |
204 | 204 |
205 void _usageException(String message) { | 205 void _usageException(String message) { |
206 throw new UsageException(message, _usageMessage); | 206 throw new UsageException(message, _usageMessage); |
207 } | 207 } |
208 | 208 |
209 /// Thrown when the input source code has errors. | 209 /// Thrown when the input source code has errors. |
210 class CompileErrorException implements Exception { | 210 class CompileErrorException implements Exception { |
211 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; | 211 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; |
212 } | 212 } |
OLD | NEW |