 Chromium Code Reviews
 Chromium Code Reviews Issue 2968403002:
  Remove the --build-summary-only-diet option.  (Closed)
    
  
    Issue 2968403002:
  Remove the --build-summary-only-diet option.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a | 
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 import 'dart:async'; | 5 import 'dart:async'; | 
| 6 import 'dart:io' as io; | 6 import 'dart:io' as io; | 
| 7 | 7 | 
| 8 import 'package:analyzer/error/error.dart'; | 8 import 'package:analyzer/error/error.dart'; | 
| 9 import 'package:analyzer/file_system/file_system.dart' as file_system; | 9 import 'package:analyzer/file_system/file_system.dart' as file_system; | 
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 import 'package:package_config/packages.dart' show Packages; | 47 import 'package:package_config/packages.dart' show Packages; | 
| 48 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 48 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 
| 49 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 49 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 
| 50 import 'package:path/path.dart' as path; | 50 import 'package:path/path.dart' as path; | 
| 51 import 'package:plugin/manager.dart'; | 51 import 'package:plugin/manager.dart'; | 
| 52 import 'package:plugin/plugin.dart'; | 52 import 'package:plugin/plugin.dart'; | 
| 53 import 'package:telemetry/crash_reporting.dart'; | 53 import 'package:telemetry/crash_reporting.dart'; | 
| 54 import 'package:telemetry/telemetry.dart' as telemetry; | 54 import 'package:telemetry/telemetry.dart' as telemetry; | 
| 55 import 'package:yaml/yaml.dart'; | 55 import 'package:yaml/yaml.dart'; | 
| 56 | 56 | 
| 57 const _analyticsID = 'UA-26406144-28'; | |
| 58 | |
| 57 /// Shared IO sink for standard error reporting. | 59 /// Shared IO sink for standard error reporting. | 
| 58 @visibleForTesting | 60 @visibleForTesting | 
| 59 StringSink errorSink = io.stderr; | 61 StringSink errorSink = io.stderr; | 
| 60 | 62 | 
| 61 /// Shared IO sink for standard out reporting. | 63 /// Shared IO sink for standard out reporting. | 
| 62 @visibleForTesting | 64 @visibleForTesting | 
| 63 StringSink outSink = io.stdout; | 65 StringSink outSink = io.stdout; | 
| 64 | 66 | 
| 67 telemetry.Analytics _analytics; | |
| 68 | |
| 69 /// The analytics instance for analyzer-cli. | |
| 70 telemetry.Analytics get analytics => (_analytics ??= | |
| 71 telemetry.createAnalyticsInstance(_analyticsID, 'analyzer-cli')); | |
| 72 | |
| 65 /// Test this option map to see if it specifies lint rules. | 73 /// Test this option map to see if it specifies lint rules. | 
| 66 bool containsLintRuleEntry(Map<String, YamlNode> options) { | 74 bool containsLintRuleEntry(Map<String, YamlNode> options) { | 
| 67 var linterNode = options['linter']; | 75 var linterNode = options['linter']; | 
| 68 return linterNode is YamlMap && linterNode.containsKey('rules'); | 76 return linterNode is YamlMap && linterNode.containsKey('rules'); | 
| 69 } | 77 } | 
| 70 | 78 | 
| 71 telemetry.Analytics _analytics; | |
| 72 | |
| 73 const _analyticsID = 'UA-26406144-28'; | |
| 74 | |
| 75 /// The analytics instance for analyzer-cli. | |
| 76 telemetry.Analytics get analytics => (_analytics ??= | |
| 77 telemetry.createAnalyticsInstance(_analyticsID, 'analyzer-cli')); | |
| 78 | |
| 79 /// Make sure that we create an analytics instance that doesn't send for this | 79 /// Make sure that we create an analytics instance that doesn't send for this | 
| 80 /// session. | 80 /// session. | 
| 81 void disableAnalyticsForSession() { | 81 void disableAnalyticsForSession() { | 
| 82 _analytics = telemetry.createAnalyticsInstance(_analyticsID, 'analyzer-cli', | 82 _analytics = telemetry.createAnalyticsInstance(_analyticsID, 'analyzer-cli', | 
| 83 disableForSession: true); | 83 disableForSession: true); | 
| 84 } | 84 } | 
| 85 | 85 | 
| 86 @visibleForTesting | 86 @visibleForTesting | 
| 87 void setAnalytics(telemetry.Analytics replacementAnalytics) { | 87 void setAnalytics(telemetry.Analytics replacementAnalytics) { | 
| 88 _analytics = replacementAnalytics; | 88 _analytics = replacementAnalytics; | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 * The resource provider used to access the file system. | 125 * The resource provider used to access the file system. | 
| 126 */ | 126 */ | 
| 127 file_system.ResourceProvider resourceProvider = | 127 file_system.ResourceProvider resourceProvider = | 
| 128 PhysicalResourceProvider.INSTANCE; | 128 PhysicalResourceProvider.INSTANCE; | 
| 129 | 129 | 
| 130 /// Collected analysis statistics. | 130 /// Collected analysis statistics. | 
| 131 final AnalysisStats stats = new AnalysisStats(); | 131 final AnalysisStats stats = new AnalysisStats(); | 
| 132 | 132 | 
| 133 CrashReportSender _crashReportSender; | 133 CrashReportSender _crashReportSender; | 
| 134 | 134 | 
| 135 // TODO(devoncarew): Replace with the real crash product ID. | 135 // TODO(devoncarew): Replace with the real crash product ID. | 
| 
Brian Wilkerson
2017/07/07 15:40:54
The comment was separated from the getter. Please
 | |
| 136 /// The crash reporting instance for analyzer-cli. | |
| 137 CrashReportSender get crashReportSender => (_crashReportSender ??= | |
| 138 new CrashReportSender('Dart_analyzer_cli', analytics)); | |
| 139 | |
| 140 /// Create a new Driver instance. | 136 /// Create a new Driver instance. | 
| 141 /// | 137 /// | 
| 142 /// [isTesting] is true if we're running in a test environment. | 138 /// [isTesting] is true if we're running in a test environment. | 
| 143 Driver({bool isTesting: false}) { | 139 Driver({bool isTesting: false}) { | 
| 144 if (isTesting) { | 140 if (isTesting) { | 
| 145 disableAnalyticsForSession(); | 141 disableAnalyticsForSession(); | 
| 146 } | 142 } | 
| 147 } | 143 } | 
| 148 | 144 | 
| 149 /// This Driver's current analysis context. | 145 /// This Driver's current analysis context. | 
| 150 @visibleForTesting | 146 @visibleForTesting | 
| 151 AnalysisContext get context => _context; | 147 AnalysisContext get context => _context; | 
| 152 | 148 | 
| 149 /// The crash reporting instance for analyzer-cli. | |
| 150 CrashReportSender get crashReportSender => (_crashReportSender ??= | |
| 151 new CrashReportSender('Dart_analyzer_cli', analytics)); | |
| 152 | |
| 153 @override | 153 @override | 
| 154 void set userDefinedPlugins(List<Plugin> plugins) { | 154 void set userDefinedPlugins(List<Plugin> plugins) { | 
| 155 _userDefinedPlugins = plugins ?? <Plugin>[]; | 155 _userDefinedPlugins = plugins ?? <Plugin>[]; | 
| 156 } | 156 } | 
| 157 | 157 | 
| 158 @override | 158 @override | 
| 159 Future<Null> start(List<String> args) async { | 159 Future<Null> start(List<String> args) async { | 
| 160 if (_context != null) { | 160 if (_context != null) { | 
| 161 throw new StateError("start() can only be called once"); | 161 throw new StateError("start() can only be called once"); | 
| 162 } | 162 } | 
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 857 contextOptions.enableAssertInitializer = options.enableAssertInitializer; | 857 contextOptions.enableAssertInitializer = options.enableAssertInitializer; | 
| 858 } | 858 } | 
| 859 | 859 | 
| 860 _directoryToAnalysisOptions[contextRootDirectory] = contextOptions; | 860 _directoryToAnalysisOptions[contextRootDirectory] = contextOptions; | 
| 861 return contextOptions; | 861 return contextOptions; | 
| 862 } | 862 } | 
| 863 | 863 | 
| 864 static void setAnalysisContextOptions( | 864 static void setAnalysisContextOptions( | 
| 865 file_system.ResourceProvider resourceProvider, | 865 file_system.ResourceProvider resourceProvider, | 
| 866 AnalysisContext context, | 866 AnalysisContext context, | 
| 867 CommandLineOptions options, | 867 CommandLineOptions options) { | 
| 868 void configureContextOptions(AnalysisOptionsImpl contextOptions)) { | |
| 869 AnalysisOptionsImpl analysisOptions = | 868 AnalysisOptionsImpl analysisOptions = | 
| 870 createAnalysisOptionsForCommandLineOptions(resourceProvider, options); | 869 createAnalysisOptionsForCommandLineOptions(resourceProvider, options); | 
| 871 configureContextOptions(analysisOptions); | |
| 872 setupAnalysisContext(context, options, analysisOptions); | 870 setupAnalysisContext(context, options, analysisOptions); | 
| 873 } | 871 } | 
| 874 | 872 | 
| 875 static void setupAnalysisContext(AnalysisContext context, | 873 static void setupAnalysisContext(AnalysisContext context, | 
| 876 CommandLineOptions options, AnalysisOptionsImpl analysisOptions) { | 874 CommandLineOptions options, AnalysisOptionsImpl analysisOptions) { | 
| 877 Map<String, String> definedVariables = options.definedVariables; | 875 Map<String, String> definedVariables = options.definedVariables; | 
| 878 if (definedVariables.isNotEmpty) { | 876 if (definedVariables.isNotEmpty) { | 
| 879 DeclaredVariables declaredVariables = context.declaredVariables; | 877 DeclaredVariables declaredVariables = context.declaredVariables; | 
| 880 definedVariables.forEach((String variableName, String value) { | 878 definedVariables.forEach((String variableName, String value) { | 
| 881 declaredVariables.define(variableName, value); | 879 declaredVariables.define(variableName, value); | 
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1007 for (var package in packages) { | 1005 for (var package in packages) { | 
| 1008 var packageName = path.basename(package.path); | 1006 var packageName = path.basename(package.path); | 
| 1009 var realPath = package.resolveSymbolicLinksSync(); | 1007 var realPath = package.resolveSymbolicLinksSync(); | 
| 1010 result[packageName] = [ | 1008 result[packageName] = [ | 
| 1011 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 1009 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 
| 1012 ]; | 1010 ]; | 
| 1013 } | 1011 } | 
| 1014 return result; | 1012 return result; | 
| 1015 } | 1013 } | 
| 1016 } | 1014 } | 
| OLD | NEW |