Fix is in the second commit. The logic here went out of sync with the logic in the snippets generator from https://github.com/flutter/assets-for-api-docs, whose version was bumped as part of this change.
Reverts flutter/flutter#144329
Initiated by: goderbauer
Reason for reverting: broke postsubmit doc generation.
Original PR Author: goderbauer
Reviewed By: {devoncarew, HansMuller, gspencergoog}
This change reverts the following previous change:
Original Description:
Dartpad doesn't have a "master" channel anymore, it got renamed to "main". Sadly, specifying "master" is now falling back to "stable" which breaks some of our examples in the docs that require a more current Flutter version, e.g. https://main-api.flutter.dev/flutter/material/TextButton-class.html
Dartpad doesn't have a "master" channel anymore, it got renamed to "main". Sadly, specifying "master" is now falling back to "stable" which breaks some of our examples in the docs that require a more current Flutter version, e.g. https://main-api.flutter.dev/flutter/material/TextButton-class.html
These warnings/errors have been removed from dartdoc. Removing them from the flutter config as well.
Also fixes CI to actually test doc generation for all documented packages and on dartdoc config changes.
## Description
This re-lands #132353 with some additional options for keeping around the staging directory, so that the recipe for publishing docs can give those options and have the staging directory left around for deploying to the website.
Reverted in #132613
## Related Issues
- https://flutter-review.googlesource.com/c/recipes/+/49580
## Description
This cleans up a lot of issues with the API doc generation.
Here are the main changes:
- Rename `dartdoc.dart` to `create_api_docs.dart`
- Move the bulk of the operations out of `dev/bots/docs.sh` into `create_api_docs.dart`.
- Delete `dashing_postprocess.dart` and `java_and_objc.dart` and incorporate those operations into `create_api_docs.dart`.
- Refactor the doc generation into more understandable classes
- Bump the snippets tool version to 0.4.0 (the latest one)
- Centralize the information gathering about the Flutter repo into the new `FlutterInformation` class.
- Clean up the directory handling, and convert to using the `file` package for all file and directory paths.
- Add an `--output` option to docs.sh that specifies the location of the output ZIP file containing the docs.
- Defaults to placing the output in `dev/docs/api_docs.zip` (i.e. where the previous code generates the file).
- Moved all document generation into a temporary folder that is removed once the documents are generated, to avoid VSCode and other IDEs trying to index the thousands of HTML and JS files in the docs output.
- Updated pubspec dependencies.
## Tests
- Added tests for doc generation.
This PR updates the dartdoc version to v6.2.2.
Release notes: https://github.com/dart-lang/dartdoc/releases/tag/v6.2.2
The main impact for Flutter is to update dartdoc to add chips to class and/or mixin pages for class modifiers. See dart-lang/dartdoc#3391, dart-lang/dartdoc#3402. This will also be a cherry-pick candidate for 3.1 if it can land in time.
- [ test-exempt ] I added new tests to check the change I am making, or this PR is [test-exempt].
This fixes an issue with the Dart Head-Head-Head CI bot, where it was seeing failures because of concurrent execution of the snippets tool.
It adds a single run of the snippets tool right after activation to force the compiling of the package executable, which is what has trouble with concurrent invocation.
This is a temporary measure until dart pub global run is fixed.
This does a cleanup of the examples, removing all of the "section" markers and extra comments that we don't need anymore now that the samples are no longer in the source code. It also removes the --template arguments from the {@tool dartpad} and {@tool sample} directives, since those are no longer used. It converts two examples that I discovered were still embedded into linked examples in the examples folder.
I didn't delete the templates from the snippets config folder yet, because there are still embedded samples in the dart:ui package from the engine that use them. Once dart:ui no longer uses the templates, they can be removed.
I bumped the version of the snippets package to pick up a change that allows removal of the --template argument.
Switch document generation to use the snippets package instead of the snippets code in the Flutter repo. In the process, some bugs in sample code analysis have been fixed, and I've fixed some more errors in the samples.
This will allow the snippets package to be developed separately from the Flutter repo, and reduce the code in the Flutter repo.
The snippets code is deleted in this PR.
I also converted some comments in the snippet templates to be regular comments instead of doc comments, because having a doc comment block before the imports causes the Dart import sorter to lose the comment. They should have been regular comments in the first place.
The snippets package resides in the assets-for-api-docs repo.
The sample analysis has also been converted to be run in parallel, and I've bumped the Dartdoc version to 1.0.2.
This includes some major internal changes that should improve performance (the AOT template compiler) and the new lookup code. The big changes noticeable for Flutter will be resolution of field formal parameters, extension method support, and more consistent disambiguation in comment reference lookups.
While a vast net improvement, this PR will change a few links to point to the wrong place. #85484 will address that after this lands, as there was no good way to specify what the user wanted unambiguously before dartdoc 1.0.0 in a few cases. That PR includes more details on the introduced regressions and link changes.