[frontend_server] Add --no-print-incremental-dependencies option to suppress extra frontend_server output

Front-end server prints all dependencies after compilation, which could
result in a lot of output when AOT compiling a large application.

This change adds --no-print-incremental-dependencies option which
suppresses extra output. This skips printing dependencies which
takes time and avoids I/O which may be blocked.

Issue: https://github.com/dart-lang/sdk/issues/43299
Change-Id: I7779d3b5f1b513c2370978a5384a71cff371f017
b/154155290
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167860
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
diff --git a/pkg/frontend_server/lib/frontend_server.dart b/pkg/frontend_server/lib/frontend_server.dart
index dc92143..ee3f98e 100644
--- a/pkg/frontend_server/lib/frontend_server.dart
+++ b/pkg/frontend_server/lib/frontend_server.dart
@@ -180,7 +180,10 @@
       defaultsTo: 'amd')
   ..addFlag('flutter-widget-cache',
       help: 'Enable the widget cache to track changes to Widget subtypes',
-      defaultsTo: false);
+      defaultsTo: false)
+  ..addFlag('print-incremental-dependencies',
+      help: 'Print list of sources added and removed from compilation',
+      defaultsTo: true);
 
 String usage = '''
 Usage: server [options] [input.dart]
@@ -339,6 +342,7 @@
   bool incrementalSerialization;
   bool useDebuggerModuleNames;
   bool emitDebugMetadata;
+  bool _printIncrementalDependencies;
 
   CompilerOptions _compilerOptions;
   BytecodeOptions _bytecodeOptions;
@@ -406,6 +410,7 @@
     _kernelBinaryFilename = _kernelBinaryFilenameFull;
     _initializeFromDill =
         _options['initialize-from-dill'] ?? _kernelBinaryFilenameFull;
+    _printIncrementalDependencies = _options['print-incremental-dependencies'];
     final String boundaryKey = Uuid().generateV4();
     _outputStream.writeln('result $boundaryKey');
     final Uri sdkRoot = _ensureFolderPath(options['sdk-root']);
@@ -609,6 +614,9 @@
   }
 
   void _outputDependenciesDelta(Iterable<Uri> compiledSources) async {
+    if (!_printIncrementalDependencies) {
+      return;
+    }
     Set<Uri> uris = Set<Uri>();
     for (Uri uri in compiledSources) {
       // Skip empty or corelib dependencies.