merge verify_deps into debug_info

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1419903003 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 513b704..f6f4f16 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
 # Changelog
 
+## 0.2.1
+- Merged `verify_deps` tool into `debug_info` tool
+
 ## 0.2.0
 - Added AllInfoJsonCodec
 - Added `verify_deps` tool
diff --git a/README.md b/README.md
index b2f53b7..811877e 100644
--- a/README.md
+++ b/README.md
@@ -81,10 +81,6 @@
     `live_code_size_analysis` can correlate that with the `.info.json`, so you
     determine why code that is not used is being included in your app.
 
-  * [`verify_deps`][verify_deps]: a tool that verifies that all elements are
-    reachable from the program's entrypoint. If there are unreachable elements,
-    this indicates that the dependency information is incomplete.
-
 Next we describe in detail how to use each of these tools.
 
 ### Code deps tool
@@ -263,23 +259,6 @@
 dart2js_info_live_code_size_analysis main.dart.info.json main.dart.coverage.json
 ```
 
-### Verifying dependencies
-
-Coverage of dependency information may be incomplete. If there are elements that
-are live in the output that are unreachable through dependencies from the
-program's entrypoint, then we have incomplete dependency information. Note,
-however, that all elements may be reachable from the entrypoint even if there
-is missing dependency information. In order to verify that all elements are
-reachable from the app's entrypoint, simply run the tool as so:
-
-```bash
-dart2js_info_verify_deps foo.info.json
-```
-
-If all elements are reachable from the entrypoint, then the tool will return
-with exitcode 0. Otherwise, the tool will output the list of all functions that
-are not reachable from the entrypoint and return with exitcode 1.
-
 ## Code location, features and bugs
 
 This package is developed in [github][repo].  Please file feature requests and
@@ -292,5 +271,4 @@
 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_log_server.dart
 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size_analysis.dart
 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/function_size_analysis.dart
-[verify_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/verify_deps.dart
 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/AllInfo-class.html
diff --git a/bin/debug_info.dart b/bin/debug_info.dart
index 1c34cca..f0dd47b 100644
--- a/bin/debug_info.dart
+++ b/bin/debug_info.dart
@@ -11,6 +11,7 @@
 
 import 'package:dart2js_info/info.dart';
 import 'package:dart2js_info/src/graph.dart';
+import 'package:dart2js_info/src/util.dart';
 
 main(args) {
   if (args.length < 1) {
@@ -28,6 +29,13 @@
     debugLibName = args[2];
   }
 
+  validateSize(info, debugLibName);
+  compareGraphs(info);
+  verifyDeps(info);
+}
+
+/// Validates that codesize of elements adds up to total codesize.
+validateSize(AllInfo info, String debugLibName) {
   // Gather data from visiting all info elements.
   var tracker = new _SizeTracker(debugLibName);
   info.accept(tracker);
@@ -67,9 +75,6 @@
     var percent = (missingTotal * 100 / realTotal).toStringAsFixed(2);
     _fail('$percent% size missing in libraries (sum of elements > lib.size)');
   }
-
-  // Validate dependency data.
-  compareGraphs(info);
 }
 
 class _SizeTracker extends RecursiveInfoVisitor {
@@ -208,6 +213,7 @@
   int _bodySize = 0;
 }
 
+/// Validates that both forms of dependency information match.
 void compareGraphs(AllInfo info) {
   var g1 = new EdgeListGraph<Info>();
   var g2 = new EdgeListGraph<Info>();
@@ -258,5 +264,23 @@
   }
 }
 
+// Validates that all elements are reachable from `main` in the dependency
+// graph.
+verifyDeps(AllInfo info) {
+  var graph = graphFromInfo(info);
+  var entrypoint = info.program.entrypoint;
+  var reachables = new Set.from(graph.preOrder(entrypoint));
+
+  var functionsAndFields = []..addAll(info.functions)..addAll(info.fields);
+  var unreachables =
+      functionsAndFields.where((func) => !reachables.contains(func));
+  if (unreachables.isNotEmpty) {
+    _fail('${unreachables.length} elements are unreachable from the '
+        'entrypoint');
+  } else {
+    _pass('all elements are reachable from the entrypoint');
+  }
+}
+
 _pass(String msg) => print('\x1b[32mPASS\x1b[0m: $msg');
 _fail(String msg) => print('\x1b[31mFAIL\x1b[0m: $msg');
diff --git a/bin/verify_deps.dart b/bin/verify_deps.dart
deleted file mode 100644
index 05fef0f..0000000
--- a/bin/verify_deps.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// This tools verifies that all elements that are included in the output are
-/// reachable from the program entrypoint. If there are elements that are not
-/// reachable from the entrypoint, then this indicates that we are missing
-/// dependencies. If all functions are reachable from the entrypoint, this
-/// script will return with exitcode 0. Otherwise it will list the unreachable
-/// functions and return with exitcode 1.
-library dart2js_info.bin.verify_deps;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-
-import 'package:dart2js_info/info.dart';
-import 'package:dart2js_info/src/graph.dart';
-import 'package:dart2js_info/src/util.dart';
-
-Future main(List<String> args) async {
-  if (args.length > 1) {
-    printUsage();
-    exit(1);
-  }
-  var json = JSON.decode(await new File(args[0]).readAsString());
-  var info = new AllInfoJsonCodec().decode(json);
-  var graph = graphFromInfo(info);
-  var entrypoint = info.program.entrypoint;
-  var reachables = findReachable(graph, entrypoint);
-
-  var functionsAndFields = []..addAll(info.functions)..addAll(info.fields);
-  var unreachables =
-      functionsAndFields.where((func) => !reachables.contains(func));
-  if (unreachables.isNotEmpty) {
-    unreachables.forEach((x) => print(longName(x)));
-    exit(1);
-  } else {
-    print('all elements are reachable from the entrypoint');
-  }
-}
-
-/// Finds the set of nodes reachable from [start] in [graph].
-Set<Info> findReachable(Graph<Info> graph, Info start) =>
-    new Set.from(graph.preOrder(start));
-
-void printUsage() {
-  print('usage: dart2js_info_verify_deps <info file>');
-}
diff --git a/pubspec.yaml b/pubspec.yaml
index 7de01fa..81b8c2d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: dart2js_info
-version: 0.2.0+1
+version: 0.2.1
 description: >
   Libraries and tools to process data produced when running dart2js with
   --dump-info.
@@ -25,4 +25,3 @@
   dart2js_info_function_size_analysis:  function_size_analysis
   dart2js_info_library_size_split:      library_size_split
   dart2js_info_live_code_size_analysis: live_code_size_analysis
-  dart2js_info_verify_deps:             verify_deps