Siva 8be2aca567 Roll src/third_party/dart 1bd36d694d..674fd0e060 (48 commits) #8152
674fd0e060 [vm runtime] Dynamically disable dual mapping of code on some platforms
0bd674c374 [VM-Runtime] set environment when creating detached process
578fdb0408 Call becomeMap/becomeSet() in AstCloner.
382cd59388 Update completion target tests for new map syntax
1db664764a Revert "Copy abi dills in create_sdk build rule"
a39833d957 Reland "Reland "[VM runtime] Dual mapping of executable pages.""
49a0502f49 Copy abi dills in create_sdk build rule
23eb57c2bf Revert "[vm/ffi] Support Windows 64 bit"
22c2c7ffd8 Sort declarations in build_mode.dart
e2b5559c77 [infra] Use gclient.py to apply patches to bypass update_depot_tools
f4b524cdf1 [vm] Extract reading of parameter covariance attributes
16e40cef2f Generate a diagnostic when a set or map literal is ambiguous
b89d08355b [infra] Only move coredump files on shards
7f812dea1a [vm/ffi] Support Windows 64 bit
469da726d6 [vm] Put covariance attributes into Field flags
09087490e2 update hasFix lookup table
bb7b5fcd37 add missing fix tests
48a5c3825a assist to convert to absolute imports
b3927f66df [gardening] Mark tests that crash as crashing
2d6ddf2aff Remove unnecessary override from PartialResolverVisitor
ba3b9b3b65 Sort static_type_analyzer_test.dart
1edc6d4b4d [infra] Fix approve_results not erroring properly if tryjobs lack results.
1a196d43a7 [VM/AOT] Execute catch-entry moves in parallel (our AOT doesn't generate non-cyclic moves)
6a2aa920cd Support pragma annotations through ir constants
d3d077090d [VM/FrontendServer] Add 3head patch to frontend server after breaking API changes
016e3172d1 Default parameters, more metadata, import dart:core.
853d38896e [VM/AOT] Fixes incorrect deserialization of catch entry moves
3cf7d6a9c7 [tests] Changing expected cast errors to type errors for collections tests
b87c44d6b3 Generate diagnostic for non-bool conditions in if elements
74395d940f Comment out test_import_short_absolute that fails on Windows.
7c1544898d [vm] Decouple flow graph building of implicit getters and setters from kernel reading
57f4da318c [vm, gc] The mutator's TLAB and the interpreter's lookup cache must be visited even if the mutator is unscheduled.
15842d4583 Build more import scopes, support for enums.
f2029f54cd Fix type inference of map/set literals when the context is a type parameter.
11b9481403 [vm/frontend] Fix frontend_server_test on Windows.
bfb30bffe0 Fix a bug in the ConstantVerifier so that conditional elements are lazily verified
ed1f956991 Fix the abi dills download script
8f03ae05ff [infra] Add --list-configurations option to test.dart.
9faca2fa68 [vm] Document lifetime requirements of arguments to Dart_TimelineEvent.
295ea59385 [vm] Give functions compiled through Dart_LoadCompilationTrace a non-zero usage counter.
def0b21225 [infra] Fix test.dart saying untested configurations don't exist.
abd1854176 Fix recording of map/literal context type.
a8b3461f2e New summaries work snapshot.
9e7627b6a1 Re-land "Eliminate uses of old AST node types from pkg/analyzer/lib/src/summary"
210361ae63 Move IgnoreInfo out of the task model code base
440b4cd84e Insert implicit casts when setting interface targets
567d552de8 [infra] Add versionchecker and debianpackage to test matrix
576c4c71d9 [CFE] Always clone subexpressions of unevaluated constants.
2019-03-13 09:23:57 -07:00

140 lines
4.3 KiB
Dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library flutter_frontend_server;
import 'dart:async';
import 'dart:io' hide FileSystemEntity;
import 'package:args/args.dart';
import 'package:path/path.dart' as path;
import 'package:flutter_kernel_transformers/track_widget_constructor_locations.dart';
import 'package:vm/incremental_compiler.dart';
import 'package:vm/frontend_server.dart' as frontend show FrontendCompiler,
CompilerInterface, listenAndCompile, argParser, usage;
/// Wrapper around [FrontendCompiler] that adds [widgetCreatorTracker] kernel
/// transformation to the compilation.
class _FlutterFrontendCompiler implements frontend.CompilerInterface{
final frontend.CompilerInterface _compiler;
_FlutterFrontendCompiler(StringSink output,
{bool trackWidgetCreation: false, bool unsafePackageSerialization}) :
_compiler = new frontend.FrontendCompiler(output,
transformer: trackWidgetCreation ? new WidgetCreatorTracker() : null,
unsafePackageSerialization: unsafePackageSerialization);
@override
Future<bool> compile(String filename, ArgResults options, {IncrementalCompiler generator}) async {
return _compiler.compile(filename, options, generator: generator);
}
@override
Future<Null> recompileDelta({String entryPoint}) async {
return _compiler.recompileDelta(entryPoint: entryPoint);
}
@override
void acceptLastDelta() {
_compiler.acceptLastDelta();
}
@override
Future<void> rejectLastDelta() async {
return _compiler.rejectLastDelta();
}
@override
void invalidate(Uri uri) {
_compiler.invalidate(uri);
}
@override
Future<Null> compileExpression(
String expression,
List<String> definitions,
List<String> typeDefinitions,
String libraryUri,
String klass,
bool isStatic) {
return _compiler.compileExpression(expression, definitions, typeDefinitions,
libraryUri, klass, isStatic);
}
@override
void reportError(String msg) {
_compiler.reportError(msg);
}
@override
void resetIncrementalCompiler() {
_compiler.resetIncrementalCompiler();
}
}
/// Entry point for this module, that creates `_FrontendCompiler` instance and
/// processes user input.
/// `compiler` is an optional parameter so it can be replaced with mocked
/// version for testing.
Future<int> starter(
List<String> args, {
frontend.CompilerInterface compiler,
Stream<List<int>> input,
StringSink output,
}) async {
ArgResults options;
frontend.argParser
..addFlag('track-widget-creation',
help: 'Run a kernel transformer to track creation locations for widgets.',
defaultsTo: false);
try {
options = frontend.argParser.parse(args);
} catch (error) {
print('ERROR: $error\n');
print(frontend.usage);
return 1;
}
if (options['train']) {
final String sdkRoot = options['sdk-root'];
final Directory temp = Directory.systemTemp.createTempSync('train_frontend_server');
try {
final String outputTrainingDill = path.join(temp.path, 'app.dill');
options = frontend.argParser.parse(<String>[
'--incremental',
'--sdk-root=$sdkRoot',
'--output-dill=$outputTrainingDill',
'--target=flutter']);
compiler ??= new _FlutterFrontendCompiler(output, trackWidgetCreation: true);
await compiler.compile(Platform.script.toFilePath(), options);
compiler.acceptLastDelta();
await compiler.recompileDelta();
compiler.acceptLastDelta();
compiler.resetIncrementalCompiler();
await compiler.recompileDelta();
compiler.acceptLastDelta();
await compiler.recompileDelta();
compiler.acceptLastDelta();
return 0;
} finally {
temp.deleteSync(recursive: true);
}
}
compiler ??= new _FlutterFrontendCompiler(output,
trackWidgetCreation: options['track-widget-creation'],
unsafePackageSerialization: options['unsafe-package-serialization']);
if (options.rest.isNotEmpty) {
return await compiler.compile(options.rest[0], options) ? 0 : 254;
}
final Completer<int> completer = new Completer<int>();
frontend.listenAndCompile(compiler, input ?? stdin, options, completer);
return completer.future;
}