Commit fffde14f authored by Phil Quitslund's avatar Phil Quitslund Committed by GitHub

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.
parent b1a77203
...@@ -13,10 +13,15 @@ dependencies: ...@@ -13,10 +13,15 @@ dependencies:
path: ^1.3.0 path: ^1.3.0
stack_trace: ^1.4.0 stack_trace: ^1.4.0
vm_service_client: '^0.2.0' vm_service_client: '^0.2.0'
# See packages/flutter_test/pubspec.yaml for why we're pinning this version # Pulled in via dependency_override below.
analyzer: 0.28.2-alpha.0 analyzer: any
dev_dependencies: dev_dependencies:
# See packages/flutter_test/pubspec.yaml for why we're pinning this version # See packages/flutter_test/pubspec.yaml for why we're pinning this version.
test: 0.12.15+4 test: 0.12.15+4
# See packages/flutter_test/pubspec.yaml for why we're using an override.
dependency_overrides:
analyzer:
path: ../../bin/cache/dart-sdk/lib/analyzer
...@@ -8,9 +8,13 @@ dependencies: ...@@ -8,9 +8,13 @@ dependencies:
test: 0.12.15+4 test: 0.12.15+4
# We don't actually depend on 'analyzer', but 'test' and 'flutter_tools' do. # We don't actually depend on 'analyzer', but 'test' and 'flutter_tools' do.
# We pin the version of analyzer we depend on to avoid version skew across our # Like 'flutter_tools', we use the version of the analyzer in the vended Dart
# packages. # SDK as defined in the `dependency_overrides` below.
analyzer: 0.28.2-alpha.0 analyzer: any
flutter: flutter:
path: ../flutter path: ../flutter
dependency_overrides:
analyzer:
path: ../../bin/cache/dart-sdk/lib/analyzer
...@@ -179,8 +179,15 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -179,8 +179,15 @@ class AnalyzeCommand extends FlutterCommand {
.where((String line) => !line.startsWith(new RegExp(r'^ *#'))) .where((String line) => !line.startsWith(new RegExp(r'^ *#')))
.forEach((String line) { .forEach((String line) {
int colon = line.indexOf(':'); int colon = line.indexOf(':');
if (colon > 0) if (colon > 0) {
dependencies.add(line.substring(0, colon), path.normalize(path.absolute(directory.path, path.fromUri(line.substring(colon+1)))), dotPackagesPath); 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: ...@@ -38,8 +38,8 @@ dependencies:
# precisely. # precisely.
test: 0.12.15+4 test: 0.12.15+4
# Pinned in flutter_test as well. # Version from the vended Dart SDK as defined in `dependency_overrides`.
analyzer: 0.28.2-alpha.0 analyzer: any
dev_dependencies: dev_dependencies:
mockito: ^1.0.0 mockito: ^1.0.0
...@@ -47,3 +47,7 @@ dev_dependencies: ...@@ -47,3 +47,7 @@ dev_dependencies:
# Exclude this package from the hosted API docs. # Exclude this package from the hosted API docs.
dartdoc: dartdoc:
nodoc: true nodoc: true
dependency_overrides:
analyzer:
path: ../../bin/cache/dart-sdk/lib/analyzer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment