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

Side by Side Diff: tests/compiler/dart2js/memory_compiler.dart

Issue 2997413002: Support --use-kernel in memory_compiler (Closed)
Patch Set: Remove hack in source_loader 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 | « tests/compiler/dart2js/kernel/visitor_test.dart ('k') | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 dart2js.test.memory_compiler; 5 library dart2js.test.memory_compiler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:compiler/compiler.dart' show DiagnosticHandler; 9 import 'package:compiler/compiler.dart' show DiagnosticHandler;
10 import 'package:compiler/compiler_new.dart' 10 import 'package:compiler/compiler_new.dart'
11 show 11 show
12 CompilationResult, 12 CompilationResult,
13 CompilerDiagnostics, 13 CompilerDiagnostics,
14 CompilerOutput, 14 CompilerOutput,
15 Diagnostic, 15 Diagnostic,
16 PackagesDiscoveryProvider; 16 PackagesDiscoveryProvider;
17 import 'package:compiler/src/commandline_options.dart';
17 import 'package:compiler/src/diagnostics/messages.dart' show Message; 18 import 'package:compiler/src/diagnostics/messages.dart' show Message;
18 import 'package:compiler/src/elements/entities.dart' 19 import 'package:compiler/src/elements/entities.dart'
19 show LibraryEntity, MemberEntity; 20 show LibraryEntity, MemberEntity;
20 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer; 21 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer;
21 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput; 22 import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput;
22 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; 23 import 'package:compiler/src/library_loader.dart' show LoadedLibraries;
23 import 'package:compiler/src/options.dart' show CompilerOptions; 24 import 'package:compiler/src/options.dart' show CompilerOptions;
24 25
25 import 'memory_source_file_helper.dart'; 26 import 'memory_source_file_helper.dart';
26 27
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 CompilerDiagnostics diagnosticHandler, 78 CompilerDiagnostics diagnosticHandler,
78 CompilerOutput outputProvider, 79 CompilerOutput outputProvider,
79 List<String> options: const <String>[], 80 List<String> options: const <String>[],
80 CompilerImpl cachedCompiler, 81 CompilerImpl cachedCompiler,
81 bool showDiagnostics: true, 82 bool showDiagnostics: true,
82 Uri packageRoot, 83 Uri packageRoot,
83 Uri packageConfig, 84 Uri packageConfig,
84 PackagesDiscoveryProvider packagesDiscoveryProvider, 85 PackagesDiscoveryProvider packagesDiscoveryProvider,
85 void beforeRun(CompilerImpl compiler)}) async { 86 void beforeRun(CompilerImpl compiler)}) async {
86 if (entryPoint == null) { 87 if (entryPoint == null) {
87 if (options.contains('--read-dill')) { 88 entryPoint = Uri.parse('memory:main.dart');
88 entryPoint = Uri.parse('memory:main.dill');
89 } else {
90 entryPoint = Uri.parse('memory:main.dart');
91 }
92 } 89 }
93 CompilerImpl compiler = compilerFor( 90 CompilerImpl compiler = compilerFor(
94 entryPoint: entryPoint, 91 entryPoint: entryPoint,
95 resolutionInputs: resolutionInputs, 92 resolutionInputs: resolutionInputs,
96 memorySourceFiles: memorySourceFiles, 93 memorySourceFiles: memorySourceFiles,
97 diagnosticHandler: diagnosticHandler, 94 diagnosticHandler: diagnosticHandler,
98 outputProvider: outputProvider, 95 outputProvider: outputProvider,
99 options: options, 96 options: options,
100 cachedCompiler: cachedCompiler, 97 cachedCompiler: cachedCompiler,
101 showDiagnostics: showDiagnostics, 98 showDiagnostics: showDiagnostics,
(...skipping 13 matching lines...) Expand all
115 List<Uri> resolutionInputs, 112 List<Uri> resolutionInputs,
116 Map<String, dynamic> memorySourceFiles: const <String, dynamic>{}, 113 Map<String, dynamic> memorySourceFiles: const <String, dynamic>{},
117 CompilerDiagnostics diagnosticHandler, 114 CompilerDiagnostics diagnosticHandler,
118 CompilerOutput outputProvider, 115 CompilerOutput outputProvider,
119 List<String> options: const <String>[], 116 List<String> options: const <String>[],
120 CompilerImpl cachedCompiler, 117 CompilerImpl cachedCompiler,
121 bool showDiagnostics: true, 118 bool showDiagnostics: true,
122 Uri packageRoot, 119 Uri packageRoot,
123 Uri packageConfig, 120 Uri packageConfig,
124 PackagesDiscoveryProvider packagesDiscoveryProvider}) { 121 PackagesDiscoveryProvider packagesDiscoveryProvider}) {
125 Uri libraryRoot = Uri.base.resolve('sdk/'); 122 Uri libraryRoot;
123 if (options.contains(Flags.useKernel)) {
124 String buildDir = Platform.isMacOS ? 'xcodebuild' : 'out';
125 String configuration =
126 Platform.environment['DART_CONFIGURATION'] ?? 'ReleaseX64';
127 libraryRoot = Uri.base.resolve('$buildDir/$configuration/dart-sdk/');
128 } else {
129 libraryRoot = Uri.base.resolve('sdk/');
130 }
131
126 if (packageRoot == null && 132 if (packageRoot == null &&
127 packageConfig == null && 133 packageConfig == null &&
128 packagesDiscoveryProvider == null) { 134 packagesDiscoveryProvider == null) {
129 if (Platform.packageRoot != null) { 135 if (Platform.packageRoot != null) {
130 packageRoot = Uri.base.resolve(Platform.packageRoot); 136 packageRoot = Uri.base.resolve(Platform.packageRoot);
131 } else if (Platform.packageConfig != null) { 137 } else if (Platform.packageConfig != null) {
132 packageConfig = Uri.base.resolve(Platform.packageConfig); 138 packageConfig = Uri.base.resolve(Platform.packageConfig);
133 } else { 139 } else {
134 // The tests are run with the base directory as the SDK root 140 // The tests are run with the base directory as the SDK root
135 // so just use the .packages file there. 141 // so just use the .packages file there.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) { 255 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {
250 diagnosticHandler(uri, begin, end, message, kind); 256 diagnosticHandler(uri, begin, end, message, kind);
251 formattingHandler(uri, begin, end, message, kind); 257 formattingHandler(uri, begin, end, message, kind);
252 }; 258 };
253 } 259 }
254 } else if (diagnosticHandler == null) { 260 } else if (diagnosticHandler == null) {
255 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {}; 261 handler = (Uri uri, int begin, int end, String message, Diagnostic kind) {};
256 } 262 }
257 return handler; 263 return handler;
258 } 264 }
265
266 main() {
267 runCompiler(
268 memorySourceFiles: {'main.dart': 'main() {}'},
269 options: [Flags.useKernel]);
270 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/kernel/visitor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698