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

Unified Diff: pkg/docgen/lib/docgen.dart

Issue 22835007: parts of (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/docgen.dart
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index 554932411b9075f5d58a01c1cef251eee1a27960..a6d67ab171e5db452b6e55d9b536b9a1b2b6a587 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -113,8 +113,10 @@ List<String> _listLibraries(List<String> args) {
var type = FileSystemEntity.typeSync(args[0]);
if (type == FileSystemEntityType.FILE) {
- libraries.add(path.absolute(args[0]));
- logger.info('Added to libraries: ${libraries.last}');
+ if (args[0].endsWith('.dart')) {
+ libraries.add(path.absolute(args[0]));
+ logger.info('Added to libraries: ${libraries.last}');
+ }
} else {
libraries.addAll(_listDartFromDir(args[0]));
}
@@ -122,14 +124,25 @@ List<String> _listLibraries(List<String> args) {
}
List<String> _listDartFromDir(String args) {
- var files = listDir(args, recursive: true);
+ var libraries = [];
// To avoid anaylzing package files twice, only files with paths not
// containing '/packages' will be added. The only exception is if the file to
// analyze already has a '/package' in its path.
- return files.where((f) => f.endsWith('.dart') &&
+ var files = listDir(args, recursive: true).where((f) => f.endsWith('.dart') &&
(!f.contains('${path.separator}packages') ||
- args.contains('${path.separator}packages'))).toList()
- ..forEach((lib) => logger.info('Added to libraries: $lib'));
+ args.contains('${path.separator}packages'))).toList();
+
+ files.forEach((f) {
+ // Only add the file if it does not contain 'part of'
+ // TODO(janicejl): Remove when Issue(12406) is resolved.
+ var contents = new File(f).readAsStringSync();
+ if (!(contents.contains(new RegExp('\npart of ')) ||
+ contents.startsWith(new RegExp('part of ')))) {
+ libraries.add(f);
+ logger.info('Added to libraries: $f');
+ }
+ });
+ return libraries;
}
String _findPackageRoot(String directory) {
« 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