mirror of
https://github.com/flutter/packages.git
synced 2025-05-29 03:49:02 +08:00
[flutter_plugin_tools] Reimplements the excerpt system inline in the tool, rather than relying on a separate package. (#4417)
* Allows excerpts to come from any package, not just examples. * Fixes a bug in the excerpting logic that was causing a stray `}` to appear in one example. * Removes the need for `build.excerpt.yaml` files. * Remove the dependency on build_runner for excerpts. * Reduces the time to generate the excerpts from about 10 minutes to about 5 seconds. * Almost certainly fixes https://github.com/flutter/flutter/issues/107180 (untested). The new logic is not quite backwards compatible; the `path-base` feature now specifies a real path to the actual source directories, rather than a path into the invisible generated `excerpts/` directory with its special structure. Also, a number of features from the previous package that were not actually used in this repository are no longer supported (such as having multiple section names per `#docregion` pragma).
This commit is contained in:
@ -648,7 +648,6 @@ A B C
|
||||
final RepositoryPackage package = createFakePackage(
|
||||
'a_package',
|
||||
packagesDir,
|
||||
extraFiles: <String>[kReadmeExcerptConfigPath],
|
||||
);
|
||||
|
||||
package.readmeFile.writeAsStringSync('''
|
||||
@ -672,40 +671,6 @@ A B C
|
||||
);
|
||||
});
|
||||
|
||||
test('fails when excerpts are used but the package is not configured',
|
||||
() async {
|
||||
final RepositoryPackage package =
|
||||
createFakePackage('a_package', packagesDir);
|
||||
|
||||
package.readmeFile.writeAsStringSync('''
|
||||
Example:
|
||||
|
||||
<?code-excerpt "main.dart (SomeSection)"?>
|
||||
```dart
|
||||
A B C
|
||||
```
|
||||
''');
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['readme-check', '--require-excerpts'],
|
||||
errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('code-excerpt tag found, but the package is not configured '
|
||||
'for excerpting. Follow the instructions at\n'
|
||||
'https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages\n'
|
||||
'for setting up a build.excerpt.yaml file.'),
|
||||
contains('Missing code-excerpt configuration'),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test('fails on missing excerpt tag when requested', () async {
|
||||
final RepositoryPackage package =
|
||||
createFakePackage('a_package', packagesDir);
|
||||
|
Reference in New Issue
Block a user