Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: tools/testing/dart/compiler_configuration.dart

Issue 2987393002: enable batch mode for dartdevc tests, also fix status so ddc bots pass (Closed)
Patch Set: fix Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/testing/dart/command_output.dart ('k') | tools/testing/dart/configuration.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'command.dart'; 7 import 'command.dart';
8 import 'configuration.dart'; 8 import 'configuration.dart';
9 import 'path.dart'; 9 import 'path.dart';
10 import 'runtime_configuration.dart'; 10 import 'runtime_configuration.dart';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 factory CompilerConfiguration(Configuration configuration) { 48 factory CompilerConfiguration(Configuration configuration) {
49 switch (configuration.compiler) { 49 switch (configuration.compiler) {
50 case Compiler.dart2analyzer: 50 case Compiler.dart2analyzer:
51 return new AnalyzerCompilerConfiguration(configuration); 51 return new AnalyzerCompilerConfiguration(configuration);
52 52
53 case Compiler.dart2js: 53 case Compiler.dart2js:
54 return new Dart2jsCompilerConfiguration(configuration); 54 return new Dart2jsCompilerConfiguration(configuration);
55 55
56 case Compiler.dartdevc: 56 case Compiler.dartdevc:
57 return new DartdevcCompilerConfiguration(configuration); 57 return new DevCompilerConfiguration(configuration);
58 58
59 case Compiler.appJit: 59 case Compiler.appJit:
60 return new AppJitCompilerConfiguration(configuration); 60 return new AppJitCompilerConfiguration(configuration);
61 61
62 case Compiler.precompiler: 62 case Compiler.precompiler:
63 return new PrecompilerCompilerConfiguration(configuration); 63 return new PrecompilerCompilerConfiguration(configuration);
64 64
65 case Compiler.dartk: 65 case Compiler.dartk:
66 return new NoneCompilerConfiguration(configuration, useDfe: true); 66 return new NoneCompilerConfiguration(configuration, useDfe: true);
67 67
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 Uri sdk = _useSdk 357 Uri sdk = _useSdk
358 ? new Uri.directory(_configuration.buildDirectory).resolve('dart-sdk/') 358 ? new Uri.directory(_configuration.buildDirectory).resolve('dart-sdk/')
359 : new Uri.directory(TestUtils.dartDir.toNativePath()).resolve('sdk/'); 359 : new Uri.directory(TestUtils.dartDir.toNativePath()).resolve('sdk/');
360 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/'); 360 Uri preambleDir = sdk.resolve('lib/_internal/js_runtime/lib/preambles/');
361 return runtimeConfiguration.dart2jsPreambles(preambleDir) 361 return runtimeConfiguration.dart2jsPreambles(preambleDir)
362 ..add(artifact.filename); 362 ..add(artifact.filename);
363 } 363 }
364 } 364 }
365 365
366 /// Configuration for dart2js compiler. 366 /// Configuration for dart2js compiler.
367 class DartdevcCompilerConfiguration extends CompilerConfiguration { 367 class DevCompilerConfiguration extends CompilerConfiguration {
368 DartdevcCompilerConfiguration(Configuration configuration) 368 DevCompilerConfiguration(Configuration configuration)
369 : super._subclass(configuration); 369 : super._subclass(configuration);
370 370
371 String computeCompilerPath() { 371 String computeCompilerPath() {
372 var dir = _useSdk ? "${_configuration.buildDirectory}/dart-sdk" : "sdk"; 372 var dir = _useSdk ? "${_configuration.buildDirectory}/dart-sdk" : "sdk";
373 return "$dir/bin/dartdevc$executableScriptSuffix"; 373 return "$dir/bin/dartdevc$executableScriptSuffix";
374 } 374 }
375 375
376 List<String> computeCompilerArguments( 376 List<String> computeCompilerArguments(
377 List<String> vmOptions, List<String> sharedOptions, List<String> args) { 377 List<String> vmOptions, List<String> sharedOptions, List<String> args) {
378 var result = sharedOptions.toList(); 378 var result = sharedOptions.toList();
379 379
380 // The file being compiled is the last argument. 380 // The file being compiled is the last argument.
381 result.add(args.last); 381 result.add(args.last);
382 382
383 return result; 383 return result;
384 } 384 }
385 385
386 Command createCommand( 386 Command createCommand(
387 String inputFile, String outputFile, List<String> sharedOptions) { 387 String inputFile, String outputFile, List<String> sharedOptions,
388 [Map<String, String> environment = const {}]) {
388 var moduleRoot = 389 var moduleRoot =
389 new Path(outputFile).directoryPath.directoryPath.toNativePath(); 390 new Path(outputFile).directoryPath.directoryPath.toNativePath();
390 391
391 var args = [ 392 var args = _useSdk
392 "--dart-sdk", 393 ? ["--dart-sdk", "${_configuration.buildDirectory}/dart-sdk"]
393 "${_configuration.buildDirectory}/dart-sdk", 394 // TODO(jmesserly): once we can build DDC's SDK summary+JS as part of
395 // the main build, change this to reflect that output path.
396 : ["--dart-sdk-summary", "pkg/dev_compiler/lib/sdk/ddc_sdk.sum"];
397
398 args.addAll(sharedOptions);
399 args.addAll([
400 "--ignore-unrecognized-flags",
394 "--library-root", 401 "--library-root",
395 new Path(inputFile).directoryPath.toNativePath(), 402 new Path(inputFile).directoryPath.toNativePath(),
396 "--module-root", 403 "--module-root",
397 moduleRoot, 404 moduleRoot,
398 "--no-summarize", 405 "--no-summarize",
399 "--no-source-map", 406 "--no-source-map",
400 "-o", 407 "-o",
401 outputFile, 408 outputFile,
402 inputFile, 409 inputFile,
403 ]; 410 ]);
404
405 args.addAll(sharedOptions);
406 411
407 // Link to the summaries for the available packages, so that they don't 412 // Link to the summaries for the available packages, so that they don't
408 // get recompiled into the test's own module. 413 // get recompiled into the test's own module.
409 for (var package in testPackages) { 414 for (var package in testPackages) {
410 args.add("-s"); 415 args.add("-s");
411 416
412 // Since the summaries for the packages are not near the tests, we give 417 // Since the summaries for the packages are not near the tests, we give
413 // dartdevc explicit module paths for each one. When the test is run, we 418 // dartdevc explicit module paths for each one. When the test is run, we
414 // will tell require.js where to find each package's compiled JS. 419 // will tell require.js where to find each package's compiled JS.
415 var summary = _configuration.buildDirectory + 420 var summary = _configuration.buildDirectory +
416 "/gen/utils/dartdevc/pkg/$package.sum"; 421 "/gen/utils/dartdevc/pkg/$package.sum";
417 args.add("$summary=$package"); 422 args.add("$summary=$package");
418 } 423 }
419 424
420 return Command.compilation(Compiler.dartdevc.name, outputFile, 425 return Command.compilation(Compiler.dartdevc.name, outputFile,
421 bootstrapDependencies(), computeCompilerPath(), args, const {}); 426 bootstrapDependencies(), computeCompilerPath(), args, environment);
422 } 427 }
423 428
424 CommandArtifact computeCompilationArtifact(String tempDir, 429 CommandArtifact computeCompilationArtifact(
425 List<String> arguments, Map<String, String> environmentOverrides) { 430 String tempDir, List<String> arguments, Map<String, String> environment) {
426 // The list of arguments comes from a call to our own 431 // The list of arguments comes from a call to our own
427 // computeCompilerArguments(). It contains the shared options followed by 432 // computeCompilerArguments(). It contains the shared options followed by
428 // the input file path. 433 // the input file path.
429 // TODO(rnystrom): Jamming these into a list in order to pipe them from 434 // TODO(rnystrom): Jamming these into a list in order to pipe them from
430 // computeCompilerArguments() to here seems hacky. Is there a cleaner way? 435 // computeCompilerArguments() to here seems hacky. Is there a cleaner way?
431 var sharedOptions = arguments.sublist(0, arguments.length - 1); 436 var sharedOptions = arguments.sublist(0, arguments.length - 1);
432 var inputFile = arguments.last; 437 var inputFile = arguments.last;
433 var outputFile = "$tempDir/${inputFile.replaceAll('.dart', '.js')}"; 438 var outputFile = "$tempDir/${inputFile.replaceAll('.dart', '.js')}";
434 439
435 return new CommandArtifact( 440 return new CommandArtifact(
436 [createCommand(inputFile, outputFile, sharedOptions)], 441 [createCommand(inputFile, outputFile, sharedOptions, environment)],
437 outputFile, 442 outputFile,
438 "application/javascript"); 443 "application/javascript");
439 } 444 }
440 } 445 }
441 446
442 class PrecompilerCompilerConfiguration extends CompilerConfiguration { 447 class PrecompilerCompilerConfiguration extends CompilerConfiguration {
443 final bool useDfe; 448 final bool useDfe;
444 449
445 bool get _isAndroid => _configuration.system == System.android; 450 bool get _isAndroid => _configuration.system == System.android;
446 bool get _isArm => _configuration.architecture == Architecture.arm; 451 bool get _isArm => _configuration.architecture == Architecture.arm;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 List<String> computeRuntimeArguments( 753 List<String> computeRuntimeArguments(
749 RuntimeConfiguration runtimeConfiguration, 754 RuntimeConfiguration runtimeConfiguration,
750 TestInformation info, 755 TestInformation info,
751 List<String> vmOptions, 756 List<String> vmOptions,
752 List<String> sharedOptions, 757 List<String> sharedOptions,
753 List<String> originalArguments, 758 List<String> originalArguments,
754 CommandArtifact artifact) { 759 CommandArtifact artifact) {
755 return <String>[]; 760 return <String>[];
756 } 761 }
757 } 762 }
OLDNEW
« no previous file with comments | « tools/testing/dart/command_output.dart ('k') | tools/testing/dart/configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698