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

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

Issue 672003002: Add package root setting to analysis server API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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/generated_protocol.dart
diff --git a/pkg/analysis_server/lib/src/generated_protocol.dart b/pkg/analysis_server/lib/src/generated_protocol.dart
index c1a12ff4935424a86c53e21f7d13aa2be29d35aa..49096f359f672b2b8ed94baff3d51b64ca20bbd2 100644
--- a/pkg/analysis_server/lib/src/generated_protocol.dart
+++ b/pkg/analysis_server/lib/src/generated_protocol.dart
@@ -741,6 +741,7 @@ class AnalysisReanalyzeResult {
* {
* "included": List<FilePath>
* "excluded": List<FilePath>
+ * "packageRoots": optional Map<FilePath, FilePath>
* }
*/
class AnalysisSetAnalysisRootsParams implements HasToJson {
@@ -755,7 +756,21 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
*/
List<String> excluded;
- AnalysisSetAnalysisRootsParams(this.included, this.excluded);
+ /**
+ * A mapping from source directories to target directories that should
+ * override the normal package: URI resolution mechanism. The analyzer will
+ * behave as though each source directory in the map contains a special
+ * pubspec.yaml file which resolves any package: URI to the corresponding
+ * path within the target directory. The effect is the same as specifying the
+ * target directory as a "--package_root" parameter to the Dart VM when
+ * executing any Dart file inside the source directory.
+ *
+ * If this field is absent, or the empty map is specified, then all package:
+ * URI's are resolved the normal pubspec.yaml mechanism.
+ */
+ Map<String, String> packageRoots;
+
+ AnalysisSetAnalysisRootsParams(this.included, this.excluded, {this.packageRoots});
factory AnalysisSetAnalysisRootsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
if (json == null) {
@@ -774,7 +789,11 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
} else {
throw jsonDecoder.missingKey(jsonPath, "excluded");
}
- return new AnalysisSetAnalysisRootsParams(included, excluded);
+ Map<String, String> packageRoots;
+ if (json.containsKey("packageRoots")) {
+ packageRoots = jsonDecoder._decodeMap(jsonPath + ".packageRoots", json["packageRoots"], valueDecoder: jsonDecoder._decodeString);
+ }
+ return new AnalysisSetAnalysisRootsParams(included, excluded, packageRoots: packageRoots);
} else {
throw jsonDecoder.mismatch(jsonPath, "analysis.setAnalysisRoots params");
}
@@ -789,6 +808,9 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
Map<String, dynamic> result = {};
result["included"] = included;
result["excluded"] = excluded;
+ if (packageRoots != null) {
+ result["packageRoots"] = packageRoots;
+ }
return result;
}
@@ -803,7 +825,8 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
bool operator==(other) {
if (other is AnalysisSetAnalysisRootsParams) {
return _listEqual(included, other.included, (String a, String b) => a == b) &&
- _listEqual(excluded, other.excluded, (String a, String b) => a == b);
+ _listEqual(excluded, other.excluded, (String a, String b) => a == b) &&
+ _mapEqual(packageRoots, other.packageRoots, (String a, String b) => a == b);
}
return false;
}
@@ -813,6 +836,7 @@ class AnalysisSetAnalysisRootsParams implements HasToJson {
int hash = 0;
hash = _JenkinsSmiHash.combine(hash, included.hashCode);
hash = _JenkinsSmiHash.combine(hash, excluded.hashCode);
+ hash = _JenkinsSmiHash.combine(hash, packageRoots.hashCode);
return _JenkinsSmiHash.finish(hash);
}
}

Powered by Google App Engine
This is Rietveld 408576698