OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Set of flags and options passed to the compiler | 5 /// Set of flags and options passed to the compiler |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
10 import 'package:cli_util/cli_util.dart' show getSdkDir; | 10 import 'package:cli_util/cli_util.dart' show getSdkDir; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 /// General options used by the dev compiler and server. | 117 /// General options used by the dev compiler and server. |
118 class CompilerOptions { | 118 class CompilerOptions { |
119 final SourceResolverOptions sourceOptions; | 119 final SourceResolverOptions sourceOptions; |
120 final CodegenOptions codegenOptions; | 120 final CodegenOptions codegenOptions; |
121 final RunnerOptions runnerOptions; | 121 final RunnerOptions runnerOptions; |
122 | 122 |
123 /// Whether to check the sdk libraries. | 123 /// Whether to check the sdk libraries. |
124 final bool checkSdk; | 124 final bool checkSdk; |
125 | 125 |
126 /// Whether to dump summary information on the console. | |
127 final bool dumpInfo; | |
128 | |
129 final bool htmlReport; | 126 final bool htmlReport; |
130 | 127 |
131 /// If not null, path to a file that will store a json representation of the | |
132 /// summary information (only used if [dumpInfo] is true). | |
133 final String dumpInfoFile; | |
134 | |
135 /// Whether to use colors when interacting on the console. | 128 /// Whether to use colors when interacting on the console. |
136 final bool useColors; | 129 final bool useColors; |
137 | 130 |
138 /// Whether the user asked for help. | 131 /// Whether the user asked for help. |
139 final bool help; | 132 final bool help; |
140 | 133 |
141 /// Whether the user asked for the app version. | 134 /// Whether the user asked for the app version. |
142 final bool version; | 135 final bool version; |
143 | 136 |
144 /// Minimum log-level reported on the command-line. | 137 /// Minimum log-level reported on the command-line. |
(...skipping 24 matching lines...) Expand all Loading... |
169 | 162 |
170 /// The base directory for [inputs]. Module imports will be generated relative | 163 /// The base directory for [inputs]. Module imports will be generated relative |
171 /// to this directory. | 164 /// to this directory. |
172 final String inputBaseDir; | 165 final String inputBaseDir; |
173 | 166 |
174 const CompilerOptions( | 167 const CompilerOptions( |
175 {this.sourceOptions: const SourceResolverOptions(), | 168 {this.sourceOptions: const SourceResolverOptions(), |
176 this.codegenOptions: const CodegenOptions(), | 169 this.codegenOptions: const CodegenOptions(), |
177 this.runnerOptions: const RunnerOptions(), | 170 this.runnerOptions: const RunnerOptions(), |
178 this.checkSdk: false, | 171 this.checkSdk: false, |
179 this.dumpInfo: false, | |
180 this.htmlReport: false, | 172 this.htmlReport: false, |
181 this.dumpInfoFile, | |
182 this.useColors: true, | 173 this.useColors: true, |
183 this.help: false, | 174 this.help: false, |
184 this.version: false, | 175 this.version: false, |
185 this.logLevel: Level.WARNING, | 176 this.logLevel: Level.WARNING, |
186 this.serverMode: false, | 177 this.serverMode: false, |
187 this.enableHashing: false, | 178 this.enableHashing: false, |
188 this.widget: true, | 179 this.widget: true, |
189 this.host: 'localhost', | 180 this.host: 'localhost', |
190 this.port: 8080, | 181 this.port: 8080, |
191 this.runtimeDir, | 182 this.runtimeDir, |
(...skipping 25 matching lines...) Expand all Loading... |
217 sdkPath = getSdkDir(argv).path; | 208 sdkPath = getSdkDir(argv).path; |
218 } | 209 } |
219 var runtimeDir = args['runtime-dir']; | 210 var runtimeDir = args['runtime-dir']; |
220 if (runtimeDir == null) { | 211 if (runtimeDir == null) { |
221 runtimeDir = _computeRuntimeDir(); | 212 runtimeDir = _computeRuntimeDir(); |
222 } | 213 } |
223 var outputDir = args['out']; | 214 var outputDir = args['out']; |
224 if (outputDir == null && (serverMode || forceOutDir)) { | 215 if (outputDir == null && (serverMode || forceOutDir)) { |
225 outputDir = Directory.systemTemp.createTempSync("dev_compiler_out_").path; | 216 outputDir = Directory.systemTemp.createTempSync("dev_compiler_out_").path; |
226 } | 217 } |
227 var dumpInfo = args['dump-info']; | |
228 if (dumpInfo == null) dumpInfo = serverMode; | |
229 | |
230 var htmlReport = args['html-report']; | 218 var htmlReport = args['html-report']; |
231 | 219 |
232 var v8Binary = args['v8-binary']; | 220 var v8Binary = args['v8-binary']; |
233 if (v8Binary == null) v8Binary = _V8_BINARY_DEFAULT; | 221 if (v8Binary == null) v8Binary = _V8_BINARY_DEFAULT; |
234 | 222 |
235 var customUrlMappings = <String, String>{}; | 223 var customUrlMappings = <String, String>{}; |
236 for (var mapping in args['url-mapping']) { | 224 for (var mapping in args['url-mapping']) { |
237 var splitMapping = mapping.split(','); | 225 var splitMapping = mapping.split(','); |
238 if (splitMapping.length != 2) { | 226 if (splitMapping.length != 2) { |
239 showUsage = true; | 227 showUsage = true; |
(...skipping 17 matching lines...) Expand all Loading... |
257 args.rest.length == 1 && | 245 args.rest.length == 1 && |
258 args.rest[0].endsWith('.dart'), | 246 args.rest[0].endsWith('.dart'), |
259 customUrlMappings: customUrlMappings, | 247 customUrlMappings: customUrlMappings, |
260 useMultiPackage: args['use-multi-package'], | 248 useMultiPackage: args['use-multi-package'], |
261 packageRoot: args['package-root'], | 249 packageRoot: args['package-root'], |
262 packagePaths: args['package-paths'].split(','), | 250 packagePaths: args['package-paths'].split(','), |
263 resources: | 251 resources: |
264 args['resources'].split(',').where((s) => s.isNotEmpty).toList()), | 252 args['resources'].split(',').where((s) => s.isNotEmpty).toList()), |
265 runnerOptions: new RunnerOptions(v8Binary: v8Binary), | 253 runnerOptions: new RunnerOptions(v8Binary: v8Binary), |
266 checkSdk: args['sdk-check'], | 254 checkSdk: args['sdk-check'], |
267 dumpInfo: dumpInfo, | |
268 htmlReport: htmlReport, | 255 htmlReport: htmlReport, |
269 dumpInfoFile: args['dump-info-file'], | |
270 useColors: useColors, | 256 useColors: useColors, |
271 help: showUsage, | 257 help: showUsage, |
272 version: showVersion, | 258 version: showVersion, |
273 logLevel: logLevel, | 259 logLevel: logLevel, |
274 serverMode: serverMode, | 260 serverMode: serverMode, |
275 enableHashing: enableHashing, | 261 enableHashing: enableHashing, |
276 widget: args['widget'], | 262 widget: args['widget'], |
277 host: args['host'], | 263 host: args['host'], |
278 port: int.parse(args['port']), | 264 port: int.parse(args['port']), |
279 runtimeDir: runtimeDir, | 265 runtimeDir: runtimeDir, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // The pub-cache directory is two levels up, but we verify that the layout | 400 // The pub-cache directory is two levels up, but we verify that the layout |
415 // looks correct. | 401 // looks correct. |
416 if (path.basename(dir) != 'dev_compiler') return null; | 402 if (path.basename(dir) != 'dev_compiler') return null; |
417 dir = path.dirname(dir); | 403 dir = path.dirname(dir); |
418 if (path.basename(dir) != 'global_packages') return null; | 404 if (path.basename(dir) != 'global_packages') return null; |
419 dir = path.dirname(dir); | 405 dir = path.dirname(dir); |
420 return path.join(dir, cacheDir, 'lib', 'runtime'); | 406 return path.join(dir, cacheDir, 'lib', 'runtime'); |
421 } | 407 } |
422 return null; | 408 return null; |
423 } | 409 } |
OLD | NEW |