@@ -33,6 +33,9 @@ const _buildLogFilePath = 'log.txt';
33
33
const _dartdocTimeout = const Duration (minutes: 10 );
34
34
final Duration _twoYears = const Duration (days: 2 * 365 );
35
35
36
+ final _pkgPubDartdocDir =
37
+ Platform .script.resolve ('../../pkg/pub_dartdoc' ).toFilePath ();
38
+
36
39
class DartdocJobProcessor extends JobProcessor {
37
40
DartdocJobProcessor ({Duration lockDuration})
38
41
: super (service: JobService .dartdoc, lockDuration: lockDuration);
@@ -179,16 +182,33 @@ class DartdocJobProcessor extends JobProcessor {
179
182
final canonicalUrl = pkgDocUrl (job.packageName,
180
183
version: canonicalVersion, includeHost: true , omitTrailingSlash: true );
181
184
182
- Future <DartdocResult > runDartdoc (bool validateLinks) {
183
- return toolEnv.dartdoc (
185
+ Future <DartdocResult > runDartdoc (bool validateLinks) async {
186
+ final args = [
187
+ '--input' ,
184
188
pkgPath,
189
+ '--output' ,
185
190
outputDir,
186
- canonicalPrefix: canonicalUrl,
187
- hostedUrl: siteRoot,
191
+ '--hosted-url' ,
192
+ siteRoot,
193
+ '--rel-canonical-prefix' ,
194
+ canonicalUrl,
195
+ '--link-to-remote' ,
196
+ ];
197
+ if (! validateLinks) {
198
+ args.add ('--no-validate-links' );
199
+ }
200
+ final pr = await runProc (
201
+ 'dart' ,
202
+ ['bin/pub_dartdoc.dart' ]..addAll (args),
203
+ workingDirectory: _pkgPubDartdocDir,
188
204
timeout: _dartdocTimeout,
189
- validateLinks: validateLinks,
190
- linkToRemote: true ,
191
205
);
206
+ final hasIndexHtml =
207
+ await new File (p.join (outputDir, 'index.html' )).exists ();
208
+ final hasIndexJson =
209
+ await new File (p.join (outputDir, 'index.json' )).exists ();
210
+ return new DartdocResult (
211
+ pr, pr.exitCode == 15 , hasIndexHtml, hasIndexJson);
192
212
}
193
213
194
214
DartdocResult r = await runDartdoc (true );
0 commit comments