@@ -23,6 +23,10 @@ Directory get dartdocDocsDir =>
23
23
tempdirsCache.memoized1 (createTempSync, 'dartdoc' );
24
24
Directory get sdkDocsDir => tempdirsCache.memoized1 (createTempSync, 'sdkdocs' );
25
25
Directory get flutterDir => tempdirsCache.memoized1 (createTempSync, 'flutter' );
26
+ Directory get testPackage =>
27
+ new Directory (path.joinAll (['testing' , 'test_package' ]));
28
+ Directory get testPackageDocsDir =>
29
+ tempdirsCache.memoized1 (createTempSync, 'test_package' );
26
30
27
31
/// Version of dartdoc we should use when making comparisons.
28
32
String get dartdocOriginalBranch {
@@ -136,7 +140,7 @@ Future<List<Map>> _buildSdkDocs(String sdkDocsPath, Future<String> futureCwd,
136
140
Platform .resolvedExecutable,
137
141
[
138
142
'--checked' ,
139
- 'bin/ dartdoc.dart' ,
143
+ path. join ( 'bin' , ' dartdoc.dart') ,
140
144
'--output' ,
141
145
'${sdkDocsDir .path }' ,
142
146
'--sdk-docs' ,
@@ -146,6 +150,56 @@ Future<List<Map>> _buildSdkDocs(String sdkDocsPath, Future<String> futureCwd,
146
150
workingDirectory: cwd);
147
151
}
148
152
153
+ Future <List <Map >> _buildTestPackageDocs (
154
+ String outputDir, Future <String > futureCwd,
155
+ [String label]) async {
156
+ if (label == null ) label = '' ;
157
+ if (label != '' ) label = '-$label ' ;
158
+ var launcher = new SubprocessLauncher ('build-test-package-docs$label ' );
159
+ await launcher.runStreamed (sdkBin ('pub' ), ['get' ],
160
+ workingDirectory: testPackage.absolute.path);
161
+ String cwd = await futureCwd;
162
+ await launcher.runStreamed (sdkBin ('pub' ), ['get' ], workingDirectory: cwd);
163
+ return await launcher.runStreamed (
164
+ Platform .resolvedExecutable,
165
+ [
166
+ '--checked' ,
167
+ path.join (cwd, 'bin' , 'dartdoc.dart' ),
168
+ '--output' ,
169
+ outputDir,
170
+ '--auto-include-dependencies' ,
171
+ '--example-path-prefix' ,
172
+ 'examples' ,
173
+ '--include-source' ,
174
+ '--json' ,
175
+ '--pretty-index-json' ,
176
+ '--exclude' ,
177
+ 'dart.async,dart.collection,dart.convert,dart.core,dart.math,dart.typed_data,meta' ,
178
+ ],
179
+ workingDirectory: testPackage.absolute.path);
180
+ }
181
+
182
+ @Task ('Build generated test package docs (with inherited docs and source code)' )
183
+ Future buildTestPackageDocs () async {
184
+ await _buildTestPackageDocs (testPackageDocsDir.absolute.path,
185
+ new Future .value (Directory .current.path));
186
+ }
187
+
188
+ @Task ('Serve test package docs locally with dhttpd on port 8002' )
189
+ @Depends (buildTestPackageDocs)
190
+ Future serveTestPackageDocs () async {
191
+ log ('launching dhttpd on port 8002 for SDK' );
192
+ var launcher = new SubprocessLauncher ('serve-test-package-docs' );
193
+ await launcher.runStreamed (sdkBin ('pub' ), [
194
+ 'run' ,
195
+ 'dhttpd' ,
196
+ '--port' ,
197
+ '8002' ,
198
+ '--path' ,
199
+ '${testPackageDocsDir .absolute .path }' ,
200
+ ]);
201
+ }
202
+
149
203
@Task ('Serve generated SDK docs locally with dhttpd on port 8000' )
150
204
@Depends (buildSdkDocs)
151
205
Future serveSdkDocs () async {
0 commit comments