| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 // Partial test that the closed world computed from [WorldImpact]s derived from | 5 // Partial test that the closed world computed from [WorldImpact]s derived from |
| 6 // kernel is equivalent to the original computed from resolution. | 6 // kernel is equivalent to the original computed from resolution. |
| 7 library dart2js.kernel.compiler_helper; | 7 library dart2js.kernel.compiler_helper; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if (printSteps) { | 154 if (printSteps) { |
| 155 print('---- generate dill -----------------------------------------------'); | 155 print('---- generate dill -----------------------------------------------'); |
| 156 } | 156 } |
| 157 | 157 |
| 158 Uri dillFile = Uri.parse('$entryPoint.dill'); | 158 Uri dillFile = Uri.parse('$entryPoint.dill'); |
| 159 String buildDir = Platform.isMacOS ? 'xcodebuild' : 'out'; | 159 String buildDir = Platform.isMacOS ? 'xcodebuild' : 'out'; |
| 160 String configuration = | 160 String configuration = |
| 161 Platform.environment['DART_CONFIGURATION'] ?? 'ReleaseX64'; | 161 Platform.environment['DART_CONFIGURATION'] ?? 'ReleaseX64'; |
| 162 await generate.main([ | 162 await generate.main([ |
| 163 '--platform=$buildDir/$configuration/patched_dart2js_sdk/platform.dill', | 163 '--platform=$buildDir/$configuration/patched_dart2js_sdk/platform.dill', |
| 164 '$entryPoint' | 164 '--out=${dillFile.path}', |
| 165 '${entryPoint.path}', |
| 165 ]); | 166 ]); |
| 166 return dillFile; | 167 return dillFile; |
| 167 } | 168 } |
| 168 | 169 |
| 169 Future<Compiler> compileWithDill( | 170 Future<Compiler> compileWithDill( |
| 170 Uri entryPoint, Map<String, String> memorySourceFiles, List<String> options, | 171 Uri entryPoint, Map<String, String> memorySourceFiles, List<String> options, |
| 171 {bool printSteps: false, | 172 {bool printSteps: false, |
| 172 CompilerOutput compilerOutput, | 173 CompilerOutput compilerOutput, |
| 173 void beforeRun(Compiler compiler)}) async { | 174 void beforeRun(Compiler compiler)}) async { |
| 174 Uri dillFile = | 175 Uri dillFile = |
| 175 await createTemp(entryPoint, memorySourceFiles, printSteps: printSteps); | 176 await createTemp(entryPoint, memorySourceFiles, printSteps: printSteps); |
| 176 | 177 |
| 177 if (printSteps) { | 178 if (printSteps) { |
| 178 print('---- compile from dill $dillFile ---------------------------------'); | 179 print('---- compile from dill $dillFile ---------------------------------'); |
| 179 } | 180 } |
| 180 Compiler compiler = compilerFor( | 181 Compiler compiler = compilerFor( |
| 181 entryPoint: dillFile, | 182 entryPoint: dillFile, |
| 182 options: [Flags.loadFromDill]..addAll(options), | 183 options: [Flags.loadFromDill]..addAll(options), |
| 183 outputProvider: compilerOutput); | 184 outputProvider: compilerOutput); |
| 184 ElementResolutionWorldBuilder.useInstantiationMap = true; | 185 ElementResolutionWorldBuilder.useInstantiationMap = true; |
| 185 compiler.resolution.retainCachesForTesting = true; | 186 compiler.resolution.retainCachesForTesting = true; |
| 186 if (beforeRun != null) { | 187 if (beforeRun != null) { |
| 187 beforeRun(compiler); | 188 beforeRun(compiler); |
| 188 } | 189 } |
| 189 await compiler.run(dillFile); | 190 await compiler.run(dillFile); |
| 190 return compiler; | 191 return compiler; |
| 191 } | 192 } |
| OLD | NEW |