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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 : path.join(testDir, 'codegen'); | 51 : path.join(testDir, 'codegen'); |
52 var actualDir = path.join(inputDir, 'actual'); | 52 var actualDir = path.join(inputDir, 'actual'); |
53 var paths = new Directory(inputDir) | 53 var paths = new Directory(inputDir) |
54 .listSync() | 54 .listSync() |
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, | 59 compile(String entryPoint, String sdkPath, |
60 {bool checkSdk: false, bool serverMode: false}) { | 60 {bool checkSdk: false, bool serverMode: false}) { |
| 61 var runtimeDir = path.join( |
| 62 path.dirname(path.dirname(Platform.script.path)), 'lib', 'runtime'); |
61 var options = new CompilerOptions( | 63 var options = new CompilerOptions( |
62 outputDir: serverMode ? path.join(actualDir, 'server_mode') : actualDir, | 64 outputDir: serverMode ? path.join(actualDir, 'server_mode') : actualDir, |
63 useColors: false, | 65 useColors: false, |
64 outputDart: dartGen, | 66 outputDart: dartGen, |
65 formatOutput: dartGen, | 67 formatOutput: dartGen, |
66 emitSourceMaps: false, | 68 emitSourceMaps: false, |
67 forceCompile: checkSdk, | 69 forceCompile: checkSdk, |
68 cheapTestFormat: checkSdk, | 70 cheapTestFormat: checkSdk, |
69 checkSdk: checkSdk, | 71 checkSdk: checkSdk, |
70 entryPointFile: entryPoint, | 72 entryPointFile: entryPoint, |
71 dartSdkPath: sdkPath, | 73 dartSdkPath: sdkPath, |
| 74 runtimeDir: runtimeDir, |
72 serverMode: serverMode); | 75 serverMode: serverMode); |
73 return new Compiler(options).run(); | 76 return new Compiler(options).run(); |
74 } | 77 } |
75 var realSdk = getSdkDir(arguments).path; | 78 var realSdk = getSdkDir(arguments).path; |
76 | 79 |
77 // Validate that old output is gone before running. | 80 // Validate that old output is gone before running. |
78 // TODO(jmesserly): it'd be nice to do all cleanup here, including removing | 81 // TODO(jmesserly): it'd be nice to do all cleanup here, including removing |
79 // pub's 'packages' symlinks which mess up the diff. That way this test | 82 // pub's 'packages' symlinks which mess up the diff. That way this test |
80 // can be self contained instead of depending on a shell script. | 83 // can be self contained instead of depending on a shell script. |
81 if (new Directory(actualDir).existsSync()) { | 84 if (new Directory(actualDir).existsSync()) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 print('[AnalysisEngine] error $message $exception'); | 221 print('[AnalysisEngine] error $message $exception'); |
219 } | 222 } |
220 | 223 |
221 @override void logError2(String message, Object exception) { | 224 @override void logError2(String message, Object exception) { |
222 print('[AnalysisEngine] error $message $exception'); | 225 print('[AnalysisEngine] error $message $exception'); |
223 } | 226 } |
224 | 227 |
225 void logInformation(String message, [CaughtException exception]) {} | 228 void logInformation(String message, [CaughtException exception]) {} |
226 void logInformation2(String message, Object exception) {} | 229 void logInformation2(String message, Object exception) {} |
227 } | 230 } |
OLD | NEW |