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

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

Issue 21131009: added a warning if no package root is passed in for a single file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 778111a4f0c46110be7c8bdc06e6e8d8f74b4e07..2844d28f92ecd37d860b57d13771e9739cde1f04 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -74,13 +74,12 @@ Future<bool> docgen(List<String> files, {String packageRoot,
}
if (packageRoot == null && !parseSdk) {
- // TODO(janicejl): At the moment, if a single file is passed it, it is
- // assumed that it does not have a package root unless it is passed in by
- // the user. In future, find a better way to find the packageRoot and also
- // fully test finding the packageRoot.
- if (FileSystemEntity.typeSync(files.first)
- == FileSystemEntityType.DIRECTORY) {
+ var type = FileSystemEntity.typeSync(files.first);
+ if (type == FileSystemEntityType.DIRECTORY) {
packageRoot = _findPackageRoot(files.first);
+ } else if (type == FileSystemEntityType.FILE) {
+ logger.warning('WARNING: No package root defined. If Docgen fails, try '
+ 'again by setting the --package-root option.');
}
}
logger.info('Package Root: ${packageRoot}');
@@ -102,9 +101,6 @@ Future<bool> docgen(List<String> files, {String packageRoot,
}
List<String> _listLibraries(List<String> args) {
- // TODO(janicejl): At the moment, only have support to have either one file,
- // or one directory. This is because there can only be one package directory
- // since only one docgen is created per run.
if (args.length != 1) throw new UnsupportedError(USAGE);
var libraries = new List<String>();
var type = FileSystemEntity.typeSync(args[0]);
« 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