| Index: pkg/front_end/lib/compiler_options.dart
|
| diff --git a/pkg/front_end/lib/compiler_options.dart b/pkg/front_end/lib/compiler_options.dart
|
| index acc4e11ffbdf9017700be8e748b7aa9639d5795e..83283fb15562d755239cee2cbcb9770eca19f006 100644
|
| --- a/pkg/front_end/lib/compiler_options.dart
|
| +++ b/pkg/front_end/lib/compiler_options.dart
|
| @@ -4,12 +4,15 @@
|
|
|
| library front_end.compiler_options;
|
|
|
| +import 'dart:async';
|
| +
|
| import 'package:front_end/src/base/performace_logger.dart';
|
| import 'package:front_end/src/incremental/byte_store.dart';
|
|
|
| import 'compilation_error.dart';
|
| import 'file_system.dart';
|
| import 'physical_file_system.dart';
|
| +import 'src/simple_error.dart';
|
|
|
| /// Default error handler used by [CompilerOptions.onError].
|
| void defaultErrorHandler(CompilationError error) => throw error;
|
| @@ -147,3 +150,24 @@ class CompilerOptions {
|
| // SDK itself.
|
| List<Uri> additionalLibraries = [];
|
| }
|
| +
|
| +Future<bool> validateOptions(CompilerOptions options) async {
|
| + var fs = options.fileSystem;
|
| + var root = options.sdkRoot;
|
| +
|
| + bool _report(String msg) {
|
| + options.onError(new SimpleError(msg));
|
| + return false;
|
| + }
|
| +
|
| + if (root != null && !await fs.entityForUri(root).exists()) {
|
| + return _report("SDK root directory not found: ${options.sdkRoot}");
|
| + }
|
| +
|
| + var summary = options.sdkSummary;
|
| + if (summary != null && !await fs.entityForUri(summary).exists()) {
|
| + return _report("SDK summary not found: ${options.sdkSummary}");
|
| + }
|
| +
|
| + return true;
|
| +}
|
|
|