| Index: tools/testing/dart/test_runner.dart
|
| diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
|
| index e9fed49b077cde5ea16598a2fcf9dcd1eb88d0a4..3f755dda9cf4109fa282b869ab3ce63d73041aac 100644
|
| --- a/tools/testing/dart/test_runner.dart
|
| +++ b/tools/testing/dart/test_runner.dart
|
| @@ -18,6 +18,9 @@ import "dart:convert" show LineSplitter, UTF8, JSON;
|
| // CommandOutput.exitCode in subclasses of CommandOutput.
|
| import "dart:io" as io;
|
| import "dart:math" as math;
|
| +
|
| +import 'package:yaml/yaml.dart';
|
| +
|
| import 'android.dart';
|
| import 'dependency_graph.dart' as dgraph;
|
| import "browser_controller.dart";
|
| @@ -463,13 +466,33 @@ class ModifyPubspecYamlCommand extends ScriptCommand {
|
| String _destinationFile;
|
| Map<String, Map> _dependencyOverrides;
|
|
|
| - ModifyPubspecYamlCommand._(
|
| - this._pubspecYamlFile, this._destinationFile, this._dependencyOverrides)
|
| + ModifyPubspecYamlCommand._(this._pubspecYamlFile,
|
| + this._destinationFile, this._dependencyOverrides)
|
| : super._("modify_pubspec") {
|
| assert(_pubspecYamlFile.endsWith("pubspec.yaml"));
|
| assert(_destinationFile.endsWith("pubspec.yaml"));
|
| }
|
|
|
| + static Map<String, Map> _filterOverrides(
|
| + String pubspec, Map<String, Map> overrides) {
|
| + if (overrides.isEmpty) return overrides;
|
| + var yaml = loadYaml(pubspec);
|
| + var deps = yaml['dependencies'];
|
| + var filteredOverrides = <String, Map>{};
|
| + if (deps != null) {
|
| + for (var d in deps.keys) {
|
| + if (!overrides.containsKey(d)) {
|
| + // pub depends on compiler_unsupported instead of compiler
|
| + // The dependency is so hackish that we currently ignore it here.
|
| + if (d == 'compiler_unsupported') continue;
|
| + throw "Repo doesn't have package $d used in $pubspec";
|
| + }
|
| + filteredOverrides[d] = overrides[d];
|
| + }
|
| + }
|
| + return filteredOverrides;
|
| + }
|
| +
|
| String get reproductionCommand =>
|
| "Adding necessary dependency overrides to '$_pubspecYamlFile' "
|
| "(destination = $_destinationFile).";
|
| @@ -485,12 +508,13 @@ class ModifyPubspecYamlCommand extends ScriptCommand {
|
| var destinationFile = new io.File(_destinationFile);
|
| var lockfile = new io.File(pubspecLockFile);
|
| return file.readAsString().then((String yamlString) {
|
| + var overrides = _filterOverrides(yamlString, _dependencyOverrides);
|
| var dependencyOverrideSection = new StringBuffer();
|
| if (_dependencyOverrides.isNotEmpty) {
|
| dependencyOverrideSection.write("\n"
|
| "# This section was autogenerated by test.py!\n"
|
| "dependency_overrides:\n");
|
| - _dependencyOverrides.forEach((String packageName, Map override) {
|
| + overrides.forEach((String packageName, Map override) {
|
| dependencyOverrideSection.write(" $packageName:\n");
|
| override.forEach((overrideKey, overrideValue) {
|
| dependencyOverrideSection
|
|
|