@@ -959,24 +959,27 @@ Future<void> testDartdocFlutterPlugin() async {
959
959
@Task ('Validate the SDK doc build.' )
960
960
@Depends (buildSdkDocs)
961
961
void 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 ];
964
967
File indexHtml = joinFile (sdkDocsDir, ['index.html' ]);
965
968
if (! indexHtml.existsSync ()) {
966
969
fail ('no index.html found for SDK docs' );
967
970
}
968
971
log ('found index.html' );
969
972
String indexContents = indexHtml.readAsStringSync ();
970
973
int foundLibs = _findCount (indexContents, ' <li><a href="dart-' );
971
- if (foundLibs != expectedLibCount ) {
974
+ if (! expectedLibCounts. contains (foundLibs) ) {
972
975
fail (
973
- 'expected $expectedLibCount dart: index.html entries, found $foundLibs ' );
976
+ 'expected $expectedTotalCount dart: index.html entries, found $foundLibs ' );
974
977
}
975
978
log ('$foundLibs index.html dart: entries found' );
976
979
977
980
int foundSubLibs =
978
981
_findCount (indexContents, '<li class="section-subitem"><a href="dart-' );
979
- if (foundSubLibs != expectedSubLibCount) {
982
+ if (! expectedSubLibCount. contains (foundSubLibs) ) {
980
983
fail (
981
984
'expected $expectedSubLibCount dart: index.html entries in categories, found $foundSubLibs ' );
982
985
}
@@ -985,9 +988,9 @@ void validateSdkDocs() {
985
988
// check for the existence of certain files/dirs
986
989
var libsLength =
987
990
sdkDocsDir.listSync ().where ((fs) => fs.path.contains ('dart-' )).length;
988
- if (libsLength != expectedLibCount + expectedSubLibCount ) {
991
+ if (! expectedTotalCount. contains (libsLength) ) {
989
992
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' );
991
994
}
992
995
log ('$libsLength dart: libraries found' );
993
996
0 commit comments