Skip to content

Commit

Permalink
added a warning if no package root is passed in for a single file.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
janicejl committed Jul 30, 2013
1 parent e54e94e commit b734eed
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkg/docgen/lib/docgen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
Expand All @@ -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]);
Expand Down

0 comments on commit b734eed

Please sign in to comment.