提交 fe0e123b 编写于 作者: A Alexander Aprelev 提交者: GitHub

Introduce frontend_server that flutter tools will use for compilation. (#3982)

* Introduce frontend_server that allows for interactive and batch modes.

Example of batch mode:
```
$ dart $HOME/p/f/t11/flutter/engine/src/flutter/frontend_server/bin/server.dart --sdk-root=$HOME/p/f/t11/flutter/engine/src/out/android_debug/flutter_patched_sdk --platform-kernel-dill=$HOME/p/f/t11/flutter/engine/src/out/android_debug/flutter_patched_sdk/platform.dill $HOME/p/f/t11/flutter/flutter/examples/flutter_gallery/lib/main.dart

out: result 79256789-598c-4909-a9e4-0ef36d4c26ba
out: 'State&TickerProviderStateMixin^#U0^' is exported from both 'package:flutter/src/widgets/animated_cross_fade.dart' and 'package:flutter/src/widgets/animated_list.dart'.
...
out: Superclass has no method named 'hitTest'.
out: 79256789-598c-4909-a9e4-0ef36d4c26ba $HOME/p/f/t11/flutter/flutter/examples/flutter_gallery/lib/main.dart.dill
$
```

Example of interactive mode - communication via stdin/stdout:
```
$ dart $HOME/p/f/t11/flutter/engine/src/flutter/frontend_server/bin/server.dart --sdk-root=$HOME/p/f/t11/flutter/engine/src/out/android_debug/flutter_patched_sdk --platform-kernel-dill=$HOME/p/f/t11/flutter/engine/src/out/android_debug/flutter_patched_sdk/platform.dill --incremental

out: Frontend server is ready.
in: compile abc.dart
out: result fd99c0f9-12bb-4083-818e-2521d454fdc8
out: fd99c0f9-12bb-4083-818e-2521d454fdc8 abc.dart.dill
in: accept
in: recompile kuka
in: 123.dart
in: 456.dart
in: kuka
out: result d12f8d05-6c79-44f7-a775-1d3469e1be53
in: quit
$
```

* Add test. Cleanup dependencies.

* One more test with mocks

* Remove platform-kernel option. Refactored CompilerOptions. Clean up comments.

* Update license

* Use Uri.base.resolve consistently. Ensure folder path for sdk root. Fix test.

* Fix main_dart for frontend_server build target

* Reintroduce .packages file, add README.md, revert changes to licenses_flutter

* Run analyzer on frontend-server. Update .packages deps so tests can be run too.

* Add analyzer options file

* Clean up dependencies

* Add frontend_server files to license file back

* Fix comment in analysis_options.yaml

* Run frontend_server tests in travis

* Update licenses

* Change a+x permission on travis/test.sh

* pub get before pub run test

* Fix path to when

* Clarify accept/reject instructions

* Formatting, fixed docs, style

* Update license script to skip .travis.yml, when/example. Update license file.

* Update style nits

* Fix license

* Trim license extracted text. Fix licenses

* Update licenses_third_party signature

* Few more tests

* Update dart license

* Update dart license

* Style changes. Fix return value for Future<Null>
上级 600567ef
......@@ -5,3 +5,4 @@ before_script:
- ./travis/setup.sh
script:
- ./travis/build.sh
- ./travis/test.sh
......@@ -14,7 +14,8 @@ group("flutter") {
if (!is_fuchsia) {
if (current_toolchain == host_toolchain) {
deps += [
"//dart:create_sdk"
"//dart:create_sdk",
"//flutter/frontend_server",
]
}
}
......
......@@ -36,6 +36,7 @@ vars = {
'dart_async_tag': 'daf66909019d2aaec1721fc39d94ea648a9fdc1d',
'dart_barback_tag': '0.15.2+11',
'dart_bazel_worker_tag': 'v0.1.4',
'dart_boolean_selector_tag': '1.0.2',
'dart_boringssl_gen_rev': '753224969dbe43dad29343146529727b5066c0f3',
'dart_boringssl_rev': 'd519bf6be0b447fb80fbc539d4bff4479b5482a2',
'dart_charcode_tag': 'v1.1.1',
......@@ -60,6 +61,7 @@ vars = {
'dart_linter_tag': '0.1.35',
'dart_logging_tag': '0.11.3+1',
'dart_markdown_tag': '0.11.3',
'dart_matcher_tag': '0.12.0+2',
'dart_mime_rev': '75890811d4af5af080351ba8a2853ad4c8df98dd',
'dart_mustache4dart_tag': 'v1.1.0',
'dart_oauth2_tag': '1.0.2',
......@@ -75,12 +77,17 @@ vars = {
'dart_quiver_tag': '0.22.0',
'dart_resource_rev': 'a49101ba2deb29c728acba6fb86000a8f730f4b1',
'dart_root_certificates_rev': 'a4c7c6f23a664a37bc1b6f15a819e3f2a292791a',
'dart_shelf_packages_handler_tag': '1.0.0',
'dart_shelf_static_tag': '0.2.4',
'dart_shelf_tag': '0.6.7+2',
'dart_shelf_web_socket_tag': '0.2.1',
'dart_source_map_stack_trace_tag': '1.1.4',
'dart_source_maps_tag': '0.10.4',
'dart_source_span_tag': '1.4.0',
'dart_stack_trace_tag': '1.7.2',
'dart_stream_channel_tag': '1.6.1',
'dart_string_scanner_tag': '1.0.1',
'dart_test_tag': '0.12.18+1',
'dart_tuple_tag': 'v1.0.1',
'dart_typed_data_tag': '1.1.3',
'dart_usage_tag': '3.3.0',
......@@ -175,6 +182,9 @@ deps = {
'src/dart/third_party/pkg/bazel_worker':
Var('chromium_git') + '/external/github.com/dart-lang/bazel_worker' + '@' + Var('dart_bazel_worker_tag'),
'src/dart/third_party/pkg/boolean_selector':
Var('chromium_git') + '/external/github.com/dart-lang/boolean_selector' + '@' + Var('dart_boolean_selector_tag'),
'src/dart/third_party/pkg/charcode':
Var('chromium_git') + '/external/github.com/dart-lang/charcode' + '@' + Var('dart_charcode_tag'),
......@@ -238,6 +248,9 @@ deps = {
'src/dart/third_party/pkg/markdown':
Var('chromium_git') + '/external/github.com/dart-lang/markdown' + '@' + Var('dart_markdown_tag'),
'src/dart/third_party/pkg/matcher':
Var('chromium_git') + '/external/github.com/dart-lang/matcher' + '@' + Var('dart_matcher_tag'),
'src/dart/third_party/pkg/mime':
Var('chromium_git') + '/external/github.com/dart-lang/mime' + '@' + Var('dart_mime_rev'),
......@@ -277,12 +290,24 @@ deps = {
'src/dart/third_party/pkg/shelf':
Var('chromium_git') + '/external/github.com/dart-lang/shelf' + '@' + Var('dart_shelf_tag'),
'src/dart/third_party/pkg/shelf_packages_handler':
Var('chromium_git') + '/external/github.com/dart-lang/shelf_packages_handler' + '@' + Var('dart_shelf_packages_handler_tag'),
'src/dart/third_party/pkg/shelf_static':
Var('chromium_git') + '/external/github.com/dart-lang/shelf_static' + '@' + Var('dart_shelf_static_tag'),
'src/dart/third_party/pkg/shelf_web_socket':
Var('chromium_git') + '/external/github.com/dart-lang/shelf_web_socket' + '@' + Var('dart_shelf_web_socket_tag'),
'src/dart/third_party/pkg/source_span':
Var('chromium_git') + '/external/github.com/dart-lang/source_span' + '@' + Var('dart_source_span_tag'),
'src/dart/third_party/pkg/source_map_stack_trace':
Var('chromium_git') + '/external/github.com/dart-lang/source_map_stack_trace' + '@' + Var('dart_source_map_stack_trace_tag'),
'src/dart/third_party/pkg/source_maps':
Var('chromium_git') + '/external/github.com/dart-lang/source_maps' + '@' + Var('dart_source_maps_tag'),
'src/dart/third_party/pkg/string_scanner':
Var('chromium_git') + '/external/github.com/dart-lang/string_scanner' + '@' + Var('dart_string_scanner_tag'),
......@@ -298,6 +323,9 @@ deps = {
'src/dart/third_party/pkg/typed_data':
Var('chromium_git') + '/external/github.com/dart-lang/typed_data' + '@' + Var('dart_typed_data_tag'),
'src/dart/third_party/pkg/test':
Var('chromium_git') + '/external/github.com/dart-lang/test' + '@' + Var('dart_test_tag'),
'src/dart/third_party/pkg/tuple':
Var('chromium_git') + '/external/github.com/dart-lang/tuple' + '@' + Var('dart_tuple_tag'),
......@@ -331,6 +359,9 @@ deps = {
# Headers for Vulkan 1.0
'src/third_party/vulkan':
Var('github_git') + '/KhronosGroup/Vulkan-Docs.git' + '@' + 'e29c2489e238509c41aeb8c7bce9d669a496344b',
'src/third_party/pkg/when':
Var('chromium_git') + '/external/github.com/dart-lang/when' + '@' + '0.2.0',
}
recursedeps = [
......
# Specify analysis options.
#
# This file is a copy of analysis_options_repo.yaml from flutter repo:
# https://github.com/flutter/flutter/blob/master/analysis_options_repo.yaml
analyzer:
language:
enableStrictCallChecks: true
enableSuperMixins: true
enableAssertInitializer: true
strong-mode:
implicit-dynamic: false
errors:
# treat missing required parameters as a warning (not a hint)
missing_required_param: warning
# treat missing returns as a warning (not a hint)
missing_return: warning
# allow having TODOs in the code
todo: ignore
linter:
rules:
# these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier
# http://dart-lang.github.io/linter/lints/
# === error rules ===
- avoid_empty_else
- avoid_slow_async_io
- cancel_subscriptions
# - close_sinks # https://github.com/flutter/flutter/issues/5789
# - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
- control_flow_in_finally
- empty_statements
- hash_and_equals
# - invariant_booleans # https://github.com/flutter/flutter/issues/5790
- iterable_contains_unrelated_type
- list_remove_unrelated_type
# - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
- no_adjacent_strings_in_list
- no_duplicate_case_values
- test_types_in_equals
- throw_in_finally
- unrelated_type_equality_checks
- valid_regexps
# === style rules ===
- always_declare_return_types
- always_put_control_body_on_new_line
- always_require_non_null_named_parameters
- always_specify_types
- annotate_overrides
# - avoid_annotating_with_dynamic # not yet tested
- avoid_as
# - avoid_catches_without_on_clauses # not yet tested
# - avoid_catching_errors # not yet tested
# - avoid_classes_with_only_static_members # not yet tested
# - avoid_function_literals_in_foreach_calls # not yet tested
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # not yet tested
- avoid_return_types_on_setters
# - avoid_returning_null # not yet tested
# - avoid_returning_this # not yet tested
# - avoid_setters_without_getters # not yet tested
# - avoid_types_on_closure_parameters # not yet tested
- await_only_futures
- camel_case_types
# - cascade_invocations # not yet tested
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
- directives_ordering
- empty_catches
- empty_constructor_bodies
- implementation_imports
# - join_return_with_assignment # not yet tested
- library_names
- library_prefixes
- non_constant_identifier_names
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
- overridden_fields
- package_api_docs
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
- prefer_adjacent_string_concatenation
- prefer_collection_literals
# - prefer_conditional_assignment # not yet tested
# - prefer_const_constructors # https://github.com/dart-lang/linter/issues/752
# - prefer_constructors_over_static_methods # not yet tested
- prefer_contains
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
# - prefer_final_fields # https://github.com/dart-lang/linter/issues/506
- prefer_final_locals
# - prefer_foreach # not yet tested
# - prefer_function_declarations_over_variables # not yet tested
- prefer_initializing_formals
# - prefer_interpolation_to_compose_strings # not yet tested
- prefer_is_empty
- prefer_is_not_empty
- public_member_api_docs # this is the only difference from analysis_options_repo.yaml
# - recursive_getters # https://github.com/dart-lang/linter/issues/452
- slash_for_doc_comments
- sort_constructors_first
- sort_unnamed_constructors_first
- super_goes_last
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
# - unnecessary_overrides # https://github.com/dart-lang/linter/issues/626 and https://github.com/dart-lang/linter/issues/627
- unnecessary_this
- use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested
# - use_string_buffers # https://github.com/dart-lang/linter/pull/664
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
# === pub rules ===
- package_names
# Generated by pub on 2017-08-18 15:55:43.613975.
analyzer:../../dart/pkg/analyzer/lib/
args:../../dart/third_party/pkg/args/lib/
async:../../dart/third_party/pkg/async/lib/
barback:../../dart/third_party/pkg/barback/lib/
boolean_selector:../../dart/third_party/pkg/boolean_selector/lib/
charcode:../../dart/third_party/pkg/charcode/lib/
cli_util:../../dart/third_party/pkg/cli_util/lib/
collection:../../dart/third_party/pkg/collection/lib/
convert:../../dart/third_party/pkg/convert/lib/
crypto:../../dart/third_party/pkg/crypto/lib/
csslib:../../dart/third_party/pkg/csslib/lib/
front_end:../../dart/pkg/front_end/lib/
glob:../../dart/third_party/pkg/glob/lib/
html:../../dart/third_party/pkg/html/lib/
http:../../dart/third_party/pkg/http/lib/
http_multi_server:../../dart/third_party/pkg/http_multi_server/lib/
http_parser:../../dart/third_party/pkg/http_parser/lib/
isolate:../../dart/third_party/pkg/isolate/lib/
kernel:../../dart/pkg/kernel/lib/
logging:../../dart/third_party/pkg/logging/lib/
matcher:../../dart/third_party/pkg/matcher/lib/
meta:../../dart/pkg/meta/lib/
mime:../../dart/third_party/pkg/mime/lib/
package_config:../../dart/third_party/pkg_tested/package_config/lib/
package_resolver:../../dart/third_party/pkg_tested/package_resolver/lib/
path:../../dart/third_party/pkg/path/lib/
plugin:../../dart/third_party/pkg/plugin/lib/
pool:../../dart/third_party/pkg/pool/lib/
pub_semver:../../dart/third_party/pkg/pub_semver/lib/
quiver:../../dart/third_party/pkg/quiver/lib/
shelf:../../dart/third_party/pkg/shelf/lib/
shelf_packages_handler:../../dart/third_party/pkg/shelf_packages_handler/lib/
shelf_static:../../dart/third_party/pkg/shelf_static/lib/
shelf_web_socket:../../dart/third_party/pkg/shelf_web_socket/lib/
source_map_stack_trace:../../dart/third_party/pkg/source_map_stack_trace/lib/
source_maps:../../dart/third_party/pkg/source_maps/lib/
source_span:../../dart/third_party/pkg/source_span/lib/
stack_trace:../../dart/third_party/pkg/stack_trace/lib/
stream_channel:../../dart/third_party/pkg/stream_channel/lib/
string_scanner:../../dart/third_party/pkg/string_scanner/lib/
test:../../dart/third_party/pkg/test/lib/
typed_data:../../dart/third_party/pkg/typed_data/lib/
usage:../../dart/third_party/pkg/usage/lib/
utf:../../dart/third_party/pkg/utf/lib/
watcher:../../dart/third_party/pkg/watcher/lib/
web_socket_channel:../../dart/third_party/pkg/web_socket_channel/lib/
when:../../third_party/pkg/when/lib/
yaml:../../dart/third_party/pkg/yaml/lib/
frontend_server:lib/
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//dart/utils/application_snapshot.gni")
application_snapshot("frontend_server") {
main_dart = "bin/starter.dart"
dot_packages = rebase_path(".packages")
training_args = [ "--train" ]
frontend_server_files = exec_script("//dart/tools/list_dart_files.py",
[ "absolute", rebase_path("."), ], "list lines")
inputs = frontend_server_files
}
# Frontend Server
Frontend server is simple wrapper around Dart Frontend. It is a Dart application
that compiles Dart source into Dart Kernel binary (.dill-file).
Documentation on Dart Kernel (semantic, binary format, etc) can be found here:
https://github.com/dart-lang/sdk/wiki/Kernel-Documentation.
Frontend server runs in two modes:
- immediate mode, where Dart source file name is provided as command line
argument;
- interactive mode, where communication is happening over stdin/stdout.
## Interactive mode instructions
### Compile/Recompile
```
compile <input.dart>
```
Compiles <input.dart> Dart source file with Dart Frontend. Replies with `result` response.
```
recompile <boundary-key>
<path/to/updated/file1.dart>
<path/to/updated/file2.dart>
...
<boundary-key>
```
Incrementally recompiles Dart program previously compiled in current session, taking into account
changes in the listed files. Replies with `result` response.
Relative paths should be relative to current working directory for the shell that launched
Frontend Server.
### Accept/Reject
```
accept
```
Accepts results of incremental compilation, so that on next recompilation request Dart Frontend
will not include these recompiled files.
```
reject
```
Rejects results of incremental compilation, so that on next recompilation request Dart Frontend
will include compilation results from previously rejected recompilation in addition to what it
will recompile based on newly changed files.
Small technical detail is that Dart Frontend will not recompile files from previously rejected
recompilation attempts (unless they were changed since then), it will just include appropriate
kernel binaries it kept around from those previously rejected compilation requests.
One use of `accept` and `reject` instructions is in the context of Dart VM hot-reload. Dart VM can
reject user-provided incremental change to what is currently running. It could happen for variety
of Dart VM internal reasons. For example, if incremental update changes some `class` to `enum`,
such update can not be hot-reloaded by VM at this point, will be rejected.
### Quit
```
quit
```
Stops the server.
## Response from the server
```
result <boundary-key>
<compiler output>
<boundary-key> [<output.dill>]
```
Response from the Dart Frontend compiler is bracketed by `<boundary-key>` tags. If the compiler
was able to produce a Dart Kernel file, the name of this file `<output.dill>` is provided too.
If the compiler encountered unrecoverable errors, there will be no output file name provided.
library frontend_server;
import 'package:frontend_server/server.dart';
void main(List<String> args) {
starter(args);
}
library frontend_server;
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:args/args.dart';
import 'package:front_end/compilation_message.dart';
import 'package:front_end/incremental_kernel_generator.dart';
import 'package:front_end/compiler_options.dart';
import 'package:front_end/kernel_generator.dart';
import 'package:kernel/ast.dart';
import 'package:kernel/kernel.dart';
import 'package:kernel/target/flutter.dart';
import 'package:kernel/target/targets.dart';
import 'package:usage/uuid/uuid.dart';
ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
..addFlag('train',
help: 'Run through sample command line to produce snapshot',
negatable: false)
..addFlag('incremental',
help: 'Run compiler in incremental mode', defaultsTo: false)
..addOption('sdk-root',
help: 'Path to sdk root',
defaultsTo: '../../out/android_debug/flutter_patched_sdk');
String _usage = '''
Usage: server [options] [input.dart]
If input dart source code is provided on the command line, then the server
compiles it, generates dill file and exits.
If no input dart source is provided on the command line, server waits for
instructions from stdin.
Instructions:
- compile <input.dart>
- recompile <boundary-key>
<path/to/updated/file1.dart>
<path/to/updated/file2.dart>
...
<boundary-key>
- accept
- reject
- quit
Output:
- result <boundary-key>
<compiler output>
<boundary-key> [<output.dill>]
Options:
${_argParser.usage}
''';
enum _State { READY_FOR_INSTRUCTION, RECOMPILE_LIST }
/// Actions that every compiler should implement.
abstract class CompilerInterface {
/// Compile given Dart program identified by `filename` with given list of
/// `options`.
Future<Null> compile(String filename, ArgResults options);
/// Assuming some Dart program was previously compiled, recompile it again
/// taking into account some changed(invalidated) sources.
Future<Null> recompileDelta();
/// Accept results of previous compilation so that next recompilation cycle
/// won't recompile sources that were previously reported as changed.
void acceptLastDelta();
/// Reject results of previous compilation. Next recompilation cycle will
/// recompile sources indicated as changed.
void rejectLastDelta();
/// This let's compiler know that source file identifed by `uri` was changed.
void invalidate(Uri uri);
}
class _FrontendCompiler implements CompilerInterface {
_FrontendCompiler(this._outputStream) {
_outputStream ??= stdout;
}
IncrementalKernelGenerator _generator;
String _filename;
StringSink _outputStream;
@override
Future<Null> compile(String filename, ArgResults options) async {
final String boundaryKey = new Uuid().generateV4();
_outputStream.writeln("result $boundaryKey");
final Uri sdkRoot = _ensureFolderPath(options['sdk-root']);
final CompilerOptions compilerOptions = new CompilerOptions()
..sdkRoot = sdkRoot
..strongMode = false
..target = new FlutterTarget(new TargetFlags())
..onError = (CompilationMessage message) {
_outputStream.writeln("$message");
};
Program program;
if (options['incremental']) {
_generator = await IncrementalKernelGenerator.newInstance(
compilerOptions, Uri.base.resolve(filename)
);
final DeltaProgram deltaProgram = await _generator.computeDelta();
program = deltaProgram.newProgram;
} else {
// TODO(aam): Remove linkedDependencies once platform is directly embedded
// into VM snapshot and http://dartbug.com/30111 is fixed.
compilerOptions.linkedDependencies = <Uri>[
sdkRoot.resolve('platform.dill')
];
program = await kernelForProgram(Uri.base.resolve(filename), compilerOptions);
}
if (program != null) {
final String kernelBinaryFilename = filename + ".dill";
await writeProgramToBinary(program, kernelBinaryFilename);
_outputStream.writeln("$boundaryKey $kernelBinaryFilename");
} else
_outputStream.writeln(boundaryKey);
return null;
}
@override
Future<Null> recompileDelta() async {
_generator.computeDelta();
final String boundaryKey = new Uuid().generateV4();
_outputStream.writeln("result $boundaryKey");
final DeltaProgram deltaProgram = await _generator.computeDelta();
final Program program = deltaProgram.newProgram;
final String kernelBinaryFilename = _filename + ".dill";
await writeProgramToBinary(program, kernelBinaryFilename);
_outputStream.writeln("$boundaryKey");
return null;
}
@override
void acceptLastDelta() {
_generator.acceptLastDelta();
}
@override
void rejectLastDelta() {
_generator.rejectLastDelta();
}
@override
void invalidate(Uri uri) {
_generator.invalidate(uri);
}
Uri _ensureFolderPath(String path) {
if (!path.endsWith('/'))
path = '$path/';
return Uri.base.resolve(path);
}
}
/// 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, {CompilerInterface compiler,
Stream<List<int>> input, StringSink output}) async {
final ArgResults options = _argParser.parse(args);
if (options['train'])
return 0;
compiler ??= new _FrontendCompiler(output);
input ??= stdin;
if (options.rest.isNotEmpty) {
await compiler.compile(options.rest[0], options);
return 0;
}
_State state = _State.READY_FOR_INSTRUCTION;
String boundaryKey;
input
.transform(UTF8.decoder)
.transform(new LineSplitter())
.listen((String string) async {
switch (state) {
case _State.READY_FOR_INSTRUCTION:
const String COMPILE_INSTRUCTION_SPACE = 'compile ';
const String RECOMPILE_INSTRUCTION_SPACE = 'recompile ';
if (string.startsWith(COMPILE_INSTRUCTION_SPACE)) {
final String filename =
string.substring(COMPILE_INSTRUCTION_SPACE.length);
await compiler.compile(filename, options);
} else if (string.startsWith(RECOMPILE_INSTRUCTION_SPACE)) {
boundaryKey = string.substring(RECOMPILE_INSTRUCTION_SPACE.length);
state = _State.RECOMPILE_LIST;
} else if (string == 'accept')
compiler.acceptLastDelta();
else if (string == 'reject')
compiler.rejectLastDelta();
else if (string == 'quit')
exit(0);
break;
case _State.RECOMPILE_LIST:
if (string == boundaryKey) {
compiler.recompileDelta();
state = _State.READY_FOR_INSTRUCTION;
} else
compiler.invalidate(Uri.base.resolve(string));
break;
}
});
return 0;
}
name: frontend_server
version: 0.1.1-dev
description: Communication pipe to Dart Frontend
homepage: http://flutter.io
author: Flutter Authors <flutter-dev@googlegroups.com>
dependencies:
args: any
async: any
charcode: any
collection: any
convert: any
crypto: any
front_end: any
kernel: any
logging: any
meta: any
quiver: any
package_config: any
path: any
source_span: any
typed_data: any
usage: any
dev_dependencies:
analyzer: any
barback: any
boolean_selector: any
cli_util: any
csslib: any
glob: any
html: any
http: any
http_multi_server: any
http_parser: any
isolate: any
matcher: any
mime: any
package_resolver: any
plugin: any
pool: any
pub_semver: any
shelf: any
shelf_packages_handler: any
shelf_static: any
shelf_web_socket: any
source_map_stack_trace: any
source_maps: any
stack_trace: any
stream_channel: any
string_scanner: any
test: any
utf: any
watcher: any
web_socket_channel: any
when: any
yaml: any
dependency_overrides:
args:
path: ../../dart/third_party/pkg/args
async:
path: ../../dart/third_party/pkg/async
charcode:
path: ../../dart/third_party/pkg/charcode
collection:
path: ../../dart/third_party/pkg/collection
convert:
path: ../../dart/third_party/pkg/convert
crypto:
path: ../../dart/third_party/pkg/crypto
front_end:
path: ../../dart/pkg/front_end/
kernel:
path: ../../dart/pkg/kernel/
logging:
path: ../../dart/third_party/pkg/logging
meta:
path: ../../dart/pkg/meta
quiver:
path: ../../dart/third_party/pkg/quiver
package_config:
path: ../../dart/third_party/pkg_tested/package_config
path:
path: ../../dart/third_party/pkg/path
source_span:
path: ../../dart/third_party/pkg/source_span
typed_data:
path: ../../dart/third_party/pkg/typed_data
usage:
path: ../../dart/third_party/pkg/usage
analyzer:
path: ../../dart/pkg/analyzer
barback:
path: ../../dart/third_party/pkg/barback
boolean_selector:
path: ../../dart/third_party/pkg/boolean_selector
cli_util:
path: ../../dart/third_party/pkg/cli_util
csslib:
path: ../../dart/third_party/pkg/csslib
glob:
path: ../../dart/third_party/pkg/glob
html:
path: ../../dart/third_party/pkg/html
http:
path: ../../dart/third_party/pkg/http
http_multi_server:
path: ../../dart/third_party/pkg/http_multi_server
http_parser:
path: ../../dart/third_party/pkg/http_parser
isolate:
path: ../../dart/third_party/pkg/isolate
matcher:
path: ../../dart/third_party/pkg/matcher
mime:
path: ../../dart/third_party/pkg/mime
package_resolver:
path: ../../dart/third_party/pkg_tested/package_resolver
plugin:
path: ../../dart/third_party/pkg/plugin
pool:
path: ../../dart/third_party/pkg/pool
pub_semver:
path: ../../dart/third_party/pkg/pub_semver
shelf:
path: ../../dart/third_party/pkg/shelf
shelf_packages_handler:
path: ../../dart/third_party/pkg/shelf_packages_handler
shelf_static:
path: ../../dart/third_party/pkg/shelf_static
shelf_web_socket:
path: ../../dart/third_party/pkg/shelf_web_socket
source_map_stack_trace:
path: ../../dart/third_party/pkg/source_map_stack_trace
source_maps:
path: ../../dart/third_party/pkg/source_maps
stack_trace:
path: ../../dart/third_party/pkg/stack_trace
stream_channel:
path: ../../dart/third_party/pkg/stream_channel
string_scanner:
path: ../../dart/third_party/pkg/string_scanner
test:
path: ../../dart/third_party/pkg/test
utf:
path: ../../dart/third_party/pkg/utf
watcher:
path: ../../dart/third_party/pkg/watcher
web_socket_channel:
path: ../../dart/third_party/pkg/web_socket_channel
when:
path: ../../third_party/pkg/when
yaml:
path: ../../dart/third_party/pkg/yaml
\ No newline at end of file
import 'dart:async';
import 'dart:isolate';
import 'package:args/src/arg_results.dart';
import 'package:frontend_server/server.dart';
import 'package:test/test.dart';
class _MockedCompiler implements CompilerInterface {
_MockedCompiler({
this.compileCallback,
this.recompileDeltaCallback,
this.acceptLastDeltaCallback,
this.rejectLastDeltaCallback,
this.invalidateCallback
});
Future<Null> Function(String, ArgResults) compileCallback;
Future<Null> Function() recompileDeltaCallback;
void Function() acceptLastDeltaCallback;
void Function() rejectLastDeltaCallback;
void Function(Uri) invalidateCallback;
@override
Future<Null> compile(String filename, ArgResults options) {
return compileCallback != null
? compileCallback(filename, options)
: new Future<Null>.value(null);
}
@override
void invalidate(Uri uri) {
if (invalidateCallback != null)
invalidateCallback(uri);
}
@override
Future<Null> recompileDelta() {
return recompileDeltaCallback != null
? recompileDeltaCallback()
: new Future<Null>.value(null);
}
@override
void acceptLastDelta() {
if (acceptLastDeltaCallback != null)
acceptLastDeltaCallback();
}
@override
void rejectLastDelta() {
if (rejectLastDeltaCallback != null)
rejectLastDeltaCallback();
}
}
Future<int> main() async {
group('basic', () {
test('train completes', () async {
expect(await starter(<String>['--train']), equals(0));
});
});
group('batch compile', () {
test('compile from command line', () async {
final List<String> args = <String>[
'server.dart',
'--sdk-root',
'sdkroot'
];
final int exitcode = await starter(args, compiler: new _MockedCompiler(
compileCallback: (String filename, ArgResults options) {
expect(filename, equals('server.dart'));
expect(options['sdk-root'], equals('sdkroot'));
}
));
expect(exitcode, equals(0));
});
});
group('interactive compile', () {
final List<String> args = <String>[
'--sdk-root',
'sdkroot'
];
test('compile one file', () async {
final StreamController<List<int>> inputStreamController =
new StreamController<List<int>>();
final ReceivePort compileCalled = new ReceivePort();
final int exitcode = await starter(args, compiler: new _MockedCompiler(
compileCallback: (String filename, ArgResults options) {
expect(filename, equals('server.dart'));
expect(options['sdk-root'], equals('sdkroot'));
compileCalled.sendPort.send(true);
}),
input: inputStreamController.stream,
);
expect(exitcode, equals(0));
inputStreamController.add('compile server.dart\n'.codeUnits);
await compileCalled.first;
inputStreamController.close();
});
test('compile few files', () async {
final StreamController<List<int>> streamController =
new StreamController<List<int>>();
final ReceivePort compileCalled = new ReceivePort();
int counter = 1;
final int exitcode = await starter(args, compiler: new _MockedCompiler(
compileCallback: (String filename, ArgResults options) {
expect(filename, equals('server${counter++}.dart'));
expect(options['sdk-root'], equals('sdkroot'));
compileCalled.sendPort.send(true);
}),
input: streamController.stream,
);
expect(exitcode, equals(0));
streamController.add('compile server1.dart\n'.codeUnits);
streamController.add('compile server2.dart\n'.codeUnits);
await compileCalled.first;
streamController.close();
});
test('recompile few files', () async {
final StreamController<List<int>> streamController =
new StreamController<List<int>>();
final ReceivePort recompileCalled = new ReceivePort();
int counter = 0;
final List<Uri> expectedInvalidatedFiles = <Uri>[
Uri.base.resolve('file1.dart'),
Uri.base.resolve('file2.dart'),
];
final int exitcode = await starter(args, compiler: new _MockedCompiler(
invalidateCallback: (Uri uri) {
expect(uri, equals(expectedInvalidatedFiles[counter++]));
},
recompileDeltaCallback: () {
expect(counter, equals(2));
recompileCalled.sendPort.send(true);
}),
input: streamController.stream,
);
expect(exitcode, equals(0));
streamController.add('recompile abc\nfile1.dart\nfile2.dart\nabc\n'.codeUnits);
await recompileCalled.first;
streamController.close();
});
test('accept', () async {
final StreamController<List<int>> inputStreamController =
new StreamController<List<int>>();
final ReceivePort acceptCalled = new ReceivePort();
final int exitcode = await starter(args, compiler: new _MockedCompiler(
acceptLastDeltaCallback: () {
acceptCalled.sendPort.send(true);
}),
input: inputStreamController.stream,
);
expect(exitcode, equals(0));
inputStreamController.add('accept\n'.codeUnits);
await acceptCalled.first;
inputStreamController.close();
});
test('reject', () async {
final StreamController<List<int>> inputStreamController =
new StreamController<List<int>>();
final ReceivePort rejectCalled = new ReceivePort();
final int exitcode = await starter(args, compiler: new _MockedCompiler(
rejectLastDeltaCallback: () {
rejectCalled.sendPort.send(true);
}),
input: inputStreamController.stream,
);
expect(exitcode, equals(0));
inputStreamController.add('reject\n'.codeUnits);
await rejectCalled.first;
inputStreamController.close();
});
test('recompile few files', () async {
final StreamController<List<int>> streamController =
new StreamController<List<int>>();
final ReceivePort recompileCalled = new ReceivePort();
int counter = 0;
final List<Uri> expectedInvalidatedFiles = <Uri>[
Uri.base.resolve('file1.dart'),
Uri.base.resolve('file2.dart'),
Uri.base.resolve('file2.dart'),
Uri.base.resolve('file3.dart'),
];
bool acceptCalled = false;
final int exitcode = await starter(args, compiler: new _MockedCompiler(
invalidateCallback: (Uri uri) {
expect(uri, equals(expectedInvalidatedFiles[counter++]));
},
recompileDeltaCallback: () {
if (counter == 2) {
expect(acceptCalled, equals(false));
} else {
expect(counter, equals(4));
expect(acceptCalled, equals(true));
}
recompileCalled.sendPort.send(true);
},
acceptLastDeltaCallback: () {
expect(acceptCalled, equals(false));
acceptCalled = true;
}),
input: streamController.stream,
);
expect(exitcode, equals(0));
streamController.add('recompile abc\nfile1.dart\nfile2.dart\nabc\n'.codeUnits);
streamController.add('accept\n'.codeUnits);
streamController.add('recompile def\nfile2.dart\nfile3.dart\ndef\n'.codeUnits);
await recompileCalled.first;
streamController.close();
});
});
return 0;
}
......@@ -2414,8 +2414,7 @@ and disclaimer.
dart
Copyright (c) 2011, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -2444,8 +2443,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dart
Copyright (c) 2012, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -2474,8 +2472,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -2504,8 +2501,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dart
Copyright (c) 2017, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -2590,8 +2586,7 @@ dart
observatory_pub_packages
Copyright (c) 2013, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -2621,8 +2616,7 @@ dart
observatory_pub_packages
Copyright (c) 2014, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -2652,8 +2646,7 @@ dart
observatory_pub_packages
Copyright (c) 2015, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -13657,8 +13650,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
observatory_pub_packages
Copyright (c) 2011, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -13719,40 +13711,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
observatory_pub_packages
Copyright (c) 2012, 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
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved. Use of this sourcecode is governed by a
BSD-style license that can be found in the LICENSE file
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -13798,8 +13757,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
observatory_pub_packages
Copyright (c) 2013, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -13921,43 +13879,7 @@ observatory_pub_packages
Copyright (c) 2014, 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
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright (c) 2014, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -13988,8 +13910,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
observatory_pub_packages
Copyright (c) 2014, 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
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -14019,9 +13940,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved. Use of this source is governed by a
BSD-style license that can be found in the LICENSE file
Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -14051,9 +13971,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright (c) 2015, 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
Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
......@@ -14083,10 +14002,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
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
Copyright 2013, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
......@@ -14115,14 +14031,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright (c) 2017, 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
Copyright 2014 The Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
......@@ -14132,7 +14045,6 @@ met:
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
......@@ -14147,7 +14059,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright 2013, the Dart project authors. All rights reserved.
Copyright 2014, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
......@@ -14176,35 +14088,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright 2014 The Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright 2014, the Dart project authors. All rights reserved.
Copyright 2015, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
......@@ -14233,7 +14117,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
Copyright 2015, the Dart project authors. All rights reserved.
Copyright 2016, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
......@@ -14261,8 +14145,11 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
observatory_pub_packages
pkg
Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved.
Copyright 2016, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
......
......@@ -54,7 +54,7 @@ abstract class RepositoryLicensedFile extends RepositoryFile {
static final RegExp _readmeNamePattern = new RegExp(r'\b_*(?:readme|contributing|patents)_*\b', caseSensitive: false);
static final RegExp _buildTimePattern = new RegExp(r'^(?!.*gen$)(?:CMakeLists\.txt|(?:pkgdata)?Makefile(?:\.inc)?(?:\.am|\.in|)|configure(?:\.ac|\.in)?|config\.(?:sub|guess)|.+\.m4|install-sh|.+\.sh|.+\.bat|.+\.pyc?|.+\.pl|icu-configure|.+\.gypi?|.*\.gni?|.+\.mk|.+\.cmake|.+\.gradle|.+\.yaml|vms_make\.com|pom\.xml|\.project|source\.properties)$', caseSensitive: false);
static final RegExp _docsPattern = new RegExp(r'^(?:INSTALL|NEWS|OWNERS|AUTHORS|ChangeLog(?:\.rst|\.[0-9]+)?|.+\.txt|.+\.md|.+\.log|.+\.css|.+\.1|doxygen\.config|.+\.spec(?:\.in)?)$', caseSensitive: false);
static final RegExp _devPattern = new RegExp(r'^(?:codereview\.settings|.+\.~|.+\.~[0-9]+~|\.clang-format|\.gitattributes|\.landmines|\.DS_Store)$', caseSensitive: false);
static final RegExp _devPattern = new RegExp(r'^(?:codereview\.settings|.+\.~|.+\.~[0-9]+~|\.clang-format|\.gitattributes|\.landmines|\.DS_Store|\.travis\.yml)$', caseSensitive: false);
static final RegExp _testsPattern = new RegExp(r'^(?:tj(?:bench|example)test\.(?:java\.)?in|example\.c)$', caseSensitive: false);
bool get isIncludedInBuildProducts {
......@@ -1746,6 +1746,27 @@ class RepositoryLibPngDirectory extends RepositoryDirectory {
}
}
class RepositoryPkgDirectory extends RepositoryDirectory {
RepositoryPkgDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io);
@override
RepositoryDirectory createSubdirectory(fs.Directory entry) {
if (entry.name == 'when')
return new RepositoryPkgWhenDirectory(this, entry);
return super.createSubdirectory(entry);
}
}
class RepositoryPkgWhenDirectory extends RepositoryDirectory {
RepositoryPkgWhenDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io);
@override
bool shouldRecurse(fs.IoNode entry) {
return entry.name != 'example' // contains nothing that ends up in the binary executable
&& super.shouldRecurse(entry);
}
}
class RepositoryOkHttpDirectory extends RepositoryDirectory {
RepositoryOkHttpDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io);
......@@ -1889,6 +1910,8 @@ class RepositoryRootThirdPartyDirectory extends RepositoryGenericThirdPartyDirec
return new RepositoryLibPngDirectory(this, entry);
if (entry.name == 'okhttp')
return new RepositoryOkHttpDirectory(this, entry);
if (entry.name == 'pkg')
return new RepositoryPkgDirectory(this, entry);
if (entry.name == 'skia')
return new RepositorySkiaDirectory(this, entry);
if (entry.name == 'vulkan')
......
......@@ -330,10 +330,10 @@ final List<LicenseFileReferencePattern> csReferencesByFilename = <LicenseFileRef
pattern: new RegExp(
r'(' + kIndent +
r'Copyright .+(the .+ authors)\[?\. '
r'Please see the AUTHORS file for details. All rights (?:re|solve)served\. '
r'Please see the AUTHORS file for details. All rights (?:re|solve)served\.) '
r'Use of this source(?: code)? is governed by a BS?D-style license '
r'that can be found in the '.replaceAll(' ', _linebreakLoose) +
r'([^ ]+) file\b)(?! or at)',
r'([^ ]+) file\b(?! or at)',
multiLine: true,
caseSensitive: false,
)
......
echo "Analyzing frontend_server..."
RESULTS=`dartanalyzer \
--packages=flutter/frontend_server/.packages \
--options flutter/analysis_options.yaml \
flutter/frontend_server \
2>&1 \
| grep -Ev "No issues found!" \
| grep -Ev "Analyzing.+frontend_server"`
echo "$RESULTS"
if [ -n "$RESULTS" ]; then
echo "Failed."
exit 1;
fi
echo "Analyzing dart:ui library..."
RESULTS=`dartanalyzer \
--ignore-unrecognized-flags \
......
......@@ -1060,8 +1060,10 @@ USED LICENSES:
LIBRARY: engine
ORIGIN: ../../../LICENSE
TYPE: LicenseType.bsd
FILE: ../../../flutter/.travis.yml
FILE: ../../../flutter/DEPS
FILE: ../../../flutter/frontend_server/.packages
FILE: ../../../flutter/frontend_server/bin/starter.dart
FILE: ../../../flutter/frontend_server/lib/server.dart
FILE: ../../../flutter/lib/io/dart_io.cc
FILE: ../../../flutter/lib/io/dart_io.h
FILE: ../../../flutter/lib/ui/dart_runtime_hooks.cc
......
Signature: 8c01d2ff89ff55710e2b9f43e4c40981
Signature: d4bdc7ffb0097caf9a722e8697a21850
UNUSED LICENSES:
====================================================================================================
ORIGIN: ../../../dart/third_party/observatory_pub_packages/packages/async/LICENSE
TYPE: LicenseType.bsd
----------------------------------------------------------------------------------------------------
Copyright 2015, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================
====================================================================================================
ORIGIN: ../../../third_party/rapidjson/LICENSE
TYPE: LicenseType.bsd
......@@ -23888,6 +23920,42 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================
====================================================================================================
LIBRARY: pkg
ORIGIN: ../../../third_party/pkg/when/lib/when.dart + ../../../dart/third_party/observatory_pub_packages/packages/async/LICENSE
TYPE: LicenseType.bsd
FILE: ../../../third_party/pkg/when/lib/when.dart
----------------------------------------------------------------------------------------------------
Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
for details. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================
====================================================================================================
LIBRARY: rapidjson
ORIGIN: ../../../third_party/rapidjson/rapidjson/error/en.h
......@@ -29004,4 +29072,4 @@ freely, subject to the following restrictions:
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
====================================================================================================
Total license count: 276
Total license count: 278
#!/bin/bash
cd frontend_server
pub get
pub run test/server_test.dart
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册