| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Tests code generation. | 5 /// Tests code generation. |
| 6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks | 6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks |
| 7 /// that the output is what we expected. | 7 /// that the output is what we expected. |
| 8 library dev_compiler.test.codegen_test; | 8 library dev_compiler.test.codegen_test; |
| 9 | 9 |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 .where((f) => f is File) | 55 .where((f) => f is File) |
| 56 .map((f) => f.path) | 56 .map((f) => f.path) |
| 57 .where((p) => p.endsWith('.dart') && filePattern.hasMatch(p)); | 57 .where((p) => p.endsWith('.dart') && filePattern.hasMatch(p)); |
| 58 | 58 |
| 59 compile(String entryPoint, String sdkPath, {bool checkSdk: false, | 59 compile(String entryPoint, String sdkPath, {bool checkSdk: false, |
| 60 bool serverMode: false, bool sourceMaps: false, String subDir}) { | 60 bool serverMode: false, bool sourceMaps: false, String subDir}) { |
| 61 // TODO(jmesserly): add a way to specify flags in the test file, so | 61 // TODO(jmesserly): add a way to specify flags in the test file, so |
| 62 // they're more self-contained. | 62 // they're more self-contained. |
| 63 var runtimeDir = path.join(path.dirname(testDirectory), 'lib', 'runtime'); | 63 var runtimeDir = path.join(path.dirname(testDirectory), 'lib', 'runtime'); |
| 64 var options = new CompilerOptions( | 64 var options = new CompilerOptions( |
| 65 outputDir: subDir == null ? actualDir : path.join(actualDir, subDir), | 65 sourceOptions: new SourceResolverOptions( |
| 66 entryPointFile: entryPoint, dartSdkPath: sdkPath), |
| 67 codegenOptions: new CodegenOptions( |
| 68 outputDir: subDir == null |
| 69 ? actualDir |
| 70 : path.join(actualDir, subDir), |
| 71 emitSourceMaps: sourceMaps, |
| 72 forceCompile: checkSdk), |
| 66 useColors: false, | 73 useColors: false, |
| 67 emitSourceMaps: sourceMaps, | |
| 68 forceCompile: checkSdk, | |
| 69 checkSdk: checkSdk, | 74 checkSdk: checkSdk, |
| 70 entryPointFile: entryPoint, | |
| 71 dartSdkPath: sdkPath, | |
| 72 runtimeDir: runtimeDir, | 75 runtimeDir: runtimeDir, |
| 73 serverMode: serverMode, | 76 serverMode: serverMode, |
| 74 enableHashing: serverMode); | 77 enableHashing: serverMode); |
| 75 return new Compiler(options).run(); | 78 return new Compiler(options).run(); |
| 76 } | 79 } |
| 77 var realSdk = getSdkDir(arguments).path; | 80 var realSdk = getSdkDir(arguments).path; |
| 78 | 81 |
| 79 // Remove old output, and `packages` symlinks which mess up the diff. | 82 // Remove old output, and `packages` symlinks which mess up the diff. |
| 80 var dir = new Directory(actualDir); | 83 var dir = new Directory(actualDir); |
| 81 if (dir.existsSync()) dir.deleteSync(recursive: true); | 84 if (dir.existsSync()) dir.deleteSync(recursive: true); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 print('[AnalysisEngine] error $message $exception'); | 268 print('[AnalysisEngine] error $message $exception'); |
| 266 } | 269 } |
| 267 | 270 |
| 268 @override void logError2(String message, Object exception) { | 271 @override void logError2(String message, Object exception) { |
| 269 print('[AnalysisEngine] error $message $exception'); | 272 print('[AnalysisEngine] error $message $exception'); |
| 270 } | 273 } |
| 271 | 274 |
| 272 void logInformation(String message, [CaughtException exception]) {} | 275 void logInformation(String message, [CaughtException exception]) {} |
| 273 void logInformation2(String message, Object exception) {} | 276 void logInformation2(String message, Object exception) {} |
| 274 } | 277 } |
| OLD | NEW |