| 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 library dev_compiler.test.dependency_graph_test; | 5 library dev_compiler.test.dependency_graph_test; |
| 6 | 6 |
| 7 import 'package:analyzer/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
| 8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 expectGraph(SourceNode node, String expectation) { | 1130 expectGraph(SourceNode node, String expectation) { |
| 1131 expect(printReachable(node), equalsIgnoringWhitespace(expectation)); | 1131 expect(printReachable(node), equalsIgnoringWhitespace(expectation)); |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 nameFor(SourceNode node) => path.basename(node.uri.path); | 1134 nameFor(SourceNode node) => path.basename(node.uri.path); |
| 1135 printReachable(SourceNode node) { | 1135 printReachable(SourceNode node) { |
| 1136 var seen = new Set(); | 1136 var seen = new Set(); |
| 1137 var sb = new StringBuffer(); | 1137 var sb = new StringBuffer(); |
| 1138 helper(n, {indent: 0}) { | 1138 helper(n, {indent: 0}) { |
| 1139 if (indent > 0) { | 1139 if (indent > 0) { |
| 1140 sb | 1140 sb..write("| " * (indent - 1))..write("|-- "); |
| 1141 ..write("| " * (indent - 1)) | |
| 1142 ..write("|-- "); | |
| 1143 } | 1141 } |
| 1144 sb.write(nameFor(n)); | 1142 sb.write(nameFor(n)); |
| 1145 if (seen.contains(n)) { | 1143 if (seen.contains(n)) { |
| 1146 sb.write('...\n'); | 1144 sb.write('...\n'); |
| 1147 return; | 1145 return; |
| 1148 } | 1146 } |
| 1149 seen.add(n); | 1147 seen.add(n); |
| 1150 sb | 1148 sb |
| 1151 ..write(' ') | 1149 ..write(' ') |
| 1152 ..write(n.needsRebuild ? '[needs-rebuild] ' : '') | 1150 ..write(n.needsRebuild ? '[needs-rebuild] ' : '') |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1169 helper(node); | 1167 helper(node); |
| 1170 return sb.toString(); | 1168 return sb.toString(); |
| 1171 } | 1169 } |
| 1172 | 1170 |
| 1173 final runtimeFilesWithoutPath = defaultRuntimeFiles | 1171 final runtimeFilesWithoutPath = defaultRuntimeFiles |
| 1174 .map((f) => f.replaceAll('dart/', '')) | 1172 .map((f) => f.replaceAll('dart/', '')) |
| 1175 .toList(growable: false); | 1173 .toList(growable: false); |
| 1176 final _RUNTIME_GRAPH = runtimeFilesWithoutPath.map((s) => '|-- $s').join('\n'); | 1174 final _RUNTIME_GRAPH = runtimeFilesWithoutPath.map((s) => '|-- $s').join('\n'); |
| 1177 final _RUNTIME_GRAPH_REBUILD = | 1175 final _RUNTIME_GRAPH_REBUILD = |
| 1178 runtimeFilesWithoutPath.map((s) => '|-- $s [needs-rebuild]').join('\n'); | 1176 runtimeFilesWithoutPath.map((s) => '|-- $s [needs-rebuild]').join('\n'); |
| OLD | NEW |