mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:59:47 +00:00
Remove some classes from the analyzer public API
Change-Id: Ic53a8426818b06f44c2876abd16c789589bf78b5 Reviewed-on: https://dart-review.googlesource.com/52421 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
9c2fcedaf4
commit
7054d92a02
|
@ -49,7 +49,6 @@ import 'package:analyzer/exception/exception.dart';
|
|||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/context/context_root.dart';
|
||||
import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart';
|
||||
|
@ -63,6 +62,7 @@ import 'package:analyzer/src/generated/sdk.dart';
|
|||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/generated/utilities_general.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/source/pub_package_map_provider.dart';
|
||||
import 'package:analyzer/src/util/glob.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
|
||||
|
|
|
@ -11,22 +11,23 @@ import 'package:analysis_server/src/plugin/notification_manager.dart';
|
|||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/context/context_root.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/java_engine.dart';
|
||||
import 'package:analyzer/src/generated/java_io.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
|
||||
import 'package:analyzer/src/source/package_map_provider.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/source/path_filter.dart';
|
||||
import 'package:analyzer/src/source/pub_package_map_provider.dart';
|
||||
import 'package:analyzer/src/source/sdk_ext.dart';
|
||||
|
|
|
@ -17,11 +17,11 @@ import 'package:analysis_server/starter.dart';
|
|||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/instrumentation/file_instrumentation.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:args/args.dart';
|
||||
import 'package:linter/src/rules.dart' as linter;
|
||||
import 'package:plugin/manager.dart';
|
||||
|
|
|
@ -9,8 +9,8 @@ import 'package:analysis_server/src/channel/channel.dart';
|
|||
import 'package:analysis_server/src/server/diagnostic_server.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/source/pub_package_map_provider.dart';
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,6 @@ import 'package:analysis_server/src/status/pages.dart';
|
|||
import 'package:analysis_server/src/utilities/profiling.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/context_root.dart';
|
||||
import 'package:analyzer/src/context/source.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
|
@ -35,6 +34,7 @@ import 'package:analyzer/src/generated/utilities_general.dart';
|
|||
import 'package:analyzer/src/lint/linter.dart';
|
||||
import 'package:analyzer/src/lint/registry.dart';
|
||||
import 'package:analyzer/src/services/lint.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/source/sdk_ext.dart';
|
||||
import 'package:path/path.dart' as pathPackage;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/server/driver.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
|
||||
/**
|
||||
* An object that can be used to start an analysis server. This class exists so
|
||||
|
|
|
@ -9,14 +9,15 @@ import 'package:analyzer/dart/element/element.dart';
|
|||
import 'package:analyzer/dart/element/visitor.dart';
|
||||
import 'package:analyzer/exception/exception.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/context_root.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' as engine;
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
|
|
|
@ -12,13 +12,13 @@ import 'package:analyzer/dart/ast/ast.dart';
|
|||
import 'package:analyzer/dart/ast/standard_resolution_map.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/element/ast_provider.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart'
|
||||
hide AnalysisError;
|
||||
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
|
||||
|
|
|
@ -7,13 +7,13 @@ import 'dart:async';
|
|||
import 'package:analysis_server/src/services/search/search_engine.dart';
|
||||
import 'package:analysis_server/src/services/search/search_engine_internal.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
|
|
|
@ -10,13 +10,13 @@ import 'package:analysis_server/src/plugin/plugin_manager.dart';
|
|||
import 'package:analysis_server/src/plugin/plugin_watcher.dart';
|
||||
import 'package:analyzer/dart/analysis/session.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/context_root.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/analysis/session.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
|
|
|
@ -11,14 +11,14 @@ import 'dart:io';
|
|||
|
||||
import 'package:analyzer/dart/ast/standard_resolution_map.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/source/source_resource.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
|
|
|
@ -8,15 +8,15 @@ import 'dart:io';
|
|||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart' hide File;
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/source/source_resource.dart';
|
||||
|
||||
void main(List<String> args) {
|
||||
|
|
|
@ -2,18 +2,16 @@
|
|||
// 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.
|
||||
|
||||
library analyzer;
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/error/listener.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart' hide File;
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/src/dart/scanner/reader.dart';
|
||||
import 'package:analyzer/src/dart/scanner/scanner.dart';
|
||||
import 'package:analyzer/src/error.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/string_source.dart';
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.file_system.file_system;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:watcher/watcher.dart';
|
||||
|
||||
export 'package:analyzer/src/file_system/file_system.dart';
|
||||
|
||||
/**
|
||||
* [File]s are leaf [Resource]s which contain data.
|
||||
*/
|
||||
|
@ -265,41 +265,3 @@ abstract class ResourceProvider {
|
|||
*/
|
||||
Folder getStateLocation(String pluginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* A [UriResolver] for [Resource]s.
|
||||
*/
|
||||
class ResourceUriResolver extends UriResolver {
|
||||
/**
|
||||
* The name of the `file` scheme.
|
||||
*/
|
||||
static final String FILE_SCHEME = "file";
|
||||
|
||||
final ResourceProvider _provider;
|
||||
|
||||
ResourceUriResolver(this._provider);
|
||||
|
||||
ResourceProvider get provider => _provider;
|
||||
|
||||
@override
|
||||
Source resolveAbsolute(Uri uri, [Uri actualUri]) {
|
||||
if (!isFileUri(uri)) {
|
||||
return null;
|
||||
}
|
||||
String path = _provider.pathContext.fromUri(uri);
|
||||
Resource resource = _provider.getResource(path);
|
||||
if (resource is File) {
|
||||
return resource.createSource(actualUri ?? uri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Uri restoreAbsolute(Source source) =>
|
||||
_provider.pathContext.toUri(source.fullName);
|
||||
|
||||
/**
|
||||
* Return `true` if the given [uri] is a `file` URI.
|
||||
*/
|
||||
static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,24 @@ import 'package:analyzer/src/source/source_resource.dart';
|
|||
import 'package:path/path.dart';
|
||||
import 'package:watcher/watcher.dart';
|
||||
|
||||
/**
|
||||
* The name of the directory containing plugin specific subfolders used to
|
||||
* store data across sessions.
|
||||
*/
|
||||
const String _SERVER_DIR = ".dartServer";
|
||||
|
||||
/**
|
||||
* Returns the path to the user's home directory.
|
||||
*/
|
||||
String _getStandardStateLocation() {
|
||||
final home = io.Platform.isWindows
|
||||
? io.Platform.environment['LOCALAPPDATA']
|
||||
: io.Platform.environment['HOME'];
|
||||
return home != null && io.FileSystemEntity.isDirectorySync(home)
|
||||
? join(home, _SERVER_DIR)
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return modification times for every file path in [paths].
|
||||
*
|
||||
|
@ -37,29 +55,11 @@ List<int> _pathsToTimes(List<String> paths) {
|
|||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the directory containing plugin specific subfolders used to
|
||||
* store data across sessions.
|
||||
*/
|
||||
const String _SERVER_DIR = ".dartServer";
|
||||
|
||||
/**
|
||||
* Returns the path to the user's home directory.
|
||||
*/
|
||||
String _getStandardStateLocation() {
|
||||
final home = io.Platform.isWindows
|
||||
? io.Platform.environment['LOCALAPPDATA']
|
||||
: io.Platform.environment['HOME'];
|
||||
return home != null && io.FileSystemEntity.isDirectorySync(home)
|
||||
? join(home, _SERVER_DIR)
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A `dart:io` based implementation of [ResourceProvider].
|
||||
*/
|
||||
class PhysicalResourceProvider implements ResourceProvider {
|
||||
static final FileReadMode NORMALIZE_EOL_ALWAYS =
|
||||
static final String Function(String) NORMALIZE_EOL_ALWAYS =
|
||||
(String string) => string.replaceAll(new RegExp('\r\n?'), '\n');
|
||||
|
||||
static final PhysicalResourceProvider INSTANCE =
|
||||
|
@ -70,7 +70,8 @@ class PhysicalResourceProvider implements ResourceProvider {
|
|||
*/
|
||||
final String _stateLocation;
|
||||
|
||||
PhysicalResourceProvider(FileReadMode fileReadMode, {String stateLocation})
|
||||
PhysicalResourceProvider(String Function(String) fileReadMode,
|
||||
{String stateLocation})
|
||||
: _stateLocation = stateLocation ?? _getStandardStateLocation() {
|
||||
if (fileReadMode != null) {
|
||||
FileBasedSource.fileReadMode = fileReadMode;
|
||||
|
|
|
@ -2,14 +2,7 @@
|
|||
// 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.
|
||||
|
||||
@deprecated
|
||||
library analyzer.plugin.resolver_provider;
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
|
||||
/**
|
||||
* A function that will return a [UriResolver] that can be used to resolve a
|
||||
* specific kind of URI within the analysis context rooted at the given
|
||||
* [folder].
|
||||
*/
|
||||
typedef UriResolver ResolverProvider(Folder folder);
|
||||
export 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
|
|
|
@ -2,100 +2,7 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.source.package_map_resolver;
|
||||
@deprecated
|
||||
library src.source.package_map_provider;
|
||||
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/util/asserts.dart' as asserts;
|
||||
import 'package:path/path.dart' as pathos;
|
||||
|
||||
/**
|
||||
* A [UriResolver] implementation for the `package:` scheme that uses a map of
|
||||
* package names to their directories.
|
||||
*/
|
||||
class PackageMapUriResolver extends UriResolver {
|
||||
/**
|
||||
* The name of the `package` scheme.
|
||||
*/
|
||||
static const String PACKAGE_SCHEME = "package";
|
||||
|
||||
/**
|
||||
* A table mapping package names to the path of the directories containing
|
||||
* the package.
|
||||
*/
|
||||
final Map<String, List<Folder>> packageMap;
|
||||
|
||||
/**
|
||||
* The [ResourceProvider] for this resolver.
|
||||
*/
|
||||
final ResourceProvider resourceProvider;
|
||||
|
||||
/**
|
||||
* Create a new [PackageMapUriResolver].
|
||||
*
|
||||
* [packageMap] is a table mapping package names to the paths of the
|
||||
* directories containing the package
|
||||
*/
|
||||
PackageMapUriResolver(this.resourceProvider, this.packageMap) {
|
||||
asserts.notNull(resourceProvider);
|
||||
asserts.notNull(packageMap);
|
||||
packageMap.forEach((name, folders) {
|
||||
if (folders.length != 1) {
|
||||
throw new ArgumentError(
|
||||
'Exactly one folder must be specified for a package.'
|
||||
'Found $name = $folders');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Source resolveAbsolute(Uri uri, [Uri actualUri]) {
|
||||
if (!isPackageUri(uri)) {
|
||||
return null;
|
||||
}
|
||||
// Prepare path.
|
||||
String path = uri.path;
|
||||
// Prepare path components.
|
||||
int index = path.indexOf('/');
|
||||
if (index == -1 || index == 0) {
|
||||
return null;
|
||||
}
|
||||
// <pkgName>/<relPath>
|
||||
String pkgName = path.substring(0, index);
|
||||
String relPath = path.substring(index + 1);
|
||||
// If the package is known, return the corresponding file.
|
||||
List<Folder> packageDirs = packageMap[pkgName];
|
||||
if (packageDirs != null) {
|
||||
Folder packageDir = packageDirs.single;
|
||||
File file = packageDir.getChildAssumingFile(relPath);
|
||||
return file.createSource(uri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Uri restoreAbsolute(Source source) {
|
||||
String sourcePath = source.fullName;
|
||||
pathos.Context pathContext = resourceProvider.pathContext;
|
||||
for (String pkgName in packageMap.keys) {
|
||||
Folder pkgFolder = packageMap[pkgName][0];
|
||||
String pkgFolderPath = pkgFolder.path;
|
||||
if (sourcePath.startsWith(pkgFolderPath + pathContext.separator)) {
|
||||
String relPath = sourcePath.substring(pkgFolderPath.length + 1);
|
||||
List<String> relPathComponents = pathContext.split(relPath);
|
||||
String relUriPath = pathos.posix.joinAll(relPathComponents);
|
||||
return Uri.parse('$PACKAGE_SCHEME:$pkgName/$relUriPath');
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [uri] is a `package` URI.
|
||||
*/
|
||||
static bool isPackageUri(Uri uri) {
|
||||
return uri.scheme == PACKAGE_SCHEME;
|
||||
}
|
||||
}
|
||||
export 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
|
|
|
@ -7,8 +7,6 @@ import 'dart:core';
|
|||
|
||||
import 'package:analyzer/dart/analysis/declared_variables.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
|
||||
import 'package:analyzer/src/command_line/arguments.dart'
|
||||
show
|
||||
|
@ -21,6 +19,7 @@ import 'package:analyzer/src/dart/analysis/driver.dart'
|
|||
show AnalysisDriver, AnalysisDriverScheduler;
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/bazel.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/gn.dart';
|
||||
|
@ -28,7 +27,9 @@ import 'package:analyzer/src/generated/sdk.dart';
|
|||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/workspace.dart';
|
||||
import 'package:analyzer/src/lint/registry.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/services/lint.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/summary/summary_sdk.dart';
|
||||
import 'package:analyzer/src/task/options.dart';
|
||||
import 'package:analyzer/src/util/sdk.dart';
|
||||
|
|
|
@ -9,7 +9,6 @@ import 'package:analyzer/dart/ast/ast.dart';
|
|||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/exception/exception.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/cancelable_future.dart';
|
||||
import 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator;
|
||||
import 'package:analyzer/src/context/cache.dart';
|
||||
|
@ -20,6 +19,7 @@ import 'package:analyzer/src/generated/resolver.dart';
|
|||
import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/utilities_collection.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/plugin/task.dart';
|
||||
import 'package:analyzer/src/task/api/dart.dart';
|
||||
import 'package:analyzer/src/task/api/general.dart';
|
||||
|
|
|
@ -2,19 +2,17 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.src.context.source;
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:math' show min;
|
||||
|
||||
import 'package:analyzer/exception/exception.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/utilities_dart.dart' as utils;
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:package_config/packages.dart';
|
||||
|
||||
/**
|
||||
|
|
44
pkg/analyzer/lib/src/file_system/file_system.dart
Normal file
44
pkg/analyzer/lib/src/file_system/file_system.dart
Normal file
|
@ -0,0 +1,44 @@
|
|||
// 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.
|
||||
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
|
||||
/**
|
||||
* A [UriResolver] for [Resource]s.
|
||||
*/
|
||||
class ResourceUriResolver extends UriResolver {
|
||||
/**
|
||||
* The name of the `file` scheme.
|
||||
*/
|
||||
static final String FILE_SCHEME = "file";
|
||||
|
||||
final ResourceProvider _provider;
|
||||
|
||||
ResourceUriResolver(this._provider);
|
||||
|
||||
ResourceProvider get provider => _provider;
|
||||
|
||||
@override
|
||||
Source resolveAbsolute(Uri uri, [Uri actualUri]) {
|
||||
if (!isFileUri(uri)) {
|
||||
return null;
|
||||
}
|
||||
String path = _provider.pathContext.fromUri(uri);
|
||||
Resource resource = _provider.getResource(path);
|
||||
if (resource is File) {
|
||||
return resource.createSource(actualUri ?? uri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Uri restoreAbsolute(Source source) =>
|
||||
_provider.pathContext.toUri(source.fullName);
|
||||
|
||||
/**
|
||||
* Return `true` if the given [uri] is a `file` URI.
|
||||
*/
|
||||
static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
|
||||
}
|
|
@ -2,12 +2,11 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.src.generated.bazel;
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
|
|
|
@ -12,7 +12,6 @@ import 'package:analyzer/dart/element/element.dart';
|
|||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/exception/exception.dart';
|
||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/source/error_processor.dart';
|
||||
import 'package:analyzer/src/cancelable_future.dart';
|
||||
import 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator;
|
||||
|
@ -24,6 +23,7 @@ import 'package:analyzer/src/generated/resolver.dart';
|
|||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/utilities_general.dart';
|
||||
import 'package:analyzer/src/plugin/engine_plugin.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/services/lint.dart';
|
||||
import 'package:analyzer/src/task/api/dart.dart';
|
||||
import 'package:analyzer/src/task/api/model.dart';
|
||||
|
|
|
@ -2,17 +2,16 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.src.generated.gn;
|
||||
|
||||
import 'dart:collection';
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/generated/workspace.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:package_config/packages.dart';
|
||||
import 'package:package_config/packages_file.dart';
|
||||
import 'package:package_config/src/packages_impl.dart';
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.src.generated.package;
|
||||
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/exception/exception.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/utilities_general.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:package_config/packages.dart';
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ import 'dart:io' as io;
|
|||
import 'package:analyzer/file_system/file_system.dart'
|
||||
show File, Folder, ResourceProvider, ResourceUriResolver;
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
|
@ -23,6 +23,7 @@ import 'package:analyzer/src/lint/linter.dart';
|
|||
import 'package:analyzer/src/lint/project.dart';
|
||||
import 'package:analyzer/src/lint/registry.dart';
|
||||
import 'package:analyzer/src/services/lint.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/util/sdk.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
|
|
13
pkg/analyzer/lib/src/plugin/resolver_provider.dart
Normal file
13
pkg/analyzer/lib/src/plugin/resolver_provider.dart
Normal file
|
@ -0,0 +1,13 @@
|
|||
// 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.
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
|
||||
/**
|
||||
* A function that will return a [UriResolver] that can be used to resolve a
|
||||
* specific kind of URI within the analysis context rooted at the given
|
||||
* [folder].
|
||||
*/
|
||||
typedef UriResolver ResolverProvider(Folder folder);
|
99
pkg/analyzer/lib/src/source/package_map_resolver.dart
Normal file
99
pkg/analyzer/lib/src/source/package_map_resolver.dart
Normal file
|
@ -0,0 +1,99 @@
|
|||
// 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.
|
||||
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/util/asserts.dart' as asserts;
|
||||
import 'package:path/path.dart' as pathos;
|
||||
|
||||
/**
|
||||
* A [UriResolver] implementation for the `package:` scheme that uses a map of
|
||||
* package names to their directories.
|
||||
*/
|
||||
class PackageMapUriResolver extends UriResolver {
|
||||
/**
|
||||
* The name of the `package` scheme.
|
||||
*/
|
||||
static const String PACKAGE_SCHEME = "package";
|
||||
|
||||
/**
|
||||
* A table mapping package names to the path of the directories containing
|
||||
* the package.
|
||||
*/
|
||||
final Map<String, List<Folder>> packageMap;
|
||||
|
||||
/**
|
||||
* The [ResourceProvider] for this resolver.
|
||||
*/
|
||||
final ResourceProvider resourceProvider;
|
||||
|
||||
/**
|
||||
* Create a new [PackageMapUriResolver].
|
||||
*
|
||||
* [packageMap] is a table mapping package names to the paths of the
|
||||
* directories containing the package
|
||||
*/
|
||||
PackageMapUriResolver(this.resourceProvider, this.packageMap) {
|
||||
asserts.notNull(resourceProvider);
|
||||
asserts.notNull(packageMap);
|
||||
packageMap.forEach((name, folders) {
|
||||
if (folders.length != 1) {
|
||||
throw new ArgumentError(
|
||||
'Exactly one folder must be specified for a package.'
|
||||
'Found $name = $folders');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Source resolveAbsolute(Uri uri, [Uri actualUri]) {
|
||||
if (!isPackageUri(uri)) {
|
||||
return null;
|
||||
}
|
||||
// Prepare path.
|
||||
String path = uri.path;
|
||||
// Prepare path components.
|
||||
int index = path.indexOf('/');
|
||||
if (index == -1 || index == 0) {
|
||||
return null;
|
||||
}
|
||||
// <pkgName>/<relPath>
|
||||
String pkgName = path.substring(0, index);
|
||||
String relPath = path.substring(index + 1);
|
||||
// If the package is known, return the corresponding file.
|
||||
List<Folder> packageDirs = packageMap[pkgName];
|
||||
if (packageDirs != null) {
|
||||
Folder packageDir = packageDirs.single;
|
||||
File file = packageDir.getChildAssumingFile(relPath);
|
||||
return file.createSource(uri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Uri restoreAbsolute(Source source) {
|
||||
String sourcePath = source.fullName;
|
||||
pathos.Context pathContext = resourceProvider.pathContext;
|
||||
for (String pkgName in packageMap.keys) {
|
||||
Folder pkgFolder = packageMap[pkgName][0];
|
||||
String pkgFolderPath = pkgFolder.path;
|
||||
if (sourcePath.startsWith(pkgFolderPath + pathContext.separator)) {
|
||||
String relPath = sourcePath.substring(pkgFolderPath.length + 1);
|
||||
List<String> relPathComponents = pathContext.split(relPath);
|
||||
String relUriPath = pathos.posix.joinAll(relPathComponents);
|
||||
return Uri.parse('$PACKAGE_SCHEME:$pkgName/$relUriPath');
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [uri] is a `package` URI.
|
||||
*/
|
||||
static bool isPackageUri(Uri uri) {
|
||||
return uri.scheme == PACKAGE_SCHEME;
|
||||
}
|
||||
}
|
|
@ -2,10 +2,8 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.test.file_system.resource_uri_resolver_test;
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
|
|
@ -18,6 +18,7 @@ import 'package:analyzer/src/dart/element/builder.dart';
|
|||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart' hide SdkLibrariesReader;
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/java_engine_io.dart';
|
||||
import 'package:analyzer/src/generated/java_io.dart';
|
||||
|
|
|
@ -15,6 +15,7 @@ import 'package:analyzer/src/context/context.dart';
|
|||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/element/type.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/resolver.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'dart:async';
|
|||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/cancelable_future.dart';
|
||||
import 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator;
|
||||
import 'package:analyzer/src/context/cache.dart';
|
||||
|
@ -17,6 +16,7 @@ import 'package:analyzer/src/generated/constant.dart';
|
|||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/resolver.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/string_source.dart';
|
||||
import 'package:analyzer/src/task/api/model.dart';
|
||||
import 'package:html/dom.dart' show Document;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.test.generated.resolver_test_case;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
|
@ -14,12 +12,12 @@ import 'package:analyzer/dart/element/type.dart';
|
|||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/element/type.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
|
||||
import 'package:analyzer/src/generated/java_engine.dart';
|
||||
import 'package:analyzer/src/generated/resolver.dart';
|
||||
|
@ -27,6 +25,7 @@ import 'package:analyzer/src/generated/sdk.dart';
|
|||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
|
||||
import 'package:analyzer/src/generated/testing/element_factory.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
|
|
@ -2,17 +2,16 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.test.generated.test.generated.source_factory;
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine, Logger;
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/generated/utilities_dart.dart' as utils;
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/source/source_resource.dart';
|
||||
import 'package:package_config/packages.dart';
|
||||
import 'package:package_config/packages_file.dart' as pkgfile show parse;
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'dart:core';
|
|||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/util/yaml.dart';
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.test.source.package_map_resolver_test;
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'package:analyzer/file_system/file_system.dart';
|
|||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/src/context/cache.dart';
|
||||
import 'package:analyzer/src/context/context.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/command_line/arguments.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/context/context_root.dart';
|
||||
import 'package:analyzer/src/context/source.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/bazel.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
|
@ -16,6 +16,7 @@ import 'package:analyzer/src/generated/source.dart';
|
|||
import 'package:analyzer/src/lint/linter.dart';
|
||||
import 'package:analyzer/src/lint/registry.dart';
|
||||
import 'package:analyzer/src/services/lint.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:args/args.dart';
|
||||
import 'package:package_config/packages.dart';
|
||||
import 'package:package_config/src/packages_impl.dart';
|
||||
|
|
|
@ -6,12 +6,12 @@ import 'package:analyzer/exception/exception.dart';
|
|||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/cache.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/utilities_collection.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/task/api/model.dart';
|
||||
import 'package:analyzer/src/task/model.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
|
|
@ -14,7 +14,6 @@ import 'package:analyzer/error/error.dart';
|
|||
import 'package:analyzer/exception/exception.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/cancelable_future.dart';
|
||||
import 'package:analyzer/src/context/cache.dart';
|
||||
import 'package:analyzer/src/context/context.dart';
|
||||
|
@ -23,6 +22,7 @@ import 'package:analyzer/src/generated/engine.dart';
|
|||
import 'package:analyzer/src/generated/resolver.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/utilities_collection.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/task/api/dart.dart';
|
||||
import 'package:analyzer/src/task/api/model.dart';
|
||||
import 'package:analyzer/src/task/dart.dart';
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// 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 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/context/source.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:package_config/packages.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
|
|
@ -6,13 +6,14 @@ import 'package:analyzer/dart/element/element.dart';
|
|||
import 'package:analyzer/dart/element/visitor.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/analysis/status.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/summary/package_bundle_reader.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
|
|
|
@ -9,7 +9,6 @@ import 'package:analyzer/dart/ast/standard_resolution_map.dart';
|
|||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
|
@ -18,6 +17,7 @@ import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
|
|||
import 'package:analyzer/src/dart/constant/evaluation.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
|
||||
import 'package:analyzer/src/generated/resolver.dart' show ResolverErrorCode;
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
|
|
|
@ -7,12 +7,13 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart'
|
||||
show AnalysisOptions, AnalysisOptionsImpl;
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
// 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.
|
||||
|
||||
library analyzer.test.src.source.source_resource_test;
|
||||
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/java_engine_io.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'package:analyzer/file_system/file_system.dart';
|
|||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/error_processor.dart';
|
||||
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/lint/linter.dart';
|
||||
|
|
|
@ -26,6 +26,7 @@ import 'package:front_end/src/api_prototype/byte_store.dart';
|
|||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
import 'package:source_span/source_span.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
|
||||
import '../../context/mock_sdk.dart';
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
* of exactly one task.
|
||||
* - Convert this tool to use package_config to find the package map.
|
||||
*/
|
||||
library analyzer.tool.task_dependency_graph.generate;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io' hide File;
|
||||
import 'dart:io' as io;
|
||||
|
@ -24,19 +22,19 @@ import 'dart:io' as io;
|
|||
import 'package:analyzer/analyzer.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/resolver.dart';
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:front_end/src/api_prototype/byte_store.dart';
|
||||
import 'package:front_end/src/base/performance_logger.dart';
|
||||
import 'package:front_end/src/codegen/tools.dart';
|
||||
|
|
|
@ -9,13 +9,12 @@ import 'package:analyzer/error/error.dart';
|
|||
import 'package:analyzer/file_system/file_system.dart' as file_system;
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/context/context.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/interner.dart';
|
||||
|
@ -25,8 +24,10 @@ import 'package:analyzer/src/generated/source.dart';
|
|||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/generated/utilities_general.dart'
|
||||
show PerformanceTag;
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
|
||||
import 'package:analyzer/src/source/package_map_provider.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/source/path_filter.dart';
|
||||
import 'package:analyzer/src/source/pub_package_map_provider.dart';
|
||||
import 'package:analyzer/src/source/sdk_ext.dart';
|
||||
|
@ -509,7 +510,7 @@ class Driver extends Object with HasContextMixin implements CommandLineStarter {
|
|||
resolvers
|
||||
.add(new InSummaryUriResolver(resourceProvider, summaryDataStore));
|
||||
resolvers.add(resolver);
|
||||
resolvers.add(new file_system.ResourceUriResolver(resourceProvider));
|
||||
resolvers.add(new ResourceUriResolver(resourceProvider));
|
||||
return new SourceFactory(resolvers);
|
||||
}
|
||||
}
|
||||
|
@ -579,7 +580,7 @@ class Driver extends Object with HasContextMixin implements CommandLineStarter {
|
|||
}
|
||||
|
||||
// Finally files.
|
||||
resolvers.add(new file_system.ResourceUriResolver(resourceProvider));
|
||||
resolvers.add(new ResourceUriResolver(resourceProvider));
|
||||
|
||||
return new SourceFactory(resolvers, packageInfo.packages);
|
||||
}
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
// 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.
|
||||
|
||||
library analyzer_cli.starter;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analyzer/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer/src/plugin/resolver_provider.dart';
|
||||
import 'package:analyzer_cli/src/driver.dart';
|
||||
import 'package:plugin/plugin.dart';
|
||||
|
||||
|
|
|
@ -3,25 +3,23 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
/// An entrypoint used to run portions of analyzer and measure its performance.
|
||||
library analyzer_cli.tool.perf;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io' show exit;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/error/listener.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver;
|
||||
import 'package:analyzer/file_system/physical_file_system.dart'
|
||||
show PhysicalResourceProvider;
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/dart/scanner/reader.dart';
|
||||
import 'package:analyzer/src/dart/scanner/scanner.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk;
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:package_config/discovery.dart';
|
||||
|
||||
main(List<String> args) async {
|
||||
|
|
|
@ -11,16 +11,17 @@ import 'package:analyzer/dart/element/visitor.dart';
|
|||
import 'package:analyzer/exception/exception.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/byte_store.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/dart/analysis/file_state.dart';
|
||||
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart' as engine;
|
||||
import 'package:analyzer/src/generated/sdk.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
import 'package:analyzer/src/generated/testing/element_search.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
|
||||
import 'mock_sdk.dart';
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import 'dart:async';
|
|||
|
||||
import 'package:analyzer/dart/analysis/results.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/source/package_map_resolver.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_plugin/src/utilities/completion/completion_core.dart';
|
||||
import 'package:analyzer_plugin/src/utilities/completion/completion_target.dart';
|
||||
|
|
|
@ -20,12 +20,12 @@ import 'dart:io' show Directory, File, Platform, exit;
|
|||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/error/listener.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart' show ResourceUriResolver;
|
||||
import 'package:analyzer/file_system/physical_file_system.dart'
|
||||
show PhysicalResourceProvider;
|
||||
import 'package:analyzer/source/package_map_resolver.dart';
|
||||
import 'package:analyzer/src/context/builder.dart';
|
||||
import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk;
|
||||
import 'package:analyzer/src/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/source_io.dart';
|
||||
|
|
Loading…
Reference in a new issue