Analyze doc code snippets for all packages for which we publish docs (#132607)
Fixes TODO in the analyzer script :)
This commit is contained in:
committed by
GitHub
parent
e52e8da303
commit
14f9ed28d0
@@ -61,6 +61,11 @@
|
||||
// contains no explicit imports, the snippets will implicitly import all the
|
||||
// main Flutter packages (including material and flutter_test), as well as most
|
||||
// core Dart packages with the usual prefixes.
|
||||
//
|
||||
// When invoked without an additional path argument, the script will analyze
|
||||
// the code snippets for all packages in the "packages" subdirectory that do
|
||||
// not specify "nodoc: true" in their pubspec.yaml (i.e. all packages for which
|
||||
// we publish docs will have their doc code snippets analyzed).
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
@@ -73,9 +78,6 @@ import 'package:watcher/watcher.dart';
|
||||
|
||||
final String _flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
|
||||
final String _packageFlutter = path.join(_flutterRoot, 'packages', 'flutter', 'lib');
|
||||
final String _packageFlutterTest = path.join(_flutterRoot, 'packages', 'flutter_test', 'lib');
|
||||
final String _packageFlutterDriver = path.join(_flutterRoot, 'packages', 'flutter_driver', 'lib');
|
||||
final String _packageIntegrationTest = path.join(_flutterRoot, 'packages', 'integration_test', 'lib');
|
||||
final String _defaultDartUiLocation = path.join(_flutterRoot, 'bin', 'cache', 'pkg', 'sky_engine', 'lib', 'ui');
|
||||
final String _flutter = path.join(_flutterRoot, 'bin', Platform.isWindows ? 'flutter.bat' : 'flutter');
|
||||
|
||||
@@ -147,18 +149,28 @@ Future<void> main(List<String> arguments) async {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
List<Directory> flutterPackages;
|
||||
final List<Directory> flutterPackages;
|
||||
if (parsedArguments.rest.length == 1) {
|
||||
// Used for testing.
|
||||
flutterPackages = <Directory>[Directory(parsedArguments.rest.single)];
|
||||
} else {
|
||||
flutterPackages = <Directory>[
|
||||
Directory(_packageFlutter),
|
||||
Directory(_packageFlutterTest),
|
||||
Directory(_packageIntegrationTest),
|
||||
Directory(_packageFlutterDriver),
|
||||
// TODO(goderbauer): Add all other packages for which we publish docs.
|
||||
];
|
||||
// By default analyze snippets in all packages in the packages subdirectory
|
||||
// that do not specify "nodoc: true" in their pubspec.yaml.
|
||||
flutterPackages = <Directory>[];
|
||||
final String packagesRoot = path.join(_flutterRoot, 'packages');
|
||||
for (final FileSystemEntity entity in Directory(packagesRoot).listSync()) {
|
||||
if (entity is! Directory) {
|
||||
continue;
|
||||
}
|
||||
final File pubspec = File(path.join(entity.path, 'pubspec.yaml'));
|
||||
if (!pubspec.existsSync()) {
|
||||
throw StateError("Unexpected package '${entity.path}' found in packages directory");
|
||||
}
|
||||
if (!pubspec.readAsStringSync().contains('nodoc: true')) {
|
||||
flutterPackages.add(Directory(path.join(entity.path, 'lib')));
|
||||
}
|
||||
}
|
||||
assert(flutterPackages.length >= 4);
|
||||
}
|
||||
|
||||
final bool includeDartUi = parsedArguments.wasParsed('dart-ui-location') || parsedArguments['include-dart-ui'] as bool;
|
||||
|
||||
Reference in New Issue
Block a user