Eliminate dependencies on pkg/front_end.

The API for pkg/front_end is still in flux so we want to avoid having
any packages depend directly on it (other than analyzer and
back-ends).

This CL re-exports some of the critical pieces of front_end needed by
analyzer clients so that those clients can access them via analyzer,
without having to directly depend on front_end.  It also updates
pkg/analyzer_plugin to make use of those re-exports.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2993123002 .
This commit is contained in:
Paul Berry 2017-08-07 09:46:28 -07:00
parent b48584d3d0
commit e2f77056a5
21 changed files with 63 additions and 19 deletions

View file

@ -10,6 +10,7 @@ library analyzer.src.codegen.tools;
import 'package:analyzer/src/codegen/html.dart'; import 'package:analyzer/src/codegen/html.dart';
import 'package:analyzer/src/codegen/text_formatter.dart'; import 'package:analyzer/src/codegen/text_formatter.dart';
import 'package:html/dom.dart' as dom; import 'package:html/dom.dart' as dom;
export 'package:front_end/src/codegen/tools.dart';
final RegExp trailingSpacesInLineRegExp = new RegExp(r' +$', multiLine: true); final RegExp trailingSpacesInLineRegExp = new RegExp(r' +$', multiLine: true);
final RegExp trailingWhitespaceRegExp = new RegExp(r'[\n ]+$'); final RegExp trailingWhitespaceRegExp = new RegExp(r'[\n ]+$');

View file

@ -0,0 +1,9 @@
// 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.
// This library re-exports the parts of front_end's byte_store.dart whose API is
// stable enough to be relied upon by clients.
export 'package:front_end/src/incremental/byte_store.dart'
show ByteStore, MemoryByteStore, MemoryCachingByteStore;

View file

@ -0,0 +1,9 @@
// 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.
// This library re-exports the parts of front_end's file_byte_store.dart whose
// API is stable enough to be relied upon by clients.
export 'package:front_end/src/incremental/file_byte_store.dart'
show FileByteStore;

View file

@ -0,0 +1,8 @@
// 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.
// This library re-exports the parts of front_end's performance_logger.dart
// whose API is stable enough to be relied upon by clients.
export 'package:front_end/src/base/performace_logger.dart' show PerformanceLog;

View file

@ -0,0 +1,8 @@
// 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.
// This library re-exports front_end's timestamped_data.dart, since its API is
// stable enough to be relied upon by clients.
export 'package:front_end/src/base/timestamped_data.dart' show TimestampedData;

View file

@ -0,0 +1,8 @@
// 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.
// This library re-exports front_end's api_signature.dart, since its API is
// stable enough to be relied upon by clients.
export 'package:front_end/src/base/api_signature.dart' show ApiSignature;

View file

@ -0,0 +1,8 @@
// 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.
// This library re-exports front_end's flat_buffers.dart, since its API is
// stable enough to be relied upon by clients.
export 'package:front_end/src/base/flat_buffers.dart';

View file

