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

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

Issue 571713002: pkg/docgen: include all package libraries under lib/, except those under lib/src (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | pkg/docgen/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/src/generator.dart
diff --git a/pkg/docgen/lib/src/generator.dart b/pkg/docgen/lib/src/generator.dart
index 1258d20b1ce12dc5ad08fbc01d1ce6a4aa423f65..4d54585a059dc9c4d6fcb10fa770a73e7098f8f4 100644
--- a/pkg/docgen/lib/src/generator.dart
+++ b/pkg/docgen/lib/src/generator.dart
@@ -338,25 +338,34 @@ List<Uri> _findLibrariesToDocument(List<String> args, bool
/// Given a package name, explore the directory and pull out all top level
/// library files in the "lib" directory to document.
-List<Uri> _findFilesToDocumentInPackage(String packageName) {
+List<Uri> _findFilesToDocumentInPackage(String packageDir) {
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.
- var files = listDir(packageName, recursive: true, listDir: _packageDirList)
+ var files = listDir(packageDir, recursive: true, listDir: _packageDirList)
.where((f) => f.endsWith('.dart') &&
(!f.contains('${path.separator}packages') ||
- packageName.contains('${path.separator}packages')))
+ packageDir.contains('${path.separator}packages')))
.toList();
+ var packageLibDir = path.join(packageDir, 'lib');
+ var packageLibSrcDir = path.join(packageLibDir, 'src');
+
files.forEach((String lib) {
- // Only include libraries at the top level of "lib"
- if (path.basename(path.dirname(lib)) == 'lib') {
+ // Only include libraries within the lib dir that are not in lib/src
+ if (path.isWithin(packageLibDir, lib) &&
+ !path.isWithin(packageLibSrcDir, lib)) {
// Only add the file if it does not contain 'part of'
// TODO(janicejl): Remove when Issue(12406) is resolved.
var contents = new File(lib).readAsStringSync();
- if (!(contents.contains(new RegExp('\npart of ')) ||
- contents.startsWith(new RegExp('part of ')))) {
+
+
+ if (contents.contains(new RegExp('\npart of ')) ||
+ contents.startsWith(new RegExp('part of '))) {
+ logger.warning('Skipping part "$lib". '
+ 'Part files should be in "lib/src".');
+ } else {
libraries.add(new Uri.file(path.normalize(path.absolute(lib))));
logger.info('Added to libraries: $lib');
}
« no previous file with comments | « no previous file | pkg/docgen/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698