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 import 'runtime_configuration.dart' show DartPrecompiledAdbRuntimeConfiguration; | 10 import 'runtime_configuration.dart' show DartPrecompiledAdbRuntimeConfiguration; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 isDebug: isDebug, isChecked: isChecked); | 96 isDebug: isDebug, isChecked: isChecked); |
97 case 'precompiler': | 97 case 'precompiler': |
98 return new PrecompilerCompilerConfiguration( | 98 return new PrecompilerCompilerConfiguration( |
99 isDebug: isDebug, | 99 isDebug: isDebug, |
100 isChecked: isChecked, | 100 isChecked: isChecked, |
101 arch: configuration['arch'], | 101 arch: configuration['arch'], |
102 useBlobs: useBlobs, | 102 useBlobs: useBlobs, |
103 isAndroid: configuration['system'] == 'android'); | 103 isAndroid: configuration['system'] == 'android'); |
104 case 'dartk': | 104 case 'dartk': |
105 return new NoneCompilerConfiguration( | 105 return new NoneCompilerConfiguration( |
106 isDebug: isDebug, | 106 isDebug: isDebug, |
107 isChecked: isChecked, | 107 isChecked: isChecked, |
108 isHostChecked: isHostChecked, | 108 isHostChecked: isHostChecked, |
109 useSdk: useSdk, | 109 useSdk: useSdk, |
110 hotReload: hotReload, | 110 hotReload: hotReload, |
111 hotReloadRollback: hotReloadRollback, | 111 hotReloadRollback: hotReloadRollback, |
112 useDFE: true); | 112 useDFE: true); |
113 case 'dartkp': | 113 case 'dartkp': |
114 return new PrecompilerCompilerConfiguration( | 114 return new PrecompilerCompilerConfiguration( |
115 isDebug: isDebug, | 115 isDebug: isDebug, |
116 isChecked: isChecked, | 116 isChecked: isChecked, |
117 arch: configuration['arch'], | 117 arch: configuration['arch'], |
118 useBlobs: useBlobs, | 118 useBlobs: useBlobs, |
119 isAndroid: configuration['system'] == 'android', | 119 isAndroid: configuration['system'] == 'android', |
120 useDFE: true); | 120 useDFE: true); |
121 case 'none': | 121 case 'none': |
122 return new NoneCompilerConfiguration( | 122 return new NoneCompilerConfiguration( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 /// The "none" compiler. | 187 /// The "none" compiler. |
188 class NoneCompilerConfiguration extends CompilerConfiguration { | 188 class NoneCompilerConfiguration extends CompilerConfiguration { |
189 final bool hotReload; | 189 final bool hotReload; |
190 final bool hotReloadRollback; | 190 final bool hotReloadRollback; |
191 final bool useDFE; | 191 final bool useDFE; |
192 | 192 |
193 NoneCompilerConfiguration( | 193 NoneCompilerConfiguration( |
194 {bool isDebug, bool isChecked, bool isHostChecked, bool useSdk, | 194 {bool isDebug, |
195 bool this.hotReload, | 195 bool isChecked, |
196 bool this.hotReloadRollback, | 196 bool isHostChecked, |
197 this.useDFE: false}) | 197 bool useSdk, |
| 198 bool this.hotReload, |
| 199 bool this.hotReloadRollback, |
| 200 this.useDFE: false}) |
198 : super._subclass( | 201 : super._subclass( |
199 isDebug: isDebug, | 202 isDebug: isDebug, |
200 isChecked: isChecked, | 203 isChecked: isChecked, |
201 isHostChecked: isHostChecked, | 204 isHostChecked: isHostChecked, |
202 useSdk: useSdk); | 205 useSdk: useSdk); |
203 | 206 |
204 bool get hasCompiler => false; | 207 bool get hasCompiler => false; |
205 | 208 |
206 List<String> computeRuntimeArguments( | 209 List<String> computeRuntimeArguments( |
207 RuntimeConfiguration runtimeConfiguration, | 210 RuntimeConfiguration runtimeConfiguration, |
(...skipping 20 matching lines...) Expand all Loading... |
228 ..addAll(vmOptions) | 231 ..addAll(vmOptions) |
229 ..addAll(sharedOptions) | 232 ..addAll(sharedOptions) |
230 ..addAll(originalArguments); | 233 ..addAll(originalArguments); |
231 } | 234 } |
232 } | 235 } |
233 | 236 |
234 /// The "dartk" compiler. | 237 /// The "dartk" compiler. |
235 class DartKCompilerConfiguration extends CompilerConfiguration { | 238 class DartKCompilerConfiguration extends CompilerConfiguration { |
236 final bool verify, strong, treeShake; | 239 final bool verify, strong, treeShake; |
237 | 240 |
238 DartKCompilerConfiguration({bool isChecked, bool isHostChecked, bool useSdk, | 241 DartKCompilerConfiguration( |
239 this.verify, this.strong, this.treeShake}) | 242 {bool isChecked, |
240 : super._subclass(isChecked: isChecked, isHostChecked: isHostChecked, | 243 bool isHostChecked, |
241 useSdk: useSdk); | 244 bool useSdk, |
| 245 this.verify, |
| 246 this.strong, |
| 247 this.treeShake}) |
| 248 : super._subclass( |
| 249 isChecked: isChecked, isHostChecked: isHostChecked, useSdk: useSdk); |
242 | 250 |
243 @override | 251 @override |
244 String computeCompilerPath(String buildDir) { | 252 String computeCompilerPath(String buildDir) { |
245 return 'tools/dartk_wrappers/dartk$executableScriptSuffix'; | 253 return 'tools/dartk_wrappers/dartk$executableScriptSuffix'; |
246 } | 254 } |
247 | 255 |
248 CompilationCommand computeCompilationCommand( | 256 CompilationCommand computeCompilationCommand( |
249 String outputFileName, | 257 String outputFileName, |
250 String buildDir, | 258 String buildDir, |
251 CommandBuilder commandBuilder, | 259 CommandBuilder commandBuilder, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 List<String> vmOptions, | 299 List<String> vmOptions, |
292 List<String> sharedOptions, | 300 List<String> sharedOptions, |
293 List<String> originalArguments, | 301 List<String> originalArguments, |
294 CommandArtifact artifact) { | 302 CommandArtifact artifact) { |
295 List<String> args = []; | 303 List<String> args = []; |
296 if (isChecked) { | 304 if (isChecked) { |
297 args.add('--enable_asserts'); | 305 args.add('--enable_asserts'); |
298 args.add('--enable_type_checks'); | 306 args.add('--enable_type_checks'); |
299 } | 307 } |
300 | 308 |
301 var newOriginalArguments = replaceDartFileWith( | 309 var newOriginalArguments = |
302 originalArguments, artifact.filename); | 310 replaceDartFileWith(originalArguments, artifact.filename); |
303 | 311 |
304 return args | 312 return args |
305 ..addAll(vmOptions) | 313 ..addAll(vmOptions) |
306 ..addAll(sharedOptions) | 314 ..addAll(sharedOptions) |
307 ..addAll(newOriginalArguments); | 315 ..addAll(newOriginalArguments); |
308 } | 316 } |
309 } | 317 } |
310 | 318 |
311 typedef List<String> CompilerArgumentsFunction( | 319 typedef List<String> CompilerArgumentsFunction( |
312 List<String> globalArguments, | 320 List<String> globalArguments, String previousCompilerOutput); |
313 String previousCompilerOutput); | |
314 | 321 |
315 class PipelineCommand { | 322 class PipelineCommand { |
316 final CompilerConfiguration compilerConfiguration; | 323 final CompilerConfiguration compilerConfiguration; |
317 final CompilerArgumentsFunction _argumentsFunction; | 324 final CompilerArgumentsFunction _argumentsFunction; |
318 | 325 |
319 PipelineCommand._(this.compilerConfiguration, this._argumentsFunction); | 326 PipelineCommand._(this.compilerConfiguration, this._argumentsFunction); |
320 | 327 |
321 factory PipelineCommand.runWithGlobalArguments(CompilerConfiguration conf) { | 328 factory PipelineCommand.runWithGlobalArguments(CompilerConfiguration conf) { |
322 return new PipelineCommand._(conf, (List<String> globalArguments, | 329 return new PipelineCommand._(conf, |
323 String previousOutput) { | 330 (List<String> globalArguments, String previousOutput) { |
324 assert(previousOutput == null); | 331 assert(previousOutput == null); |
325 return globalArguments; | 332 return globalArguments; |
326 }); | 333 }); |
327 } | 334 } |
328 | 335 |
329 factory PipelineCommand.runWithDartOrKernelFile(CompilerConfiguration conf) { | 336 factory PipelineCommand.runWithDartOrKernelFile(CompilerConfiguration conf) { |
330 return new PipelineCommand._(conf, (List<String> globalArguments, | 337 return new PipelineCommand._(conf, |
331 String previousOutput) { | 338 (List<String> globalArguments, String previousOutput) { |
332 var filtered = globalArguments | 339 var filtered = globalArguments |
333 .where((String name) => name.endsWith('.dart') || | 340 .where( |
334 name.endsWith('.dill')) | 341 (String name) => name.endsWith('.dart') || name.endsWith('.dill')) |
335 .toList(); | 342 .toList(); |
336 assert(filtered.length == 1); | 343 assert(filtered.length == 1); |
337 return filtered; | 344 return filtered; |
338 }); | 345 }); |
339 } | 346 } |
340 | 347 |
341 factory PipelineCommand.runWithPreviousKernelOutput( | 348 factory PipelineCommand.runWithPreviousKernelOutput( |
342 CompilerConfiguration conf) { | 349 CompilerConfiguration conf) { |
343 return new PipelineCommand._(conf, (List<String> globalArguments, | 350 return new PipelineCommand._(conf, |
344 String previousOutput) { | 351 (List<String> globalArguments, String previousOutput) { |
345 assert(previousOutput.endsWith('.dill')); | 352 assert(previousOutput.endsWith('.dill')); |
346 return replaceDartFileWith(globalArguments, previousOutput); | 353 return replaceDartFileWith(globalArguments, previousOutput); |
347 }); | 354 }); |
348 } | 355 } |
349 | 356 |
350 List<String> extractArguments(List<String> globalArguments, | 357 List<String> extractArguments( |
351 String previousOutput) { | 358 List<String> globalArguments, String previousOutput) { |
352 return _argumentsFunction(globalArguments, previousOutput); | 359 return _argumentsFunction(globalArguments, previousOutput); |
353 } | 360 } |
354 } | 361 } |
355 | 362 |
356 class ComposedCompilerConfiguration extends CompilerConfiguration { | 363 class ComposedCompilerConfiguration extends CompilerConfiguration { |
357 final List<PipelineCommand> pipelineCommands; | 364 final List<PipelineCommand> pipelineCommands; |
358 | 365 |
359 ComposedCompilerConfiguration(this.pipelineCommands) : super._subclass(); | 366 ComposedCompilerConfiguration(this.pipelineCommands) : super._subclass(); |
360 | 367 |
361 CommandArtifact computeCompilationArtifact( | 368 CommandArtifact computeCompilationArtifact( |
362 String buildDir, | 369 String buildDir, |
363 String tempDir, | 370 String tempDir, |
364 CommandBuilder commandBuilder, | 371 CommandBuilder commandBuilder, |
365 List globalArguments, | 372 List globalArguments, |
366 Map<String, String> environmentOverrides) { | 373 Map<String, String> environmentOverrides) { |
367 | |
368 List<Command> allCommands = []; | 374 List<Command> allCommands = []; |
369 | 375 |
370 // The first compilation command is as usual. | 376 // The first compilation command is as usual. |
371 var arguments = pipelineCommands[0].extractArguments(globalArguments, null); | 377 var arguments = pipelineCommands[0].extractArguments(globalArguments, null); |
372 CommandArtifact artifact = | 378 CommandArtifact artifact = pipelineCommands[0] |
373 pipelineCommands[0].compilerConfiguration.computeCompilationArtifact( | 379 .compilerConfiguration |
374 buildDir, tempDir, commandBuilder, arguments, environmentOverrides); | 380 .computeCompilationArtifact( |
| 381 buildDir, tempDir, commandBuilder, arguments, environmentOverrides); |
375 allCommands.addAll(artifact.commands); | 382 allCommands.addAll(artifact.commands); |
376 | 383 |
377 // The following compilation commands are based on the output of the | 384 // The following compilation commands are based on the output of the |
378 // previous one. | 385 // previous one. |
379 for (int i = 1; i < pipelineCommands.length; i++) { | 386 for (int i = 1; i < pipelineCommands.length; i++) { |
380 PipelineCommand pc = pipelineCommands[i]; | 387 PipelineCommand pc = pipelineCommands[i]; |
381 | 388 |
382 arguments = pc.extractArguments(globalArguments, artifact.filename); | 389 arguments = pc.extractArguments(globalArguments, artifact.filename); |
383 artifact = pc.compilerConfiguration.computeCompilationArtifact( | 390 artifact = pc.compilerConfiguration.computeCompilationArtifact( |
384 buildDir, tempDir, commandBuilder, arguments, environmentOverrides); | 391 buildDir, tempDir, commandBuilder, arguments, environmentOverrides); |
(...skipping 15 matching lines...) Expand all Loading... |
400 RuntimeConfiguration runtimeConfiguration, | 407 RuntimeConfiguration runtimeConfiguration, |
401 String buildDir, | 408 String buildDir, |
402 TestInformation info, | 409 TestInformation info, |
403 List<String> vmOptions, | 410 List<String> vmOptions, |
404 List<String> sharedOptions, | 411 List<String> sharedOptions, |
405 List<String> originalArguments, | 412 List<String> originalArguments, |
406 CommandArtifact artifact) { | 413 CommandArtifact artifact) { |
407 CompilerConfiguration lastCompilerConfiguration = | 414 CompilerConfiguration lastCompilerConfiguration = |
408 pipelineCommands.last.compilerConfiguration; | 415 pipelineCommands.last.compilerConfiguration; |
409 return lastCompilerConfiguration.computeRuntimeArguments( | 416 return lastCompilerConfiguration.computeRuntimeArguments( |
410 runtimeConfiguration, buildDir, info, vmOptions, sharedOptions, | 417 runtimeConfiguration, |
411 originalArguments, artifact); | 418 buildDir, |
| 419 info, |
| 420 vmOptions, |
| 421 sharedOptions, |
| 422 originalArguments, |
| 423 artifact); |
412 } | 424 } |
413 | 425 |
414 static ComposedCompilerConfiguration createDartKPConfiguration( | 426 static ComposedCompilerConfiguration createDartKPConfiguration( |
415 {bool isChecked, bool isHostChecked, String arch, bool useBlobs, | 427 {bool isChecked, |
416 bool isAndroid, bool useSdk, bool verify, bool strong, bool treeShake}) { | 428 bool isHostChecked, |
| 429 String arch, |
| 430 bool useBlobs, |
| 431 bool isAndroid, |
| 432 bool useSdk, |
| 433 bool verify, |
| 434 bool strong, |
| 435 bool treeShake}) { |
417 var nested = []; | 436 var nested = []; |
418 | 437 |
419 // Compile with dartk. | 438 // Compile with dartk. |
420 nested.add(new PipelineCommand.runWithGlobalArguments( | 439 nested.add(new PipelineCommand.runWithGlobalArguments( |
421 new DartKCompilerConfiguration(isChecked: isChecked, | 440 new DartKCompilerConfiguration( |
422 isHostChecked: isHostChecked, useSdk: useSdk, verify: verify, | 441 isChecked: isChecked, |
423 strong: strong, treeShake: treeShake))); | 442 isHostChecked: isHostChecked, |
| 443 useSdk: useSdk, |
| 444 verify: verify, |
| 445 strong: strong, |
| 446 treeShake: treeShake))); |
424 | 447 |
425 // Run the normal precompiler. | 448 // Run the normal precompiler. |
426 nested.add(new PipelineCommand.runWithPreviousKernelOutput( | 449 nested.add(new PipelineCommand.runWithPreviousKernelOutput( |
427 new PrecompilerCompilerConfiguration( | 450 new PrecompilerCompilerConfiguration( |
428 isChecked: isChecked, arch: arch, useBlobs: useBlobs, | 451 isChecked: isChecked, |
429 isAndroid: isAndroid))); | 452 arch: arch, |
| 453 useBlobs: useBlobs, |
| 454 isAndroid: isAndroid))); |
430 | 455 |
431 return new ComposedCompilerConfiguration(nested); | 456 return new ComposedCompilerConfiguration(nested); |
432 } | 457 } |
433 | 458 |
434 static ComposedCompilerConfiguration createDartKConfiguration( | 459 static ComposedCompilerConfiguration createDartKConfiguration( |
435 {bool isChecked, bool isHostChecked, bool useSdk, bool verify, | 460 {bool isChecked, |
436 bool strong, bool treeShake}) { | 461 bool isHostChecked, |
| 462 bool useSdk, |
| 463 bool verify, |
| 464 bool strong, |
| 465 bool treeShake}) { |
437 var nested = []; | 466 var nested = []; |
438 | 467 |
439 // Compile with dartk. | 468 // Compile with dartk. |
440 nested.add(new PipelineCommand.runWithGlobalArguments( | 469 nested.add(new PipelineCommand.runWithGlobalArguments( |
441 new DartKCompilerConfiguration(isChecked: isChecked, | 470 new DartKCompilerConfiguration( |
442 isHostChecked: isHostChecked, useSdk: useSdk, | 471 isChecked: isChecked, |
443 verify: verify, strong: strong, treeShake: treeShake))); | 472 isHostChecked: isHostChecked, |
| 473 useSdk: useSdk, |
| 474 verify: verify, |
| 475 strong: strong, |
| 476 treeShake: treeShake))); |
444 | 477 |
445 return new ComposedCompilerConfiguration(nested); | 478 return new ComposedCompilerConfiguration(nested); |
446 } | 479 } |
447 } | 480 } |
448 | 481 |
449 /// Common configuration for dart2js-based tools, such as, dart2js | 482 /// Common configuration for dart2js-based tools, such as, dart2js |
450 class Dart2xCompilerConfiguration extends CompilerConfiguration { | 483 class Dart2xCompilerConfiguration extends CompilerConfiguration { |
451 final String moniker; | 484 final String moniker; |
452 static Map<String, List<Uri>> _bootstrapDependenciesCache = | 485 static Map<String, List<Uri>> _bootstrapDependenciesCache = |
453 new Map<String, List<Uri>>(); | 486 new Map<String, List<Uri>>(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 ..add(artifact.filename); | 606 ..add(artifact.filename); |
574 } | 607 } |
575 } | 608 } |
576 | 609 |
577 class PrecompilerCompilerConfiguration extends CompilerConfiguration { | 610 class PrecompilerCompilerConfiguration extends CompilerConfiguration { |
578 final String arch; | 611 final String arch; |
579 final bool useBlobs; | 612 final bool useBlobs; |
580 final bool isAndroid; | 613 final bool isAndroid; |
581 final bool useDFE; | 614 final bool useDFE; |
582 | 615 |
583 PrecompilerCompilerConfiguration({bool isDebug, bool isChecked, | 616 PrecompilerCompilerConfiguration( |
584 this.arch, this.useBlobs, this.isAndroid, this.useDFE: false}) | 617 {bool isDebug, |
| 618 bool isChecked, |
| 619 this.arch, |
| 620 this.useBlobs, |
| 621 this.isAndroid, |
| 622 this.useDFE: false}) |
585 : super._subclass(isDebug: isDebug, isChecked: isChecked); | 623 : super._subclass(isDebug: isDebug, isChecked: isChecked); |
586 | 624 |
587 int computeTimeoutMultiplier() { | 625 int computeTimeoutMultiplier() { |
588 int multiplier = 2; | 626 int multiplier = 2; |
589 if (isDebug) multiplier *= 4; | 627 if (isDebug) multiplier *= 4; |
590 if (isChecked) multiplier *= 2; | 628 if (isChecked) multiplier *= 2; |
591 return multiplier; | 629 return multiplier; |
592 } | 630 } |
593 | 631 |
594 CommandArtifact computeCompilationArtifact( | 632 CommandArtifact computeCompilationArtifact( |
595 String buildDir, | 633 String buildDir, |
596 String tempDir, | 634 String tempDir, |
597 CommandBuilder commandBuilder, | 635 CommandBuilder commandBuilder, |
598 List arguments, | 636 List arguments, |
599 Map<String, String> environmentOverrides) { | 637 Map<String, String> environmentOverrides) { |
600 var commands = new List<Command>(); | 638 var commands = new List<Command>(); |
601 commands.add(this.computeCompilationCommand(tempDir, buildDir, CommandBuilde
r.instance, | 639 commands.add(this.computeCompilationCommand(tempDir, buildDir, |
602 arguments, environmentOverrides)); | 640 CommandBuilder.instance, arguments, environmentOverrides)); |
603 if (!useBlobs) { | 641 if (!useBlobs) { |
604 commands.add(this.computeAssembleCommand(tempDir, buildDir, CommandBuilder
.instance, | 642 commands.add(this.computeAssembleCommand(tempDir, buildDir, |
605 arguments, environmentOverrides)); | 643 CommandBuilder.instance, arguments, environmentOverrides)); |
606 commands.add(this.computeRemoveAssemblyCommand(tempDir, buildDir, | 644 commands.add(this.computeRemoveAssemblyCommand(tempDir, buildDir, |
607 CommandBuilder.instance, arguments, environmentOverrides)); | 645 CommandBuilder.instance, arguments, environmentOverrides)); |
608 } | 646 } |
609 return new CommandArtifact(commands, '$tempDir', 'application/dart-precompil
ed'); | 647 return new CommandArtifact( |
| 648 commands, '$tempDir', 'application/dart-precompiled'); |
610 } | 649 } |
611 | 650 |
612 CompilationCommand computeCompilationCommand( | 651 CompilationCommand computeCompilationCommand( |
613 String tempDir, | 652 String tempDir, |
614 String buildDir, | 653 String buildDir, |
615 CommandBuilder commandBuilder, | 654 CommandBuilder commandBuilder, |
616 List arguments, | 655 List arguments, |
617 Map<String, String> environmentOverrides) { | 656 Map<String, String> environmentOverrides) { |
618 var exec; | 657 var exec; |
619 if (isAndroid) { | 658 if (isAndroid) { |
(...skipping 24 matching lines...) Expand all Loading... |
644 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk, | 683 return commandBuilder.getCompilationCommand('precompiler', tempDir, !useSdk, |
645 bootstrapDependencies(buildDir), exec, args, environmentOverrides); | 684 bootstrapDependencies(buildDir), exec, args, environmentOverrides); |
646 } | 685 } |
647 | 686 |
648 CompilationCommand computeAssembleCommand( | 687 CompilationCommand computeAssembleCommand( |
649 String tempDir, | 688 String tempDir, |
650 String buildDir, | 689 String buildDir, |
651 CommandBuilder commandBuilder, | 690 CommandBuilder commandBuilder, |
652 List arguments, | 691 List arguments, |
653 Map<String, String> environmentOverrides) { | 692 Map<String, String> environmentOverrides) { |
654 | |
655 var cc, shared, ld_flags; | 693 var cc, shared, ld_flags; |
656 if (isAndroid) { | 694 if (isAndroid) { |
657 var ndk = "third_party/android_tools/ndk"; | 695 var ndk = "third_party/android_tools/ndk"; |
658 var triple; | 696 var triple; |
659 if (arch == "arm") { | 697 if (arch == "arm") { |
660 triple = "arm-linux-androideabi"; | 698 triple = "arm-linux-androideabi"; |
661 } else if (arch == "arm64") { | 699 } else if (arch == "arm64") { |
662 triple = "aarch64-linux-android"; | 700 triple = "aarch64-linux-android"; |
663 } | 701 } |
664 var host; | 702 var host; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 args.add('--enable_asserts'); | 810 args.add('--enable_asserts'); |
773 args.add('--enable_type_checks'); | 811 args.add('--enable_type_checks'); |
774 } | 812 } |
775 | 813 |
776 var dir = artifact.filename; | 814 var dir = artifact.filename; |
777 if (runtimeConfiguration is DartPrecompiledAdbRuntimeConfiguration) { | 815 if (runtimeConfiguration is DartPrecompiledAdbRuntimeConfiguration) { |
778 // On android the precompiled snapshot will be pushed to a different | 816 // On android the precompiled snapshot will be pushed to a different |
779 // directory on the device, use that one instead. | 817 // directory on the device, use that one instead. |
780 dir = DartPrecompiledAdbRuntimeConfiguration.DeviceTestDir; | 818 dir = DartPrecompiledAdbRuntimeConfiguration.DeviceTestDir; |
781 } | 819 } |
782 originalArguments = replaceDartFileWith( | 820 originalArguments = |
783 originalArguments, "$dir/out.aotsnapshot"); | 821 replaceDartFileWith(originalArguments, "$dir/out.aotsnapshot"); |
784 | 822 |
785 return args | 823 return args |
786 ..addAll(vmOptions) | 824 ..addAll(vmOptions) |
787 ..addAll(sharedOptions) | 825 ..addAll(sharedOptions) |
788 ..addAll(originalArguments); | 826 ..addAll(originalArguments); |
789 } | 827 } |
790 } | 828 } |
791 | 829 |
792 class AppJitCompilerConfiguration extends CompilerConfiguration { | 830 class AppJitCompilerConfiguration extends CompilerConfiguration { |
793 AppJitCompilerConfiguration({bool isDebug, bool isChecked}) | 831 AppJitCompilerConfiguration({bool isDebug, bool isChecked}) |
794 : super._subclass(isDebug: isDebug, isChecked: isChecked); | 832 : super._subclass(isDebug: isDebug, isChecked: isChecked); |
795 | 833 |
796 int computeTimeoutMultiplier() { | 834 int computeTimeoutMultiplier() { |
797 int multiplier = 1; | 835 int multiplier = 1; |
798 if (isDebug) multiplier *= 2; | 836 if (isDebug) multiplier *= 2; |
799 if (isChecked) multiplier *= 2; | 837 if (isChecked) multiplier *= 2; |
800 return multiplier; | 838 return multiplier; |
801 } | 839 } |
802 | 840 |
803 CommandArtifact computeCompilationArtifact( | 841 CommandArtifact computeCompilationArtifact( |
804 String buildDir, | 842 String buildDir, |
805 String tempDir, | 843 String tempDir, |
806 CommandBuilder commandBuilder, | 844 CommandBuilder commandBuilder, |
807 List arguments, | 845 List arguments, |
808 Map<String, String> environmentOverrides) { | 846 Map<String, String> environmentOverrides) { |
809 var snapshot = "$tempDir/out.jitsnapshot"; | 847 var snapshot = "$tempDir/out.jitsnapshot"; |
810 return new CommandArtifact(<Command>[ | 848 return new CommandArtifact(<Command>[ |
811 this.computeCompilationCommand(tempDir, buildDir, | 849 this.computeCompilationCommand(tempDir, buildDir, CommandBuilder.instance, |
812 CommandBuilder.instance, arguments, environmentOverrides) | 850 arguments, environmentOverrides) |
813 ], snapshot, 'application/dart-snapshot'); | 851 ], snapshot, 'application/dart-snapshot'); |
814 } | 852 } |
815 | 853 |
816 CompilationCommand computeCompilationCommand( | 854 CompilationCommand computeCompilationCommand( |
817 String tempDir, | 855 String tempDir, |
818 String buildDir, | 856 String buildDir, |
819 CommandBuilder commandBuilder, | 857 CommandBuilder commandBuilder, |
820 List arguments, | 858 List arguments, |
821 Map<String, String> environmentOverrides) { | 859 Map<String, String> environmentOverrides) { |
822 var exec = "$buildDir/dart"; | 860 var exec = "$buildDir/dart"; |
823 var args = new List(); | 861 var args = new List(); |
824 var snapshot = "$tempDir/out.jitsnapshot"; | 862 var snapshot = "$tempDir/out.jitsnapshot"; |
825 args.add("--snapshot=$snapshot"); | 863 args.add("--snapshot=$snapshot"); |
826 args.add("--snapshot-kind=app-jit"); | 864 args.add("--snapshot-kind=app-jit"); |
827 args.addAll(arguments); | 865 args.addAll(arguments); |
828 | 866 |
829 return commandBuilder.getCompilationCommand( | 867 return commandBuilder.getCompilationCommand('app_jit', tempDir, !useSdk, |
830 'app_jit', | 868 bootstrapDependencies(buildDir), exec, args, environmentOverrides); |
831 tempDir, | |
832 !useSdk, | |
833 bootstrapDependencies(buildDir), | |
834 exec, | |
835 args, | |
836 environmentOverrides); | |
837 } | 869 } |
838 | 870 |
839 List<String> computeCompilerArguments( | 871 List<String> computeCompilerArguments( |
840 vmOptions, sharedOptions, originalArguments) { | 872 vmOptions, sharedOptions, originalArguments) { |
841 List<String> args = []; | 873 List<String> args = []; |
842 if (isChecked) { | 874 if (isChecked) { |
843 args.add('--enable_asserts'); | 875 args.add('--enable_asserts'); |
844 args.add('--enable_type_checks'); | 876 args.add('--enable_type_checks'); |
845 } | 877 } |
846 return args | 878 return args |
847 ..addAll(vmOptions) | 879 ..addAll(vmOptions) |
848 ..addAll(sharedOptions) | 880 ..addAll(sharedOptions) |
849 ..addAll(originalArguments); | 881 ..addAll(originalArguments); |
850 } | 882 } |
851 | 883 |
852 List<String> computeRuntimeArguments( | 884 List<String> computeRuntimeArguments( |
853 RuntimeConfiguration runtimeConfiguration, | 885 RuntimeConfiguration runtimeConfiguration, |
854 String buildDir, | 886 String buildDir, |
855 TestInformation info, | 887 TestInformation info, |
856 List<String> vmOptions, | 888 List<String> vmOptions, |
857 List<String> sharedOptions, | 889 List<String> sharedOptions, |
858 List<String> originalArguments, | 890 List<String> originalArguments, |
859 CommandArtifact artifact) { | 891 CommandArtifact artifact) { |
860 List<String> args = []; | 892 List<String> args = []; |
861 if (isChecked) { | 893 if (isChecked) { |
862 args.add('--enable_asserts'); | 894 args.add('--enable_asserts'); |
863 args.add('--enable_type_checks'); | 895 args.add('--enable_type_checks'); |
864 } | 896 } |
865 args | 897 args..addAll(vmOptions)..addAll(sharedOptions)..addAll(originalArguments); |
866 ..addAll(vmOptions) | |
867 ..addAll(sharedOptions) | |
868 ..addAll(originalArguments); | |
869 for (var i = 0; i < args.length; i++) { | 898 for (var i = 0; i < args.length; i++) { |
870 if (args[i].endsWith(".dart")) { | 899 if (args[i].endsWith(".dart")) { |
871 args[i] = artifact.filename; | 900 args[i] = artifact.filename; |
872 } | 901 } |
873 } | 902 } |
874 return args; | 903 return args; |
875 } | 904 } |
876 } | 905 } |
877 | 906 |
878 class AnalyzerCompilerConfiguration extends CompilerConfiguration { | 907 class AnalyzerCompilerConfiguration extends CompilerConfiguration { |
879 AnalyzerCompilerConfiguration( | 908 AnalyzerCompilerConfiguration( |
880 {bool isDebug, bool isChecked, bool isStrong, bool isHostChecked, bool | 909 {bool isDebug, |
881 useSdk}) | 910 bool isChecked, |
| 911 bool isStrong, |
| 912 bool isHostChecked, |
| 913 bool useSdk}) |
882 : super._subclass( | 914 : super._subclass( |
883 isDebug: isDebug, | 915 isDebug: isDebug, |
884 isChecked: isChecked, | 916 isChecked: isChecked, |
885 isStrong: isStrong, | 917 isStrong: isStrong, |
886 isHostChecked: isHostChecked, | 918 isHostChecked: isHostChecked, |
887 useSdk: useSdk); | 919 useSdk: useSdk); |
888 | 920 |
889 int computeTimeoutMultiplier() { | 921 int computeTimeoutMultiplier() { |
890 return 4; | 922 return 4; |
891 } | 923 } |
(...skipping 19 matching lines...) Expand all Loading... |
911 CommandArtifact computeCompilationArtifact( | 943 CommandArtifact computeCompilationArtifact( |
912 String buildDir, | 944 String buildDir, |
913 String tempDir, | 945 String tempDir, |
914 CommandBuilder commandBuilder, | 946 CommandBuilder commandBuilder, |
915 List arguments, | 947 List arguments, |
916 Map<String, String> environmentOverrides) { | 948 Map<String, String> environmentOverrides) { |
917 arguments = new List.from(arguments); | 949 arguments = new List.from(arguments); |
918 if (isChecked || isStrong) { | 950 if (isChecked || isStrong) { |
919 arguments.add('--enable_type_checks'); | 951 arguments.add('--enable_type_checks'); |
920 } | 952 } |
921 if (isStrong){ | 953 if (isStrong) { |
922 arguments.add('--strong'); | 954 arguments.add('--strong'); |
923 } | 955 } |
924 return new CommandArtifact(<Command>[ | 956 return new CommandArtifact(<Command>[ |
925 commandBuilder.getAnalysisCommand('dart2analyzer', | 957 commandBuilder.getAnalysisCommand('dart2analyzer', |
926 computeCompilerPath(buildDir), arguments, environmentOverrides, | 958 computeCompilerPath(buildDir), arguments, environmentOverrides, |
927 flavor: 'dart2analyzer') | 959 flavor: 'dart2analyzer') |
928 ], null, null); // Since this is not a real compilation, no artifacts are | 960 ], null, null); // Since this is not a real compilation, no artifacts are |
929 // produced. | 961 // produced. |
930 } | 962 } |
931 | 963 |
932 List<String> computeRuntimeArguments( | 964 List<String> computeRuntimeArguments( |
933 RuntimeConfiguration runtimeConfiguration, | 965 RuntimeConfiguration runtimeConfiguration, |
934 String buildDir, | 966 String buildDir, |
935 TestInformation info, | 967 TestInformation info, |
936 List<String> vmOptions, | 968 List<String> vmOptions, |
937 List<String> sharedOptions, | 969 List<String> sharedOptions, |
938 List<String> originalArguments, | 970 List<String> originalArguments, |
939 CommandArtifact artifact) { | 971 CommandArtifact artifact) { |
940 return <String>[]; | 972 return <String>[]; |
941 } | 973 } |
942 } | 974 } |
OLD | NEW |