Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: pkg/analysis_server/lib/src/package_map_provider.dart

Issue 372763003: Move file_system libraries into 'analyzer'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/package_map_provider.dart
diff --git a/pkg/analysis_server/lib/src/package_map_provider.dart b/pkg/analysis_server/lib/src/package_map_provider.dart
index 34b36a99c429099baa1fd64f380015ac358a6bbb..bf031c46c33b50df3104064a92946c1ae77bdd8c 100644
--- a/pkg/analysis_server/lib/src/package_map_provider.dart
+++ b/pkg/analysis_server/lib/src/package_map_provider.dart
@@ -9,25 +9,11 @@ import 'dart:convert';
import 'dart:io' as io;
import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analysis_server/src/resource.dart';
+import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:path/path.dart';
/**
- * A PackageMapProvider is an entity capable of determining the mapping from
- * package name to source directory for a given folder.
- */
-abstract class PackageMapProvider {
- /**
- * Compute a package map for the given folder, if possible.
- *
- * If a package map can't be computed (e.g. because an error occurred), a
- * [PackageMapInfo] will still be returned, but its packageMap will be null.
- */
- PackageMapInfo computePackageMap(Folder folder);
-}
-
-/**
* Data structure output by PackageMapProvider. This contains both the package
* map and dependency information.
*/
@@ -51,6 +37,20 @@ class PackageMapInfo {
}
/**
+ * A PackageMapProvider is an entity capable of determining the mapping from
+ * package name to source directory for a given folder.
+ */
+abstract class PackageMapProvider {
+ /**
+ * Compute a package map for the given folder, if possible.
+ *
+ * If a package map can't be computed (e.g. because an error occurred), a
+ * [PackageMapInfo] will still be returned, but its packageMap will be null.
+ */
+ PackageMapInfo computePackageMap(Folder folder);
+}
+
+/**
* Implementation of PackageMapProvider that operates by executing pub.
*/
class PubPackageMapProvider implements PackageMapProvider {
@@ -100,18 +100,6 @@ class PubPackageMapProvider implements PackageMapProvider {
}
/**
- * Create a PackageMapInfo object representing an error condition.
- */
- PackageMapInfo _error(Folder folder) {
- // Even if an error occurs, we still need to know the dependencies, so that
- // we'll know when to try running "pub list-package-dirs" again.
- // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when
- // an error occurs, so just assume there is one dependency, "pubspec.lock".
- List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)];
- return new PackageMapInfo(null, dependencies.toSet());
- }
-
- /**
* Decode the JSON output from pub into a package map. Paths in the
* output are considered relative to [folder].
*/
@@ -162,4 +150,16 @@ class PubPackageMapProvider implements PackageMapProvider {
}
return new PackageMapInfo(packageMap, dependencies);
}
+
+ /**
+ * Create a PackageMapInfo object representing an error condition.
+ */
+ PackageMapInfo _error(Folder folder) {
+ // Even if an error occurs, we still need to know the dependencies, so that
+ // we'll know when to try running "pub list-package-dirs" again.
+ // Unfortunately, "pub list-package-dirs" doesn't tell us dependencies when
+ // an error occurs, so just assume there is one dependency, "pubspec.lock".
+ List<String> dependencies = <String>[join(folder.path, PUBSPEC_LOCK_NAME)];
+ return new PackageMapInfo(null, dependencies.toSet());
+ }
}
« no previous file with comments | « pkg/analysis_server/lib/src/context_directory_manager.dart ('k') | pkg/analysis_server/lib/src/package_uri_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698