@@ -959,24 +959,27 @@ Future<void> testDartdocFlutterPlugin() async {
959959@Task ('Validate the SDK doc build.' )
960960@Depends (buildSdkDocs)
961961void validateSdkDocs () {
962- const expectedLibCount = 0 ;
963- const expectedSubLibCount = 19 ;
962+ // TODO(jcollins-g): Remove flexibility in library counts once dev build
963+ // includes https://dart-review.googlesource.com/c/sdk/+/93160
964+ const expectedLibCounts = [0 , 1 ];
965+ const expectedSubLibCount = [19 , 20 ];
966+ const expectedTotalCount = [19 , 20 ];
964967 File indexHtml = joinFile (sdkDocsDir, ['index.html' ]);
965968 if (! indexHtml.existsSync ()) {
966969 fail ('no index.html found for SDK docs' );
967970 }
968971 log ('found index.html' );
969972 String indexContents = indexHtml.readAsStringSync ();
970973 int foundLibs = _findCount (indexContents, ' <li><a href="dart-' );
971- if (foundLibs != expectedLibCount ) {
974+ if (! expectedLibCounts. contains (foundLibs) ) {
972975 fail (
973- 'expected $expectedLibCount dart: index.html entries, found $foundLibs ' );
976+ 'expected $expectedTotalCount dart: index.html entries, found $foundLibs ' );
974977 }
975978 log ('$foundLibs index.html dart: entries found' );
976979
977980 int foundSubLibs =
978981 _findCount (indexContents, '<li class="section-subitem"><a href="dart-' );
979- if (foundSubLibs != expectedSubLibCount) {
982+ if (! expectedSubLibCount. contains (foundSubLibs) ) {
980983 fail (
981984 'expected $expectedSubLibCount dart: index.html entries in categories, found $foundSubLibs ' );
982985 }
@@ -985,9 +988,9 @@ void validateSdkDocs() {
985988 // check for the existence of certain files/dirs
986989 var libsLength =
987990 sdkDocsDir.listSync ().where ((fs) => fs.path.contains ('dart-' )).length;
988- if (libsLength != expectedLibCount + expectedSubLibCount ) {
991+ if (! expectedTotalCount. contains (libsLength) ) {
989992 fail ('docs not generated for all the SDK libraries, '
990- 'expected ${expectedLibCount + expectedSubLibCount } directories, generated $libsLength directories' );
993+ 'expected ${expectedTotalCount + expectedTotalCount } directories, generated $libsLength directories' );
991994 }
992995 log ('$libsLength dart: libraries found' );
993996
0 commit comments