Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: pkg/analyzer/tool/task_dependency_graph/generate.dart

Issue 1418573004: Add temporary code to debug windows bot failures. (Closed) Base URL: sso://user/paulberry/dart@investigate-codegen-error
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * This file contains code to output a description of tasks and their 6 * This file contains code to output a description of tasks and their
7 * dependencies in ".dot" format. Prior to running, the user should run "pub 7 * dependencies in ".dot" format. Prior to running, the user should run "pub
8 * get" in the analyzer directory to ensure that a "packages" folder exists. 8 * get" in the analyzer directory to ensure that a "packages" folder exists.
9 * 9 *
10 * TODO(paulberry): 10 * TODO(paulberry):
(...skipping 14 matching lines...) Expand all
25 import 'package:analyzer/file_system/physical_file_system.dart'; 25 import 'package:analyzer/file_system/physical_file_system.dart';
26 import 'package:analyzer/src/generated/constant.dart'; 26 import 'package:analyzer/src/generated/constant.dart';
27 import 'package:analyzer/src/generated/element.dart'; 27 import 'package:analyzer/src/generated/element.dart';
28 import 'package:analyzer/src/generated/engine.dart'; 28 import 'package:analyzer/src/generated/engine.dart';
29 import 'package:analyzer/src/generated/java_io.dart'; 29 import 'package:analyzer/src/generated/java_io.dart';
30 import 'package:analyzer/src/generated/sdk.dart'; 30 import 'package:analyzer/src/generated/sdk.dart';
31 import 'package:analyzer/src/generated/sdk_io.dart'; 31 import 'package:analyzer/src/generated/sdk_io.dart';
32 import 'package:analyzer/src/generated/source.dart'; 32 import 'package:analyzer/src/generated/source.dart';
33 import 'package:analyzer/src/generated/source_io.dart'; 33 import 'package:analyzer/src/generated/source_io.dart';
34 import 'package:path/path.dart' as path; 34 import 'package:path/path.dart' as path;
35 import 'dart:convert';
35 36
36 /** 37 /**
37 * Generate the target .dot file. 38 * Generate the target .dot file.
38 */ 39 */
39 main() { 40 main() {
40 new Driver().generateFile(); 41 new Driver().generateFile();
41 } 42 }
42 43
43 typedef void GetterFinderCallback(PropertyAccessorElement element); 44 typedef void GetterFinderCallback(PropertyAccessorElement element);
44 45
(...skipping 20 matching lines...) Expand all
65 66
66 /** 67 /**
67 * Determine if the output [file] contains the expected contents. 68 * Determine if the output [file] contains the expected contents.
68 */ 69 */
69 bool checkFile() { 70 bool checkFile() {
70 String expectedContents = generateFileContents(); 71 String expectedContents = generateFileContents();
71 String actualContents = file.readAsStringSync(); 72 String actualContents = file.readAsStringSync();
72 // Normalize Windows line endings to Unix line endings so that the 73 // Normalize Windows line endings to Unix line endings so that the
73 // comparison doesn't fail on Windows. 74 // comparison doesn't fail on Windows.
74 actualContents = actualContents.replaceAll('\r\n', '\n'); 75 actualContents = actualContents.replaceAll('\r\n', '\n');
76 if (expectedContents != actualContents) {
77 // Print additional information for debugging.
78 // TODO(paulberry): eliminate this when it is no longer needed.
79 print('expected: ${JSON.encode(expectedContents)}');
80 print('actual: ${JSON.encode(actualContents)}');
81 }
75 return expectedContents == actualContents; 82 return expectedContents == actualContents;
76 } 83 }
77 84
78 /** 85 /**
79 * Starting at [node], find all calls to registerExtension() which refer to 86 * Starting at [node], find all calls to registerExtension() which refer to
80 * the given [extensionIdVariable], and execute [callback] for the associated 87 * the given [extensionIdVariable], and execute [callback] for the associated
81 * result descriptors. 88 * result descriptors.
82 */ 89 */
83 void findExtensions(AstNode node, TopLevelVariableElement extensionIdVariable, 90 void findExtensions(AstNode node, TopLevelVariableElement extensionIdVariable,
84 void callback(descriptorName)) { 91 void callback(descriptorName)) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 String task = cls.name; 189 String task = cls.name;
183 AstNode buildInputsAst = cls.getMethod('buildInputs').computeNode(); 190 AstNode buildInputsAst = cls.getMethod('buildInputs').computeNode();
184 findResultDescriptors(buildInputsAst, (String input) { 191 findResultDescriptors(buildInputsAst, (String input) {
185 results.add(input); 192 results.add(input);
186 lines.add(' $input -> $task'); 193 lines.add(' $input -> $task');
187 }); 194 });
188 findResultDescriptorLists(buildInputsAst, (String input) { 195 findResultDescriptorLists(buildInputsAst, (String input) {
189 resultLists.add(input); 196 resultLists.add(input);
190 lines.add(' $input -> $task'); 197 lines.add(' $input -> $task');
191 }); 198 });
192 findResultDescriptors(cls.getField('DESCRIPTOR').computeNode(), (String out) { 199 findResultDescriptors(cls.getField('DESCRIPTOR').computeNode(),
200 (String out) {
193 results.add(out); 201 results.add(out);
194 lines.add(' $task -> $out'); 202 lines.add(' $task -> $out');
195 }); 203 });
196 } 204 }
197 } 205 }
198 AstNode enginePluginAst = enginePluginUnitElement.computeNode(); 206 AstNode enginePluginAst = enginePluginUnitElement.computeNode();
199 for (String resultList in resultLists) { 207 for (String resultList in resultLists) {
200 lines.add(' $resultList [shape=hexagon]'); 208 lines.add(' $resultList [shape=hexagon]');
201 TopLevelVariableElement extensionIdVariable = _getExtensionId(resultList); 209 TopLevelVariableElement extensionIdVariable = _getExtensionId(resultList);
202 findExtensions(enginePluginAst, extensionIdVariable, (String extension) { 210 findExtensions(enginePluginAst, extensionIdVariable, (String extension) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 @override 345 @override
338 visitIdentifier(Identifier node) { 346 visitIdentifier(Identifier node) {
339 Element element = node.staticElement; 347 Element element = node.staticElement;
340 if (element is PropertyAccessorElement && 348 if (element is PropertyAccessorElement &&
341 element.isGetter && 349 element.isGetter &&
342 element.returnType.isSubtypeOf(type)) { 350 element.returnType.isSubtypeOf(type)) {
343 callback(element); 351 callback(element);
344 } 352 }
345 } 353 }
346 } 354 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698