@ -435,8 +435,8 @@ class _CodeGenerator {
out(); out();
out("import 'dart:convert' as convert;"); out("import 'dart:convert' as convert;");
out(); out();
out("import 'package:front_end/src/base/api_signature.dart' as api_sig;"); out("import 'package:analyzer/src/summary/api_signature.dart' as api_sig;");
out("import 'package:front_end/src/base/flat_buffers.dart' as fb;"); out("import 'package:analyzer/src/summary/flat_buffers.dart' as fb;");
out(); out();
out("import 'idl.dart' as idl;"); out("import 'idl.dart' as idl;");
out(); out();

View file

@ -18,9 +18,9 @@ import 'package:analyzer_plugin/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
import 'package:analyzer_plugin/src/utilities/null_string_sink.dart'; import 'package:analyzer_plugin/src/utilities/null_string_sink.dart';
import 'package:analyzer_plugin/utilities/subscriptions/subscription_manager.dart'; import 'package:analyzer_plugin/utilities/subscriptions/subscription_manager.dart';
import 'package:front_end/src/base/performace_logger.dart'; import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:front_end/src/incremental/byte_store.dart'; import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:front_end/src/incremental/file_byte_store.dart'; import 'package:analyzer/src/dart/analysis/file_byte_store.dart';
import 'package:path/src/context.dart'; import 'package:path/src/context.dart';
import 'package:pub_semver/pub_semver.dart'; import 'package:pub_semver/pub_semver.dart';

View file

@ -12,8 +12,7 @@ import 'package:analyzer_plugin/src/utilities/documentation.dart';
import 'package:analyzer_plugin/utilities/analyzer_converter.dart'; import 'package:analyzer_plugin/utilities/analyzer_converter.dart';
import 'package:analyzer_plugin/utilities/completion/relevance.dart'; import 'package:analyzer_plugin/utilities/completion/relevance.dart';
import 'package:analyzer_plugin/utilities/completion/suggestion_builder.dart'; import 'package:analyzer_plugin/utilities/completion/suggestion_builder.dart';
import 'package:front_end/src/base/source.dart' show Source; import 'package:analyzer/src/generated/source.dart' show Source, UriKind;
import 'package:front_end/src/base/uri_kind.dart';
/** /**
* An object used to build code completion suggestions for Dart code. * An object used to build code completion suggestions for Dart code.

View file

@ -5,7 +5,7 @@
import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element; import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
import 'package:analyzer_plugin/utilities/completion/relevance.dart'; import 'package:analyzer_plugin/utilities/completion/relevance.dart';
import 'package:front_end/src/base/source.dart' show Source; import 'package:analyzer/src/generated/source.dart' show Source;
/** /**
* An object used to build code completion suggestions for Dart code. * An object used to build code completion suggestions for Dart code.

View file

@ -14,7 +14,7 @@ import 'package:analyzer_plugin/plugin/plugin.dart';
import 'package:analyzer_plugin/protocol/protocol.dart'; import 'package:analyzer_plugin/protocol/protocol.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart'; import 'package:analyzer_plugin/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
import 'package:front_end/src/base/timestamped_data.dart'; import 'package:analyzer/src/generated/timestamped_data.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
class MockAnalysisDriver extends AnalysisDriver { class MockAnalysisDriver extends AnalysisDriver {

View file

@ -19,8 +19,8 @@ import 'package:analyzer/src/generated/engine.dart' as engine;
import 'package:analyzer/src/generated/sdk.dart'; import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source_io.dart'; import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/generated/testing/element_search.dart'; import 'package:analyzer/src/generated/testing/element_search.dart';
import 'package:front_end/src/base/performace_logger.dart'; import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:front_end/src/incremental/byte_store.dart'; import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'mock_sdk.dart'; import 'mock_sdk.dart';

View file

@ -4,7 +4,7 @@
import 'dart:io'; import 'dart:io';
import 'package:front_end/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:path/path.dart'; import 'package:path/path.dart';
import 'generate_all.dart'; import 'generate_all.dart';

View file

@ -5,7 +5,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:analyzer/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
import 'package:html/dom.dart' as dom; import 'package:html/dom.dart' as dom;
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;

View file

@ -8,7 +8,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:analyzer/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'api.dart'; import 'api.dart';

View file

@ -8,7 +8,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:analyzer/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
import 'api.dart'; import 'api.dart';
import 'from_html.dart'; import 'from_html.dart';

View file

@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'api.dart'; import 'api.dart';

View file

@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
import 'api.dart'; import 'api.dart';
import 'codegen_dart.dart'; import 'codegen_dart.dart';

View file

@ -4,7 +4,7 @@
import 'dart:io'; import 'dart:io';
import 'package:front_end/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:path/path.dart'; import 'package:path/path.dart';
import 'codegen_dart_protocol.dart' as codegen_dart_protocol; import 'codegen_dart_protocol.dart' as codegen_dart_protocol;

View file

@ -11,7 +11,6 @@ import 'dart:convert';
import 'package:analyzer/src/codegen/html.dart'; import 'package:analyzer/src/codegen/html.dart';
import 'package:analyzer/src/codegen/tools.dart'; import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
import 'package:html/dom.dart' as dom; import 'package:html/dom.dart' as dom;
import 'api.dart'; import 'api.dart';