Skip to content

Update validate-sdk-docs task to allow 20 libs #3404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1276,37 +1276,38 @@ Future<void> testDartdocFlutterPlugin() async {
@Depends(buildSdkDocs)
void validateSdkDocs() {
const expectedLibCounts = 0;
const expectedSubLibCount = {18, 19};
const expectedTotalCount = {18, 19};
const expectedSubLibCount = {18, 19, 20};
const expectedTotalCount = {18, 19, 20};
var indexHtml = joinFile(_sdkDocsDir, ['index.html']);
if (!indexHtml.existsSync()) {
fail('no index.html found for SDK docs');
fail("No 'index.html' found for the SDK docs");
}
log('found index.html');
log("Found 'index.html'");
var indexContents = indexHtml.readAsStringSync();
var foundLibs = _findCount(indexContents, ' <li><a href="dart-');
if (expectedLibCounts != foundLibs) {
fail('expected $expectedLibCounts "dart:" index.html entries, found '
'$foundLibs');
fail("Expected $expectedLibCounts 'dart:' entries in 'index.html', but "
'found $foundLibs');
}
log('$foundLibs index.html dart: entries found');
log("Found $foundLibs 'dart:' entries in 'index.html'");

var foundSubLibs =
_findCount(indexContents, '<li class="section-subitem"><a href="dart-');
if (!expectedSubLibCount.contains(foundSubLibs)) {
fail('expected $expectedSubLibCount "dart:" index.html entries in '
'categories, found $foundSubLibs');
fail("Expected $expectedSubLibCount 'dart:' entries in 'index.html' to be "
'in categories, but found $foundSubLibs');
}
log('$foundSubLibs index.html dart: entries in categories found');

// check for the existence of certain files/dirs
var libsLength =
_sdkDocsDir.listSync().where((fs) => fs.path.contains('dart-')).length;
if (!expectedTotalCount.contains(libsLength)) {
fail('docs not generated for all the SDK libraries, '
'expected $expectedTotalCount directories, generated $libsLength directories');
fail('Docs not generated for all the SDK libraries; expected '
'$expectedTotalCount directories, but $libsLength directories were '
'generated');
}
log('$libsLength dart: libraries found');
log("Found $libsLength 'dart:' libraries");

var futureConstFile =
joinFile(_sdkDocsDir, [p.join('dart-async', 'Future', 'Future.html')]);
Expand Down