Skip to content

Commit

Permalink
Roll Dart to 93d8c9f. (flutter#4558)
Browse files Browse the repository at this point in the history
* Roll Dart to 93d8c9f.

* Fix analyzer nits

* Try to pin dependency for tools/licenses to convert 2.0.1. Add verbose flag to pub get

* Pin dart to dev.16 to overcome pub issue

* Revert "Try to pin dependency for tools/licenses to convert 2.0.1. Add verbose flag to pub get"

This reverts commit d525a83 as it is no
longer needed, was added to diagnose the problem, which turned out to be
a problem with pub in latest dart dev release.

* Fix license hash

* Reintroduce api methods and tests
  • Loading branch information
sivachandra authored and aam committed Jan 18, 2018
1 parent 5e89d7a commit 2b398ee
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: dart
dart:
- dev
# Pin to dev.16 to overcome dartbug.com/31940
- dev/release/2.0.0-dev.16.0
sudo: false
before_script:
- ./travis/setup.sh
Expand Down
8 changes: 4 additions & 4 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '28757928b47b192efcec082c78258102beb03f78',
'dart_revision': '93d8c9fe2a2c22dc95ec85866af108cfab71ad06',

'dart_args_tag': '0.13.7',
'dart_async_tag': '2.0.2',
Expand Down Expand Up @@ -59,8 +59,8 @@ vars = {
'dart_http_throttle_tag': '1.0.1',
'dart_intl_tag': '0.15.2',
'dart_isolate_tag': '1.1.0',
'dart_json_rpc_2_tag': '2.0.4',
'dart_linter_tag': '0.1.41',
'dart_json_rpc_2_tag': '2.0.6',
'dart_linter_tag': '0.1.42',
'dart_logging_tag': '0.11.3+1',
'dart_markdown_tag': '1.0.0',
'dart_matcher_tag': '0.12.1+4',
Expand All @@ -75,7 +75,7 @@ vars = {
'dart_plugin_tag': '0.2.0+2',
'dart_pool_tag': '1.3.4',
'dart_protobuf_tag': '0.6.0',
'dart_pub_rev': '667281eef93b4be648cceca400e954e000edba38',
'dart_pub_rev': 'ca0d52f5d4058e7b9ef7b5091e407ff3ac05198d',
'dart_pub_semver_tag': '1.3.2',
'dart_quiver_tag': '0.27.0',
'dart_resource_rev': 'af5a5bf65511943398146cf146e466e5f0b95cb9',
Expand Down
31 changes: 18 additions & 13 deletions frontend_server/lib/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ class _FrontendCompiler implements CompilerInterface {
StringSink _outputStream;
BinaryPrinterFactory printerFactory;

CompilerOptions _compilerOptions;
Uri _entryPoint;

IncrementalKernelGenerator _generator;
String _kernelBinaryFilename;

Expand All @@ -156,14 +159,11 @@ class _FrontendCompiler implements CompilerInterface {

Program program;
if (options['incremental']) {
_generator = generator != null
? generator
: await IncrementalKernelGenerator.newInstance(
compilerOptions, filenameUri,
useMinimalGenerator: true);
final DeltaProgram deltaProgram =
_entryPoint = filenameUri;
_compilerOptions = compilerOptions;
_generator = generator ?? _createGenerator();
program =
await _runWithPrintRedirection(() => _generator.computeDelta());
program = deltaProgram.newProgram;
} else {
if (options['link-platform']) {
// TODO(aam): Remove linkedDependencies once platform is directly embedded
Expand Down Expand Up @@ -192,23 +192,23 @@ class _FrontendCompiler implements CompilerInterface {
Future<Null> recompileDelta() async {
final String boundaryKey = new Uuid().generateV4();
_outputStream.writeln('result $boundaryKey');
final DeltaProgram deltaProgram = await _generator.computeDelta();
final Program deltaProgram = await _generator.computeDelta();
final IOSink sink = new File(_kernelBinaryFilename).openWrite();
final BinaryPrinter printer = printerFactory.newBinaryPrinter(sink);
printer.writeProgramFile(deltaProgram.newProgram);
printer.writeProgramFile(deltaProgram);
await sink.close();
_outputStream.writeln('$boundaryKey $_kernelBinaryFilename');
return null;
}

@override
void acceptLastDelta() {
_generator.acceptLastDelta();
// TODO(aam): implement this considering new incremental compiler API.
}

@override
void rejectLastDelta() {
_generator.rejectLastDelta();
// TODO(aam): implement this considering new incremental compiler API.
}

@override
Expand All @@ -218,9 +218,12 @@ class _FrontendCompiler implements CompilerInterface {

@override
void resetIncrementalCompiler() {
_generator.reset();
_generator = _createGenerator();
}

IncrementalKernelGenerator _createGenerator() =>
new IncrementalKernelGenerator(_compilerOptions, _entryPoint);

Uri _ensureFolderPath(String path) {
String uriPath = new Uri.file(path).toString();
if (!uriPath.endsWith('/')) {
Expand Down Expand Up @@ -268,6 +271,7 @@ Future<int> starter(
compiler.acceptLastDelta();
await compiler.recompileDelta();
compiler.acceptLastDelta();
compiler.resetIncrementalCompiler();
await compiler.recompileDelta();
compiler.acceptLastDelta();
await compiler.recompileDelta();
Expand Down Expand Up @@ -311,7 +315,8 @@ Future<int> starter(
} else if (string == 'accept') {
compiler.acceptLastDelta();
} else if (string == 'reject') {
compiler.rejectLastDelta();
// TODO(aam) implement reject so it won't reset compiler.
compiler.resetIncrementalCompiler();
} else if (string == 'reset') {
compiler.resetIncrementalCompiler();
} else if (string == 'quit') {
Expand Down
19 changes: 10 additions & 9 deletions frontend_server/test/server_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:frontend_server/server.dart';
// ignore_for_file: implementation_imports
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart';
import 'package:kernel/binary/ast_to_binary.dart';
import 'package:kernel/ast.dart' show Program;
import 'package:mockito/mockito.dart';
import 'package:test/test.dart';

Expand Down Expand Up @@ -193,7 +194,7 @@ Future<int> main() async {
await compileCalled.first;
inputStreamController.close();
});

test('compile one file (strong mode)', () async {
final StreamController<List<int>> inputStreamController =
new StreamController<List<int>>();
Expand Down Expand Up @@ -277,7 +278,7 @@ Future<int> main() async {

test('accept', () async {
final StreamController<List<int>> inputStreamController =
new StreamController<List<int>>();
new StreamController<List<int>>();
final ReceivePort acceptCalled = new ReceivePort();
when(compiler.acceptLastDelta()).thenAnswer((Invocation invocation) {
acceptCalled.sendPort.send(true);
Expand All @@ -293,17 +294,17 @@ Future<int> main() async {

test('reject', () async {
final StreamController<List<int>> inputStreamController =
new StreamController<List<int>>();
final ReceivePort rejectCalled = new ReceivePort();
when(compiler.rejectLastDelta()).thenAnswer((Invocation invocation) {
rejectCalled.sendPort.send(true);
new StreamController<List<int>>();
final ReceivePort resetCalled = new ReceivePort();
when(compiler.resetIncrementalCompiler()).thenAnswer((Invocation invocation) {
resetCalled.sendPort.send(true);
});
final int exitcode = await starter(args, compiler: compiler,
input: inputStreamController.stream,
);
expect(exitcode, equals(0));
inputStreamController.add('reject\n'.codeUnits);
await rejectCalled.first;
await resetCalled.first;
inputStreamController.close();
});

Expand Down Expand Up @@ -386,8 +387,8 @@ Future<int> main() async {

final _MockedIncrementalKernelGenerator generator =
new _MockedIncrementalKernelGenerator();
when(generator.computeDelta()).thenReturn(new Future<DeltaProgram>.value(
new DeltaProgram('', null /* program stub */)
when(generator.computeDelta()).thenReturn(new Future<Program>.value(
new Program()
));
final _MockedBinaryPrinterFactory printerFactory =
new _MockedBinaryPrinterFactory();
Expand Down
8 changes: 5 additions & 3 deletions runtime/dart_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ static void ReleaseFetchedBytes(uint8_t* buffer) {
}

Dart_Isolate ServiceIsolateCreateCallback(const char* script_uri,
Dart_IsolateFlags* flags,
char** error) {
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE
// No VM-service in release mode.
Expand All @@ -246,14 +247,15 @@ Dart_Isolate ServiceIsolateCreateCallback(const char* script_uri,

bool is_running_from_kernel = GetKernelPlatformBinary() != nullptr;

flags->load_vmservice_library = true;
Dart_Isolate isolate =
is_running_from_kernel
? Dart_CreateIsolateFromKernel(
script_uri, "main", kernel_platform, nullptr /* flags */,
script_uri, "main", kernel_platform, flags,
static_cast<tonic::DartState*>(dart_state), error)
: Dart_CreateIsolate(
script_uri, "main", g_default_isolate_snapshot_data,
g_default_isolate_snapshot_instructions, nullptr,
g_default_isolate_snapshot_instructions, flags,
static_cast<tonic::DartState*>(dart_state), error);

FXL_CHECK(isolate) << error;
Expand Down Expand Up @@ -314,7 +316,7 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri,
TRACE_EVENT0("flutter", __func__);

if (IsServiceIsolateURL(script_uri)) {
return ServiceIsolateCreateCallback(script_uri, error);
return ServiceIsolateCreateCallback(script_uri, flags, error);
}

std::string entry_uri = script_uri;
Expand Down
2 changes: 1 addition & 1 deletion travis/licenses_golden/licenses_third_party
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: 5eac0d88d1c8ffe7fc4768fb2eefb1eb
Signature: a19a996e741c694d2226e3845d598e64

UNUSED LICENSES:

Expand Down

0 comments on commit 2b398ee

Please sign in to comment.