From 5b5c701d84c02a76b1615e39010868a91cf207fc Mon Sep 17 00:00:00 2001 From: Seth Ladd Date: Thu, 7 Apr 2016 12:46:50 -0700 Subject: [PATCH] document libs from sky_services (#3170) * document libs from sky_services * scan directory of sky_services for libraries * simplify error message when sky_services directory not found * address review comments --- dev/dartdoc.dart | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dev/dartdoc.dart b/dev/dartdoc.dart index 54df99bf7c..2d31151379 100755 --- a/dev/dartdoc.dart +++ b/dev/dartdoc.dart @@ -56,12 +56,33 @@ dependencies: args.add(name.substring(0, name.length - 5)); } + _findSkyServicesLibraryNames().forEach((String libName) { + args.add('--include-external'); + args.add(libName); + }); + process = await Process.start('pub', args, workingDirectory: 'dev/docs'); _print(process.stdout); _print(process.stderr); exit(await process.exitCode); } +List _findSkyServicesLibraryNames() { + Directory skyServicesLocation = new Directory('bin/cache/pkg/sky_services/lib'); + if (!skyServicesLocation.existsSync()) { + throw 'Did not find sky_services package location in ' + '${skyServicesLocation.path}.'; + } + return skyServicesLocation.listSync(followLinks: false, recursive: true) + .where((FileSystemEntity entity) { + return entity is File && entity.path.endsWith('.mojom.dart'); + }).map((FileSystemEntity entity) { + String basename = _entityName(entity.path); + basename = basename.substring(0, basename.length-('.dart'.length)); + return basename.replaceAll('.', '_'); + }); +} + List _findPackageNames() { return _findPackages().map((Directory dir) => _entityName(dir.path)).toList(); } @@ -76,7 +97,6 @@ List _findPackages() { return !nodoc; }) .toList(); - } List _libraryRefs() sync* {