Commit ba918fea authored by Hixie's avatar Hixie

flutter analyze: handle missing files

parent b18047bf
...@@ -361,6 +361,7 @@ linter: ...@@ -361,6 +361,7 @@ linter:
RegExp constructorTearOffsPattern = new RegExp('.+#.+// analyzer doesn\'t like constructor tear-offs'); RegExp constructorTearOffsPattern = new RegExp('.+#.+// analyzer doesn\'t like constructor tear-offs');
RegExp ignorePattern = new RegExp(r'// analyzer says "([^"]+)"'); RegExp ignorePattern = new RegExp(r'// analyzer says "([^"]+)"');
RegExp conflictingNamesPattern = new RegExp('^The imported libraries \'([^\']+)\' and \'([^\']+)\' cannot have the same name \'([^\']+)\'\$'); RegExp conflictingNamesPattern = new RegExp('^The imported libraries \'([^\']+)\' and \'([^\']+)\' cannot have the same name \'([^\']+)\'\$');
RegExp missingFilePattern = new RegExp('^Target of URI does not exist: \'([^\')]+)\'\$');
Set<String> changedFiles = new Set<String>(); // files about which we've complained that they changed Set<String> changedFiles = new Set<String>(); // files about which we've complained that they changed
...@@ -393,8 +394,11 @@ linter: ...@@ -393,8 +394,11 @@ linter:
bool shouldIgnore = false; bool shouldIgnore = false;
if (filename == mainFile.path) { if (filename == mainFile.path) {
Match libs = conflictingNamesPattern.firstMatch(errorMessage); Match libs = conflictingNamesPattern.firstMatch(errorMessage);
Match missing = missingFilePattern.firstMatch(errorMessage);
if (libs != null) { if (libs != null) {
errorLine = '[$level] $errorMessage (${dartFiles[lineNumber-1]})'; // strip the reference to the generated main.dart errorLine = '[$level] $errorMessage (${dartFiles[lineNumber-1]})'; // strip the reference to the generated main.dart
} else if (missing != null) {
errorLine = '[$level] File does not exist (${missing[1]})';
} else { } else {
errorLine += ' (Please file a bug on the "flutter analyze" command saying that you saw this message.)'; errorLine += ' (Please file a bug on the "flutter analyze" command saying that you saw this message.)';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment