Index: tools/testing/dart/test_runner.dart |
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart |
index e69a6ac2e9daafc532ded4b0ee6484799ba8ff28..8402519cfb423e29fe4e3f677e05bcfd43daa3c2 100644 |
--- a/tools/testing/dart/test_runner.dart |
+++ b/tools/testing/dart/test_runner.dart |
@@ -19,8 +19,6 @@ import "dart:convert" show LineSplitter, UTF8, JSON; |
import "dart:io" as io; |
import "dart:math" as math; |
-import 'package:yaml/yaml.dart'; |
- |
import 'android.dart'; |
import "browser_controller.dart"; |
import 'dependency_graph.dart' as dgraph; |
@@ -525,98 +523,6 @@ class CleanDirectoryCopyCommand extends ScriptCommand { |
_destinationDirectory == other._destinationDirectory; |
} |
-class ModifyPubspecYamlCommand extends ScriptCommand { |
- String _pubspecYamlFile; |
- String _destinationFile; |
- Map<String, Map> _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)."; |
- |
- Future<ScriptCommandOutputImpl> run() { |
- var watch = new Stopwatch()..start(); |
- |
- var pubspecLockFile = _destinationFile.substring( |
- 0, _destinationFile.length - ".yaml".length) + |
- ".lock"; |
- |
- var file = new io.File(_pubspecYamlFile); |
- 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"); |
- overrides.forEach((String packageName, Map override) { |
- dependencyOverrideSection.write(" $packageName:\n"); |
- override.forEach((overrideKey, overrideValue) { |
- dependencyOverrideSection |
- .write(" $overrideKey: $overrideValue\n"); |
- }); |
- }); |
- } |
- var modifiedYamlString = "$yamlString\n$dependencyOverrideSection"; |
- return destinationFile.writeAsString(modifiedYamlString).then((_) { |
- lockfile.exists().then((bool lockfileExists) { |
- if (lockfileExists) { |
- return lockfile.delete(); |
- } |
- }); |
- }); |
- }).then((_) { |
- return new ScriptCommandOutputImpl( |
- this, Expectation.PASS, "", watch.elapsed); |
- }).catchError((error) { |
- return new ScriptCommandOutputImpl( |
- this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
- }); |
- } |
- |
- void _buildHashCode(HashCodeBuilder builder) { |
- super._buildHashCode(builder); |
- builder.addJson(_pubspecYamlFile); |
- builder.addJson(_destinationFile); |
- builder.addJson(_dependencyOverrides); |
- } |
- |
- bool _equal(ModifyPubspecYamlCommand other) => |
- super._equal(other) && |
- _pubspecYamlFile == other._pubspecYamlFile && |
- _destinationFile == other._destinationFile && |
- deepJsonCompare(_dependencyOverrides, other._dependencyOverrides); |
-} |
- |
/* |
* [MakeSymlinkCommand] makes a symbolic link to another directory. |
*/ |
@@ -799,13 +705,6 @@ class CommandBuilder { |
return _getUniqueCommand(new MakeSymlinkCommand._(link, target)); |
} |
- Command getModifyPubspecCommand(String pubspecYamlFile, Map depsOverrides, |
- {String destinationFile: null}) { |
- if (destinationFile == null) destinationFile = pubspecYamlFile; |
- return _getUniqueCommand(new ModifyPubspecYamlCommand._( |
- pubspecYamlFile, destinationFile, depsOverrides)); |
- } |
- |
Command _getUniqueCommand(Command command) { |
// All Command classes implement hashCode and operator==. |
// We check if this command has already been built. |