@@ -117,6 +117,9 @@ Directory get flutterDir => _flutterDir ??= createTempSync('flutter');
117
117
Directory get testPackage =>
118
118
Directory (path.joinAll (['testing' , 'test_package' ]));
119
119
120
+ Directory get testPackageExperiments =>
121
+ Directory (path.joinAll (['testing' , 'test_package_experiments' ]));
122
+
120
123
Directory get pluginPackage =>
121
124
Directory (path.joinAll (['testing' , 'test_package_flutter_plugin' ]));
122
125
@@ -125,6 +128,11 @@ Directory _testPackageDocsDir;
125
128
Directory get testPackageDocsDir =>
126
129
_testPackageDocsDir ?? = createTempSync ('test_package' );
127
130
131
+ Directory _testPackageExperimentsDocsDir;
132
+ Directory get testPackageExperimentsDocsDir =>
133
+ _testPackageExperimentsDocsDir ?? =
134
+ createTempSync ('test_package_experiments' );
135
+
128
136
Directory _pluginPackageDocsDir;
129
137
130
138
Directory get pluginPackageDocsDir =>
@@ -497,15 +505,14 @@ Future<List<Map>> _buildSdkDocs(String sdkDocsPath, Future<String> futureCwd,
497
505
workingDirectory: cwd);
498
506
}
499
507
500
- Future <List <Map >> _buildTestPackageDocs (
501
- String outputDir, Future <String > futureCwd,
502
- [String label]) async {
503
- label ?? = '' ;
508
+ Future <List <Map >> _buildTestPackageDocs (String outputDir, String cwd,
509
+ {List <String > params, String label = '' , String testPackagePath}) async {
504
510
if (label != '' ) label = '-$label ' ;
511
+ testPackagePath ?? = testPackage.absolute.path;
512
+ params ?? = [];
505
513
var launcher = SubprocessLauncher ('build-test-package-docs$label ' );
506
514
Future testPackagePubGet = launcher.runStreamed (sdkBin ('pub' ), ['get' ],
507
- workingDirectory: testPackage.absolute.path);
508
- var cwd = await futureCwd;
515
+ workingDirectory: testPackagePath);
509
516
Future dartdocPubGet =
510
517
launcher.runStreamed (sdkBin ('pub' ), ['get' ], workingDirectory: cwd);
511
518
await Future .wait ([testPackagePubGet, dartdocPubGet]);
@@ -522,16 +529,33 @@ Future<List<Map>> _buildTestPackageDocs(
522
529
'--json' ,
523
530
'--link-to-remote' ,
524
531
'--pretty-index-json' ,
532
+ ...params,
525
533
...extraDartdocParameters,
526
534
],
527
- workingDirectory: testPackage.absolute.path);
535
+ workingDirectory: testPackagePath);
536
+ }
537
+
538
+ @Task ('Build generated test package docs from the experiment test package' )
539
+ @Depends (clean)
540
+ Future <void > buildTestExperimentsPackageDocs () async {
541
+ await _buildTestPackageDocs (
542
+ testPackageExperimentsDocsDir.absolute.path, Directory .current.path,
543
+ testPackagePath: testPackageExperiments.absolute.path,
544
+ params: ['--enable-experiment' , 'non-nullable' , '--no-link-to-remote' ]);
545
+ }
546
+
547
+ @Task ('Serve experimental test package on port 8003.' )
548
+ @Depends (buildTestExperimentsPackageDocs)
549
+ Future <void > serveTestExperimentsPackageDocs () async {
550
+ await _serveDocsFrom (testPackageExperimentsDocsDir.absolute.path, 8003 ,
551
+ 'test-package-docs-experiments' );
528
552
}
529
553
530
554
@Task ('Build generated test package docs (with inherited docs and source code)' )
531
555
@Depends (clean)
532
556
Future <void > buildTestPackageDocs () async {
533
557
await _buildTestPackageDocs (
534
- testPackageDocsDir.absolute.path, Future . value ( Directory .current.path) );
558
+ testPackageDocsDir.absolute.path, Directory .current.path);
535
559
}
536
560
537
561
@Task ('Serve test package docs locally with dhttpd on port 8002' )
@@ -549,11 +573,16 @@ Future<void> serveTestPackageDocs() async {
549
573
]);
550
574
}
551
575
576
+ bool _serveReady = false ;
577
+
552
578
Future <void > _serveDocsFrom (String servePath, int port, String context) async {
553
579
log ('launching dhttpd on port $port for $context ' );
554
580
var launcher = SubprocessLauncher (context);
555
- await launcher.runStreamed (sdkBin ('pub' ), ['get' ]);
556
- await launcher.runStreamed (sdkBin ('pub' ), ['global' , 'activate' , 'dhttpd' ]);
581
+ if (! _serveReady) {
582
+ await launcher.runStreamed (sdkBin ('pub' ), ['get' ]);
583
+ await launcher.runStreamed (sdkBin ('pub' ), ['global' , 'activate' , 'dhttpd' ]);
584
+ _serveReady = true ;
585
+ }
557
586
await launcher.runStreamed (
558
587
sdkBin ('pub' ), ['run' , 'dhttpd' , '--port' , '$port ' , '--path' , servePath]);
559
588
}
0 commit comments