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 library compiler_configuration; | 5 library compiler_configuration; |
6 | 6 |
7 import 'dart:io' show Platform; | 7 import 'dart:io' show Platform; |
8 | 8 |
9 import 'runtime_configuration.dart' show RuntimeConfiguration; | 9 import 'runtime_configuration.dart' show RuntimeConfiguration; |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 String buildDir, | 260 String buildDir, |
261 String tempDir, | 261 String tempDir, |
262 CommandBuilder commandBuilder, | 262 CommandBuilder commandBuilder, |
263 List arguments, | 263 List arguments, |
264 Map<String, String> environmentOverrides) { | 264 Map<String, String> environmentOverrides) { |
265 return new CommandArtifact(<Command>[ | 265 return new CommandArtifact(<Command>[ |
266 this.computeCompilationCommand('$tempDir/out.dill', buildDir, | 266 this.computeCompilationCommand('$tempDir/out.dill', buildDir, |
267 CommandBuilder.instance, arguments, environmentOverrides) | 267 CommandBuilder.instance, arguments, environmentOverrides) |
268 ], '$tempDir/out.dill', 'application/dart'); | 268 ], '$tempDir/out.dill', 'application/dart'); |
269 } | 269 } |
| 270 |
| 271 List<String> computeRuntimeArguments( |
| 272 RuntimeConfiguration runtimeConfiguration, |
| 273 String buildDir, |
| 274 TestInformation info, |
| 275 List<String> vmOptions, |
| 276 List<String> sharedOptions, |
| 277 List<String> originalArguments, |
| 278 CommandArtifact artifact) { |
| 279 List<String> args = []; |
| 280 if (isChecked) { |
| 281 args.add('--enable_asserts'); |
| 282 args.add('--enable_type_checks'); |
| 283 } |
| 284 |
| 285 var newOriginalArguments = new List<String>.from(originalArguments); |
| 286 for (var i = 0; i < newOriginalArguments .length; i++) { |
| 287 if (newOriginalArguments[i].endsWith(".dart")) { |
| 288 newOriginalArguments[i] = artifact.filename; |
| 289 } |
| 290 } |
| 291 |
| 292 return args |
| 293 ..addAll(vmOptions) |
| 294 ..addAll(sharedOptions) |
| 295 ..addAll(newOriginalArguments); |
| 296 } |
270 } | 297 } |
271 | 298 |
272 typedef List<String> CompilerArgumentsFunction( | 299 typedef List<String> CompilerArgumentsFunction( |
273 List<String> globalArguments, | 300 List<String> globalArguments, |
274 String previousCompilerOutput); | 301 String previousCompilerOutput); |
275 | 302 |
276 class PipelineCommand { | 303 class PipelineCommand { |
277 final CompilerConfiguration compilerConfiguration; | 304 final CompilerConfiguration compilerConfiguration; |
278 final CompilerArgumentsFunction _argumentsFunction; | 305 final CompilerArgumentsFunction _argumentsFunction; |
279 | 306 |
(...skipping 17 matching lines...) Expand all Loading... |
297 assert(filtered.length == 1); | 324 assert(filtered.length == 1); |
298 return filtered; | 325 return filtered; |
299 }); | 326 }); |
300 } | 327 } |
301 | 328 |
302 factory PipelineCommand.runWithPreviousKernelOutput( | 329 factory PipelineCommand.runWithPreviousKernelOutput( |
303 CompilerConfiguration conf) { | 330 CompilerConfiguration conf) { |
304 return new PipelineCommand._(conf, (List<String> globalArguments, | 331 return new PipelineCommand._(conf, (List<String> globalArguments, |
305 String previousOutput) { | 332 String previousOutput) { |
306 assert(previousOutput.endsWith('.dill')); | 333 assert(previousOutput.endsWith('.dill')); |
307 return [previousOutput]; | 334 return []..addAll(globalArguments)..add(previousOutput); |
308 }); | 335 }); |
309 } | 336 } |
310 | 337 |
311 List<String> extractArguments(List<String> globalArguments, | 338 List<String> extractArguments(List<String> globalArguments, |
312 String previousOutput) { | 339 String previousOutput) { |
313 return _argumentsFunction(globalArguments, previousOutput); | 340 return _argumentsFunction(globalArguments, previousOutput); |
314 } | 341 } |
315 } | 342 } |
316 | 343 |
317 class ComposedCompilerConfiguration extends CompilerConfiguration { | 344 class ComposedCompilerConfiguration extends CompilerConfiguration { |
(...skipping 29 matching lines...) Expand all Loading... |
347 allCommands.addAll(artifact.commands); | 374 allCommands.addAll(artifact.commands); |
348 } | 375 } |
349 | 376 |
350 return new CommandArtifact( | 377 return new CommandArtifact( |
351 allCommands, artifact.filename, artifact.mimeType); | 378 allCommands, artifact.filename, artifact.mimeType); |
352 } | 379 } |
353 | 380 |
354 List<String> computeCompilerArguments(vmOptions, sharedOptions, args) { | 381 List<String> computeCompilerArguments(vmOptions, sharedOptions, args) { |
355 // The result will be passed as an input to [extractArguments] | 382 // The result will be passed as an input to [extractArguments] |
356 // (i.e. the arguments to the [PipelineCommand]). | 383 // (i.e. the arguments to the [PipelineCommand]). |
357 return new List<String>.from(sharedOptions)..addAll(args); | 384 return <String>[]..addAll(vmOptions)..addAll(sharedOptions)..addAll(args); |
358 } | 385 } |
359 | 386 |
360 List<String> computeRuntimeArguments( | 387 List<String> computeRuntimeArguments( |
361 RuntimeConfiguration runtimeConfiguration, | 388 RuntimeConfiguration runtimeConfiguration, |
362 String buildDir, | 389 String buildDir, |
363 TestInformation info, | 390 TestInformation info, |
364 List<String> vmOptions, | 391 List<String> vmOptions, |
365 List<String> sharedOptions, | 392 List<String> sharedOptions, |
366 List<String> originalArguments, | 393 List<String> originalArguments, |
367 CommandArtifact artifact) { | 394 CommandArtifact artifact) { |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 RuntimeConfiguration runtimeConfiguration, | 889 RuntimeConfiguration runtimeConfiguration, |
863 String buildDir, | 890 String buildDir, |
864 TestInformation info, | 891 TestInformation info, |
865 List<String> vmOptions, | 892 List<String> vmOptions, |
866 List<String> sharedOptions, | 893 List<String> sharedOptions, |
867 List<String> originalArguments, | 894 List<String> originalArguments, |
868 CommandArtifact artifact) { | 895 CommandArtifact artifact) { |
869 return <String>[]; | 896 return <String>[]; |
870 } | 897 } |
871 } | 898 } |
OLD | NEW |