Do not hide problems in kernel_sdk.dart
This addresses the most concerning problem in #37117 Change-Id: I38feb310023b066922a8049c5026a49572c3e399 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105461 Reviewed-by: Vijay Menon <vsm@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
9559e4d444
commit
fddecf659c
@@ -14,7 +14,12 @@ import 'package:dev_compiler/src/kernel/target.dart';
|
||||
import 'package:dev_compiler/src/kernel/command.dart';
|
||||
import 'package:dev_compiler/src/kernel/compiler.dart';
|
||||
import 'package:front_end/src/api_unstable/ddc.dart'
|
||||
show CompilerOptions, kernelForComponent;
|
||||
show
|
||||
CompilerOptions,
|
||||
kernelForComponent,
|
||||
DiagnosticMessage,
|
||||
printDiagnosticMessage,
|
||||
Severity;
|
||||
import 'package:kernel/kernel.dart';
|
||||
import 'package:kernel/target/targets.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
@@ -38,14 +43,25 @@ Future main(List<String> args) async {
|
||||
}
|
||||
|
||||
var librarySpecPath = parserOptions['libraries'] as String;
|
||||
var packagesPath = path.join(ddcPath, '../../.packages');
|
||||
|
||||
var target = DevCompilerTarget(TargetFlags());
|
||||
void onDiagnostic(DiagnosticMessage message) {
|
||||
printDiagnosticMessage(message, print);
|
||||
if (message.severity == Severity.error ||
|
||||
message.severity == Severity.internalProblem) {
|
||||
exitCode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var options = CompilerOptions()
|
||||
..compileSdk = true
|
||||
// TODO(sigmund): remove this unnecessary option when possible.
|
||||
// TODO(sigmund): remove these two unnecessary options when possible.
|
||||
..sdkRoot = Uri.base
|
||||
..packagesFileUri = Uri.base.resolveUri(Uri.file(packagesPath))
|
||||
..librariesSpecificationUri = Uri.base.resolveUri(Uri.file(librarySpecPath))
|
||||
..target = target;
|
||||
..target = target
|
||||
..onDiagnostic = onDiagnostic;
|
||||
|
||||
var inputs = target.extraRequiredLibraries.map(Uri.parse).toList();
|
||||
var component = await kernelForComponent(inputs, options);
|
||||
|
||||
Reference in New Issue
Block a user