Unverified Commit 6ca8fda9 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

After cleaning up 812 warnings: Make warnings fatal in dartdocs (#62553)

parent 48fab86c
...@@ -13,24 +13,23 @@ dartdoc: ...@@ -13,24 +13,23 @@ dartdoc:
command: ["dev/snippets/lib/main.dart", "--type=sample", "--dartpad"] command: ["dev/snippets/lib/main.dart", "--type=sample", "--dartpad"]
description: "Creates full application sample code documentation output from embedded documentation samples and displays it in an embedded DartPad." description: "Creates full application sample code documentation output from embedded documentation samples and displays it in an embedded DartPad."
errors: errors:
# The following are always errors: # Default errors of dartdoc:
- duplicate-file - duplicate-file
- invalid-parameter - invalid-parameter
- tool-error - tool-error
- unresolved-export - unresolved-export
# The following are elevated from warnings because we currently don't # Warnings that are elevated to errors:
# fail on warnings:
- ambiguous-doc-reference - ambiguous-doc-reference
- ambiguous-reexport - ambiguous-reexport
- broken-link
- category-order-gives-missing-package-name
- ignored-canonical-for - ignored-canonical-for
- missing-from-search-index
- no-canonical-found - no-canonical-found
- not-implemented
- no-library-level-docs - no-library-level-docs
- category-order-gives-missing-package-name - not-implemented
- reexported-private-api-across-packages - reexported-private-api-across-packages
# - unresolved-doc-reference # Too many failures, needs clean-up
- broken-link
- unknown-macro - unknown-macro
- orphaned-file
- unknown-file - unknown-file
- missing-from-search-index - unresolved-doc-reference
- orphaned-file
...@@ -17,6 +17,9 @@ const String kDocsRoot = 'dev/docs'; ...@@ -17,6 +17,9 @@ const String kDocsRoot = 'dev/docs';
const String kPublishRoot = '$kDocsRoot/doc'; const String kPublishRoot = '$kDocsRoot/doc';
const String kSnippetsRoot = 'dev/snippets'; const String kSnippetsRoot = 'dev/snippets';
const String kDummyPackageName = 'Flutter';
const String kPlatformIntegrationPackageName = 'platform_integration';
/// This script expects to run with the cwd as the root of the flutter repo. It /// This script expects to run with the cwd as the root of the flutter repo. It
/// will generate documentation for the packages in `//packages/` and write the /// will generate documentation for the packages in `//packages/` and write the
/// documentation to `//dev/docs/doc/api/`. /// documentation to `//dev/docs/doc/api/`.
...@@ -50,7 +53,7 @@ Future<void> main(List<String> arguments) async { ...@@ -50,7 +53,7 @@ Future<void> main(List<String> arguments) async {
// Create the pubspec.yaml file. // Create the pubspec.yaml file.
final StringBuffer buf = StringBuffer(); final StringBuffer buf = StringBuffer();
buf.writeln('name: Flutter'); buf.writeln('name: $kDummyPackageName');
buf.writeln('homepage: https://flutter.dev'); buf.writeln('homepage: https://flutter.dev');
// TODO(dnfield): Re-factor for proper versioning, https://github.com/flutter/flutter/issues/55409 // TODO(dnfield): Re-factor for proper versioning, https://github.com/flutter/flutter/issues/55409
buf.writeln('version: 0.0.0'); buf.writeln('version: 0.0.0');
...@@ -59,10 +62,10 @@ Future<void> main(List<String> arguments) async { ...@@ -59,10 +62,10 @@ Future<void> main(List<String> arguments) async {
buf.writeln(' $package:'); buf.writeln(' $package:');
buf.writeln(' sdk: flutter'); buf.writeln(' sdk: flutter');
} }
buf.writeln(' platform_integration: 0.0.1'); buf.writeln(' $kPlatformIntegrationPackageName: 0.0.1');
buf.writeln('dependency_overrides:'); buf.writeln('dependency_overrides:');
buf.writeln(' platform_integration:'); buf.writeln(' $kPlatformIntegrationPackageName:');
buf.writeln(' path: platform_integration'); buf.writeln(' path: $kPlatformIntegrationPackageName');
File('$kDocsRoot/pubspec.yaml').writeAsStringSync(buf.toString()); File('$kDocsRoot/pubspec.yaml').writeAsStringSync(buf.toString());
// Create the library file. // Create the library file.
...@@ -122,6 +125,17 @@ Future<void> main(List<String> arguments) async { ...@@ -122,6 +125,17 @@ Future<void> main(List<String> arguments) async {
); );
print('\n${result.stdout}flutter version: $version\n'); print('\n${result.stdout}flutter version: $version\n');
// Dartdoc warnings and errors in these packages are considered fatal.
// All packages owned by flutter should be in the list.
// TODO(goderbauer): Figure out how to add 'dart:ui'.
final List<String> flutterPackages = <String>[
kDummyPackageName,
kPlatformIntegrationPackageName,
...findPackageNames(),
]..remove('flutter_test');
// TODO(goderbauer): Enable flutter_test when engine is rolled to include
// https://github.com/flutter/engine/pull/20140.
// Generate the documentation. // Generate the documentation.
// We don't need to exclude flutter_tools in this list because it's not in the // We don't need to exclude flutter_tools in this list because it's not in the
// recursive dependencies of the package defined at dev/docs/pubspec.yaml // recursive dependencies of the package defined at dev/docs/pubspec.yaml
...@@ -142,10 +156,7 @@ Future<void> main(List<String> arguments) async { ...@@ -142,10 +156,7 @@ Future<void> main(List<String> arguments) async {
'--header', 'snippets.html', '--header', 'snippets.html',
'--header', 'opensearch.html', '--header', 'opensearch.html',
'--footer-text', 'lib/footer.html', '--footer-text', 'lib/footer.html',
'--allow-warnings-in-packages', '--allow-warnings-in-packages', flutterPackages.join(','),
<String>[
'flutter',
].join(','),
'--exclude-packages', '--exclude-packages',
<String>[ <String>[
'analyzer', 'analyzer',
...@@ -189,7 +200,7 @@ Future<void> main(List<String> arguments) async { ...@@ -189,7 +200,7 @@ Future<void> main(List<String> arguments) async {
'package:web_socket_channel/html.dart', 'package:web_socket_channel/html.dart',
].join(','), ].join(','),
'--favicon=favicon.ico', '--favicon=favicon.ico',
'--package-order', 'flutter,Dart,platform_integration,flutter_test,flutter_driver', '--package-order', 'flutter,Dart,$kPlatformIntegrationPackageName,flutter_test,flutter_driver',
'--auto-include-dependencies', '--auto-include-dependencies',
]; ];
...@@ -477,8 +488,8 @@ Iterable<String> libraryRefs() sync* { ...@@ -477,8 +488,8 @@ Iterable<String> libraryRefs() sync* {
} }
// Add a fake package for platform integration APIs. // Add a fake package for platform integration APIs.
yield 'platform_integration/android.dart'; yield '$kPlatformIntegrationPackageName/android.dart';
yield 'platform_integration/ios.dart'; yield '$kPlatformIntegrationPackageName/ios.dart';
} }
void printStream(Stream<List<int>> stream, { String prefix = '', List<Pattern> filter = const <Pattern>[] }) { void printStream(Stream<List<int>> stream, { String prefix = '', List<Pattern> filter = const <Pattern>[] }) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment