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); |
} |
} |