Skip to content

Commit b734eed

Browse files
committed
added a warning if no package root is passed in for a single file.
R=rnystrom@google.com Review URL: https://codereview.chromium.org//21131009 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25629 260f80e4-7a28-3924-810f-c04153c831b5
1 parent e54e94e commit b734eed

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

pkg/docgen/lib/docgen.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,12 @@ Future<bool> docgen(List<String> files, {String packageRoot,
7474
}
7575

7676
if (packageRoot == null && !parseSdk) {
77-
// TODO(janicejl): At the moment, if a single file is passed it, it is
78-
// assumed that it does not have a package root unless it is passed in by
79-
// the user. In future, find a better way to find the packageRoot and also
80-
// fully test finding the packageRoot.
81-
if (FileSystemEntity.typeSync(files.first)
82-
== FileSystemEntityType.DIRECTORY) {
77+
var type = FileSystemEntity.typeSync(files.first);
78+
if (type == FileSystemEntityType.DIRECTORY) {
8379
packageRoot = _findPackageRoot(files.first);
80+
} else if (type == FileSystemEntityType.FILE) {
81+
logger.warning('WARNING: No package root defined. If Docgen fails, try '
82+
'again by setting the --package-root option.');
8483
}
8584
}
8685
logger.info('Package Root: ${packageRoot}');
@@ -102,9 +101,6 @@ Future<bool> docgen(List<String> files, {String packageRoot,
102101
}
103102

104103
List<String> _listLibraries(List<String> args) {
105-
// TODO(janicejl): At the moment, only have support to have either one file,
106-
// or one directory. This is because there can only be one package directory
107-
// since only one docgen is created per run.
108104
if (args.length != 1) throw new UnsupportedError(USAGE);
109105
var libraries = new List<String>();
110106
var type = FileSystemEntity.typeSync(args[0]);

0 commit comments

Comments
 (0)