| OLD | NEW |
| 1 import 'dart:io' as io; | 1 import 'dart:io' as io; |
| 2 import 'dart:math' show min; | 2 import 'dart:math' show min; |
| 3 | 3 |
| 4 import 'package:analyzer/dart/element/element.dart'; | 4 import 'package:analyzer/dart/element/element.dart'; |
| 5 import 'package:analyzer/file_system/file_system.dart'; | 5 import 'package:analyzer/file_system/file_system.dart'; |
| 6 import 'package:analyzer/src/context/cache.dart'; | 6 import 'package:analyzer/src/context/cache.dart'; |
| 7 import 'package:analyzer/src/context/context.dart'; | 7 import 'package:analyzer/src/context/context.dart'; |
| 8 import 'package:analyzer/src/dart/element/element.dart'; | 8 import 'package:analyzer/src/dart/element/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 10 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 ConflictingSummaryException(Iterable<String> summaryPaths, this.duplicatedUri, | 33 ConflictingSummaryException(Iterable<String> summaryPaths, this.duplicatedUri, |
| 34 this.summary1Uri, this.summary2Uri) { | 34 this.summary1Uri, this.summary2Uri) { |
| 35 // Paths are often quite long. Find and extract out a common prefix to | 35 // Paths are often quite long. Find and extract out a common prefix to |
| 36 // build a more readable error message. | 36 // build a more readable error message. |
| 37 var prefix = _commonPrefix(summaryPaths.toList()); | 37 var prefix = _commonPrefix(summaryPaths.toList()); |
| 38 _message = ''' | 38 _message = ''' |
| 39 These summaries conflict because they overlap: | 39 These summaries conflict because they overlap: |
| 40 - ${summary1Uri.substring(prefix)} | 40 - ${summary1Uri.substring(prefix)} |
| 41 - ${summary2Uri.substring(prefix)} | 41 - ${summary2Uri.substring(prefix)} |
| 42 Both contain the file: ${duplicatedUri}. | 42 Both contain the file: $duplicatedUri. |
| 43 This typically indicates an invalid build rule where two or more targets | 43 This typically indicates an invalid build rule where two or more targets |
| 44 include the same source. | 44 include the same source. |
| 45 '''; | 45 '''; |
| 46 } | 46 } |
| 47 | 47 |
| 48 String toString() => _message; | 48 String toString() => _message; |
| 49 | 49 |
| 50 /// Given a set of file paths, find a common prefix. | 50 /// Given a set of file paths, find a common prefix. |
| 51 int _commonPrefix(List<String> strings) { | 51 int _commonPrefix(List<String> strings) { |
| 52 if (strings.isEmpty) return 0; | 52 if (strings.isEmpty) return 0; |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 var file = resourceProvider.getFile(path); | 525 var file = resourceProvider.getFile(path); |
| 526 buffer = file.readAsBytesSync(); | 526 buffer = file.readAsBytesSync(); |
| 527 } else { | 527 } else { |
| 528 io.File file = new io.File(path); | 528 io.File file = new io.File(path); |
| 529 buffer = file.readAsBytesSync(); | 529 buffer = file.readAsBytesSync(); |
| 530 } | 530 } |
| 531 PackageBundle bundle = new PackageBundle.fromBuffer(buffer); | 531 PackageBundle bundle = new PackageBundle.fromBuffer(buffer); |
| 532 addBundle(path, bundle); | 532 addBundle(path, bundle); |
| 533 } | 533 } |
| 534 } | 534 } |
| OLD | NEW |