Update tools to use analyzer from vended Dart SDK. (#5900)
* Update tools to use `analyzer` from vended Dart SDK. * updates `flutter_tools` and `flutter_test` to use the SDK-vended `analyzer` package * tweaks dependency tracking logic to only record the SDK-vended `analyzer` so as not to crash on spurious conflicts (due to transitive dependencies) * Review fixes.
This commit is contained in:
@@ -179,8 +179,15 @@ class AnalyzeCommand extends FlutterCommand {
|
||||
.where((String line) => !line.startsWith(new RegExp(r'^ *#')))
|
||||
.forEach((String line) {
|
||||
int colon = line.indexOf(':');
|
||||
if (colon > 0)
|
||||
dependencies.add(line.substring(0, colon), path.normalize(path.absolute(directory.path, path.fromUri(line.substring(colon+1)))), dotPackagesPath);
|
||||
if (colon > 0) {
|
||||
String packageName = line.substring(0, colon);
|
||||
String packagePath = path.fromUri(line.substring(colon+1));
|
||||
// Ensure that we only add the `analyzer` package defined in the vended SDK (and referred to with a local path directive).
|
||||
// Analyzer package versions reached via transitive dependencies (e.g., via `test`) are ignored since they would produce
|
||||
// spurious conflicts.
|
||||
if (packageName != 'analyzer' || packagePath.startsWith('..'))
|
||||
dependencies.add(packageName, path.normalize(path.absolute(directory.path, path.fromUri(packagePath))), dotPackagesPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ dependencies:
|
||||
# precisely.
|
||||
test: 0.12.15+4
|
||||
|
||||
# Pinned in flutter_test as well.
|
||||
analyzer: 0.28.2-alpha.0
|
||||
# Version from the vended Dart SDK as defined in `dependency_overrides`.
|
||||
analyzer: any
|
||||
|
||||
dev_dependencies:
|
||||
mockito: ^1.0.0
|
||||
@@ -47,3 +47,7 @@ dev_dependencies:
|
||||
# Exclude this package from the hosted API docs.
|
||||
dartdoc:
|
||||
nodoc: true
|
||||
|
||||
dependency_overrides:
|
||||
analyzer:
|
||||
path: ../../bin/cache/dart-sdk/lib/analyzer
|
||||
|
||||
Reference in New Issue
Block a user