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

Unified Diff: tests/compiler/dart2js/kernel/compiler_helper.dart

Issue 2865693002: Create closed world for hello world using .dill file (Closed)
Patch Set: Updated cf. comments. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/kernel/compiler_helper.dart
diff --git a/tests/compiler/dart2js/kernel/compiler_helper.dart b/tests/compiler/dart2js/kernel/compiler_helper.dart
index 420f81a645afe58e4af8028621169739e9a5cd2e..2c0b644a6a69579d8d8036565b659a67ff2221c3 100644
--- a/tests/compiler/dart2js/kernel/compiler_helper.dart
+++ b/tests/compiler/dart2js/kernel/compiler_helper.dart
@@ -7,6 +7,7 @@
library dart2js.kernel.compiler_helper;
import 'dart:async';
+import 'dart:io';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common.dart';
@@ -22,6 +23,7 @@ import 'package:compiler/src/util/util.dart';
import 'package:expect/expect.dart';
import 'package:kernel/ast.dart' as ir;
import '../memory_compiler.dart';
+import '../../../../pkg/compiler/tool/generate_kernel.dart' as generate;
typedef Future<Compiler> CompileFunction();
@@ -135,3 +137,40 @@ class MemoryDillLibraryLoaderTask extends DillLibraryLoaderTask {
return createLoadedLibraries(program);
}
}
+
+Future<Compiler> compileWithDill(
+ Uri entryPoint, Map<String, String> memorySourceFiles,
+ {bool printSteps: false}) async {
+ if (memorySourceFiles.isNotEmpty) {
+ Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill');
+ if (printSteps) {
+ print('--- create temp directory $dir -------------------------------');
+ }
+ memorySourceFiles.forEach((String name, String source) {
+ new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source);
+ });
+ entryPoint = dir.uri.resolve(entryPoint.path);
+ }
+ if (printSteps) {
+ print('---- generate dill -----------------------------------------------');
+ }
+
+ Uri dillFile = Uri.parse('$entryPoint.dill');
+ await generate.main([
+ '--platform=out/ReleaseX64/patched_dart2js_sdk/platform.dill',
+ '$entryPoint'
+ ]);
+
+ if (printSteps) {
+ print('---- closed world from dill $dillFile ----------------------------');
+ }
+ Compiler compiler = compilerFor(entryPoint: dillFile, options: [
+ Flags.analyzeOnly,
+ Flags.enableAssertMessage,
+ Flags.loadFromDill
+ ]);
+ ElementResolutionWorldBuilder.useInstantiationMap = true;
+ compiler.resolution.retainCachesForTesting = true;
+ await compiler.run(dillFile);
+ return compiler;
+}
« no previous file with comments | « tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698