Chromium Code Reviews| Index: utils/testrunner/utils.dart |
| =================================================================== |
| --- utils/testrunner/utils.dart (revision 13447) |
| +++ utils/testrunner/utils.dart (working copy) |
| @@ -39,14 +39,29 @@ |
| * Create the list of all the files in a set of directories |
| * ([dirs]) whose names match [filePat]. If [recurse] is true |
| * look at subdirectories too. Once they have all been enumerated, |
| - * call [onComplete]. |
| + * call [onComplete]. An optional [excludePat] can be supplied |
| + * and files or directories that match that will be excluded. |
| + * If [symLinks] is false, symlinks will be excluded. |
|
Siggi Cherem (dart-lang)
2012/10/10 17:51:32
I rather name the variable 'includeSymLinks' and r
gram
2012/10/17 00:03:28
Done.
|
| */ |
| + // TODO(gram): The key thing here is we want to avoid package |
| + // directories, which have symlinks. excludePat was added for |
| + // that but can't currently be used because the symlinked files |
| + // have canonicalized paths. So instead we exploit that fact and |
| + // assert that every file must have a prefix that matches the |
| + // directory. If this changes then we will need to switch to using |
| + // the exclude pattern or some other mechanism. |
| + // |
| + |
| void buildFileList(List dirs, RegExp filePat, bool recurse, |
| - Function onComplete) { |
| + Function onComplete, |
| + [RegExp excludePat, bool symLinks = false]) { |
| var files = new List(); |
| var dirCount = 1; |
| for (var i = 0; i < dirs.length; i++) { |
| var path = dirs[i]; |
| + if (excludePat != null && excludePat.hasMatch(path)) { |
| + continue; |
| + } |
| // Is this a regular file? |
| File f = new File(path); |
| if (f.existsSync()) { |
| @@ -54,13 +69,18 @@ |
| files.add(path); |
| } |
| } else { // Try treat it as a directory. |
| + path = makePathAbsolute(path); |
| Directory d = new Directory(path); |
| if (d.existsSync()) { |
| ++dirCount; |
| var lister = d.list(recursive: recurse); |
| lister.onFile = (file) { |
| if (filePat.hasMatch(file)) { |
| - files.add(file); |
| + if (excludePat == null || !excludePat.hasMatch(file)) { |
| + if (symLinks || file.startsWith(path)) { |
| + files.add(file); |
| + } |
| + } |
| } |
| }; |
| lister.onDone = (complete) { |