| Index: pkg/front_end/lib/src/fasta/compile_platform.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/compile_platform.dart b/pkg/front_end/lib/src/fasta/compile_platform.dart
|
| index 3403469581fc1410e97f041387a4f2be88b37ce6..c95a67040ad83357828b9991066095ec9255cf73 100644
|
| --- a/pkg/front_end/lib/src/fasta/compile_platform.dart
|
| +++ b/pkg/front_end/lib/src/fasta/compile_platform.dart
|
| @@ -8,11 +8,7 @@ import 'dart:async' show Future;
|
|
|
| import 'dart:io' show exitCode, File;
|
|
|
| -import '../../compiler_options.dart' show CompilerOptions;
|
| -
|
| -import '../base/processed_options.dart' show ProcessedOptions;
|
| -
|
| -import '../kernel_generator_impl.dart' show generateKernel;
|
| +import '../kernel_generator_impl.dart' show generateKernelInternal;
|
|
|
| import 'compiler_command_line.dart' show CompilerCommandLine;
|
|
|
| @@ -24,8 +20,6 @@ import 'kernel/utils.dart' show writeProgramToFile;
|
|
|
| import 'severity.dart' show Severity;
|
|
|
| -import 'ticker.dart' show Ticker;
|
| -
|
| const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
|
|
|
| Future mainEntryPoint(List<String> arguments) async {
|
| @@ -37,54 +31,44 @@ Future mainEntryPoint(List<String> arguments) async {
|
| await compilePlatform(arguments);
|
| } on deprecated_InputError catch (e) {
|
| exitCode = 1;
|
| - CompilerCommandLine.deprecated_withDefaultOptions(() => CompilerContext
|
| - .current
|
| - .report(deprecated_InputError.toMessage(e), Severity.error));
|
| + CompilerContext.runWithDefaultOptions(
|
| + (c) => c.report(deprecated_InputError.toMessage(e), Severity.error));
|
| return null;
|
| }
|
| }
|
| }
|
|
|
| Future compilePlatform(List<String> arguments) async {
|
| - Ticker ticker = new Ticker();
|
| - await CompilerCommandLine.withGlobalOptions("compile_platform", arguments,
|
| - (CompilerContext c) {
|
| - Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0]));
|
| - Uri fullOutput = Uri.base.resolveUri(new Uri.file(c.options.arguments[1]));
|
| - Uri outlineOutput =
|
| - Uri.base.resolveUri(new Uri.file(c.options.arguments[2]));
|
| - return compilePlatformInternal(
|
| - c, ticker, patchedSdk, fullOutput, outlineOutput);
|
| + await CompilerCommandLine
|
| + .withGlobalOptions("compile_platform", arguments, false,
|
| + (CompilerContext c, List<String> restArguments) {
|
| + c.options.inputs.add(Uri.parse('dart:core'));
|
| + // Note: the patchedSdk argument is already stored in c.options.sdkRoot.
|
| + Uri fullOutput = Uri.base.resolveUri(new Uri.file(restArguments[1]));
|
| + Uri outlineOutput = Uri.base.resolveUri(new Uri.file(restArguments[2]));
|
| + return compilePlatformInternal(c, fullOutput, outlineOutput);
|
| });
|
| }
|
|
|
| -Future compilePlatformInternal(CompilerContext c, Ticker ticker, Uri patchedSdk,
|
| - Uri fullOutput, Uri outlineOutput) async {
|
| - var options = new CompilerOptions()
|
| - ..strongMode = c.options.strongMode
|
| - ..sdkRoot = patchedSdk
|
| - ..packagesFileUri = c.options.packages
|
| - ..compileSdk = true
|
| - ..chaseDependencies = true
|
| - ..target = c.options.target
|
| - ..debugDump = c.options.dumpIr
|
| - ..verify = c.options.verify
|
| - ..verbose = c.options.verbose;
|
| -
|
| - if (options.strongMode) {
|
| +Future compilePlatformInternal(
|
| + CompilerContext c, Uri fullOutput, Uri outlineOutput) async {
|
| + if (c.options.strongMode) {
|
| print("Note: strong mode support is preliminary and may not work.");
|
| }
|
| - if (options.verbose) {
|
| - print("Generating outline of $patchedSdk into $outlineOutput");
|
| - print("Compiling $patchedSdk to $fullOutput");
|
| + if (c.options.verbose) {
|
| + print("Generating outline of ${c.options.sdkRoot} into $outlineOutput");
|
| + print("Compiling ${c.options.sdkRoot} to $fullOutput");
|
| }
|
|
|
| - var result = await generateKernel(
|
| - new ProcessedOptions(options, false, [Uri.parse('dart:core')]),
|
| - buildSummary: true,
|
| - buildProgram: true);
|
| + var result =
|
| + await generateKernelInternal(buildSummary: true, buildProgram: true);
|
| + if (result == null) {
|
| + // Note: an error should have been reported by now.
|
| + print('The platform .dill files were not created.');
|
| + return;
|
| + }
|
| new File.fromUri(outlineOutput).writeAsBytesSync(result.summary);
|
| - ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
|
| + c.options.ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
|
| await writeProgramToFile(result.program, fullOutput);
|
| - ticker.logMs("Wrote program to ${fullOutput.toFilePath()}");
|
| + c.options.ticker.logMs("Wrote program to ${fullOutput.toFilePath()}");
|
| }
|
|
|