8bfc4b47c0
This adds a class CanonicalName that can represent a library, class, or member. All references now go through a Reference object, which is linked to both the AST node and its CanonicalName, so either can be created first. dartk now accepts multiple input files: - If multiple dart files are given, they are all compiled. - If multiple binaries are given, they are linked together. Mixed dart and binary input is not supported by dartk. dartk now has a flag --include-sdk which includes the entire SDK in the output. This is so the SDK can be compiled alone and then linked. Example of compiling separately and then linking: dartk foo.dart -o foo.dill dartk main.dart -o main.dill dartk --include-sdk -o sdk.dill dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill dartk still has incredibly slow cold start due to the analyzer loading the dart sdk, so this does not actually speed things up at the moment. BUG= R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com Review-Url: https://codereview.chromium.org/2665723002 .
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import '../bin/batch_util.dart';
|
|
import 'dart:async';
|
|
|
|
/// Wraps a main() method for a test that should be runnable as a self-checking
|
|
/// unit test.
|
|
///
|
|
/// These tests can be run like:
|
|
///
|
|
/// tools/test.py -cdartk -rself_check
|
|
///
|
|
/// The test can either be run with a single file passed on the command line
|
|
/// or run in batch mode.
|
|
runSelfCheck(List<String> args, Future runTest(String filename)) {
|
|
Future<CompilerOutcome> batchMain(List<String> arguments) async {
|
|
if (arguments.length != 1) {
|
|
throw 'Exactly one argument expected';
|
|
}
|
|
String filename = arguments[0];
|
|
if (!filename.endsWith('.dill')) {
|
|
throw 'File does not have expected .dill extension: $filename';
|
|
}
|
|
await runTest(filename);
|
|
return CompilerOutcome.Ok;
|
|
}
|
|
|
|
if (args.length == 1 && args[0] == '--batch') {
|
|
runBatch(batchMain);
|
|
} else {
|
|
batchMain(args);
|
|
}
|
|
}
|