@@ -147,7 +147,7 @@ class DartDoc extends PackageBuilder {
147147 }
148148 }
149149
150- Package package ;
150+ PackageGraph packageGraph ;
151151
152152 /// Generate DartDoc documentation.
153153 ///
@@ -157,23 +157,23 @@ class DartDoc extends PackageBuilder {
157157 Future <DartDocResults > generateDocs () async {
158158 Stopwatch _stopwatch = new Stopwatch ()..start ();
159159 double seconds;
160- package = await buildPackage ();
160+ packageGraph = await buildPackageGraph ();
161161 seconds = _stopwatch.elapsedMilliseconds / 1000.0 ;
162162 logInfo (
163- "Initialized dartdoc with ${package .libraries .length } librar${package .libraries .length == 1 ? 'y' : 'ies' } "
163+ "Initialized dartdoc with ${packageGraph .libraries .length } librar${packageGraph .libraries .length == 1 ? 'y' : 'ies' } "
164164 "in ${seconds .toStringAsFixed (1 )} seconds" );
165165 _stopwatch.reset ();
166166
167167 // Create the out directory.
168168 if (! outputDir.existsSync ()) outputDir.createSync (recursive: true );
169169
170170 for (var generator in generators) {
171- await generator.generate (package , outputDir.path);
171+ await generator.generate (packageGraph , outputDir.path);
172172 writtenFiles.addAll (generator.writtenFiles.map (path.normalize));
173173 }
174- if (config.validateLinks) validateLinks (package , outputDir.path);
175- int warnings = package .packageWarningCounter.warningCount;
176- int errors = package .packageWarningCounter.errorCount;
174+ if (config.validateLinks) validateLinks (packageGraph , outputDir.path);
175+ int warnings = packageGraph .packageWarningCounter.warningCount;
176+ int errors = packageGraph .packageWarningCounter.errorCount;
177177 if (warnings == 0 && errors == 0 ) {
178178 logInfo ("no issues found" );
179179 } else {
@@ -183,23 +183,24 @@ class DartDoc extends PackageBuilder {
183183
184184 seconds = _stopwatch.elapsedMilliseconds / 1000.0 ;
185185 logInfo (
186- "Documented ${package .publicLibraries .length } public librar${package .publicLibraries .length == 1 ? 'y' : 'ies' } "
186+ "Documented ${packageGraph .publicLibraries .length } public librar${packageGraph .publicLibraries .length == 1 ? 'y' : 'ies' } "
187187 "in ${seconds .toStringAsFixed (1 )} seconds" );
188188
189- if (package .publicLibraries.isEmpty) {
189+ if (packageGraph .publicLibraries.isEmpty) {
190190 throw new DartDocFailure (
191191 "dartdoc could not find any libraries to document. Run `pub get` and try again." );
192192 }
193193
194- if (package .packageWarningCounter.errorCount > 0 ) {
194+ if (packageGraph .packageWarningCounter.errorCount > 0 ) {
195195 throw new DartDocFailure ("dartdoc encountered errors while processing" );
196196 }
197197
198- return new DartDocResults (packageMeta, package , outputDir);
198+ return new DartDocResults (packageMeta, packageGraph , outputDir);
199199 }
200200
201201 /// Warn on file paths.
202- void _warn (Package package, PackageWarning kind, String warnOn, String origin,
202+ void _warn (PackageGraph packageGraph, PackageWarning kind, String warnOn,
203+ String origin,
203204 {String referredFrom}) {
204205 // Ordinarily this would go in [Package.warn], but we don't actually know what
205206 // ModelElement to warn on yet.
@@ -235,14 +236,15 @@ class DartDoc extends PackageBuilder {
235236 }
236237
237238 if (referredFromElements.isEmpty && referredFrom == 'index.html' )
238- referredFromElements.add (package );
239+ referredFromElements.add (packageGraph );
239240 String message = warnOn;
240241 if (referredFrom == 'index.json' ) message = '$warnOn (from index.json)' ;
241- package .warnOnElement (warnOnElement, kind,
242+ packageGraph .warnOnElement (warnOnElement, kind,
242243 message: message, referredFrom: referredFromElements);
243244 }
244245
245- void _doOrphanCheck (Package package, String origin, Set <String > visited) {
246+ void _doOrphanCheck (
247+ PackageGraph packageGraph, String origin, Set <String > visited) {
246248 String normalOrigin = path.normalize (origin);
247249 String staticAssets = path.joinAll ([normalOrigin, 'static-assets' , '' ]);
248250 String indexJson = path.joinAll ([normalOrigin, 'index.json' ]);
@@ -264,15 +266,16 @@ class DartDoc extends PackageBuilder {
264266 if (visited.contains (fullPath)) continue ;
265267 if (! writtenFiles.contains (fullPath)) {
266268 // This isn't a file we wrote (this time); don't claim we did.
267- _warn (package , PackageWarning .unknownFile, fullPath, normalOrigin);
269+ _warn (packageGraph , PackageWarning .unknownFile, fullPath, normalOrigin);
268270 } else {
269- _warn (package, PackageWarning .orphanedFile, fullPath, normalOrigin);
271+ _warn (
272+ packageGraph, PackageWarning .orphanedFile, fullPath, normalOrigin);
270273 }
271274 _onCheckProgress.add (fullPath);
272275 }
273276
274277 if (! foundIndexJson) {
275- _warn (package , PackageWarning .brokenLink, indexJson, normalOrigin);
278+ _warn (packageGraph , PackageWarning .brokenLink, indexJson, normalOrigin);
276279 _onCheckProgress.add (indexJson);
277280 }
278281 }
@@ -300,7 +303,7 @@ class DartDoc extends PackageBuilder {
300303 }
301304
302305 void _doSearchIndexCheck (
303- Package package , String origin, Set <String > visited) {
306+ PackageGraph packageGraph , String origin, Set <String > visited) {
304307 String fullPath = path.joinAll ([origin, 'index.json' ]);
305308 String indexPath = path.joinAll ([origin, 'index.html' ]);
306309 File file = new File ("$fullPath " );
@@ -319,7 +322,7 @@ class DartDoc extends PackageBuilder {
319322 if (entry.containsKey ('href' )) {
320323 String entryPath = path.joinAll ([origin, entry['href' ]]);
321324 if (! visited.contains (entryPath)) {
322- _warn (package , PackageWarning .brokenLink, entryPath,
325+ _warn (packageGraph , PackageWarning .brokenLink, entryPath,
323326 path.normalize (origin),
324327 referredFrom: fullPath);
325328 }
@@ -329,14 +332,14 @@ class DartDoc extends PackageBuilder {
329332 // Missing from search index
330333 Set <String > missing_from_search = visited.difference (found);
331334 for (String s in missing_from_search) {
332- _warn (package , PackageWarning .missingFromSearchIndex, s,
335+ _warn (packageGraph , PackageWarning .missingFromSearchIndex, s,
333336 path.normalize (origin),
334337 referredFrom: fullPath);
335338 }
336339 }
337340
338- void _doCheck (
339- Package package, String origin, Set < String > visited, String pathToCheck,
341+ void _doCheck (PackageGraph packageGraph, String origin, Set < String > visited,
342+ String pathToCheck,
340343 [String source, String fullPath]) {
341344 if (fullPath == null ) {
342345 fullPath = path.joinAll ([origin, pathToCheck]);
@@ -345,7 +348,7 @@ class DartDoc extends PackageBuilder {
345348
346349 Tuple2 stringLinksAndHref = _getStringLinksAndHref (fullPath);
347350 if (stringLinksAndHref == null ) {
348- _warn (package , PackageWarning .brokenLink, pathToCheck,
351+ _warn (packageGraph , PackageWarning .brokenLink, pathToCheck,
349352 path.normalize (origin),
350353 referredFrom: source);
351354 _onCheckProgress.add (pathToCheck);
@@ -387,7 +390,7 @@ class DartDoc extends PackageBuilder {
387390 }
388391 }
389392 for (Tuple2 visitPaths in toVisit) {
390- _doCheck (package , origin, visited, visitPaths.item1, pathToCheck,
393+ _doCheck (packageGraph , origin, visited, visitPaths.item1, pathToCheck,
391394 visitPaths.item2);
392395 }
393396 _onCheckProgress.add (pathToCheck);
@@ -397,16 +400,16 @@ class DartDoc extends PackageBuilder {
397400
398401 /// Don't call this method more than once, and only after you've
399402 /// generated all docs for the Package.
400- void validateLinks (Package package , String origin) {
403+ void validateLinks (PackageGraph packageGraph , String origin) {
401404 assert (_hrefs == null );
402- _hrefs = package .allHrefs;
405+ _hrefs = packageGraph .allHrefs;
403406
404407 final Set <String > visited = new Set ();
405408 final String start = 'index.html' ;
406409 logInfo ('Validating docs...' );
407- _doCheck (package , origin, visited, start);
408- _doOrphanCheck (package , origin, visited);
409- _doSearchIndexCheck (package , origin, visited);
410+ _doCheck (packageGraph , origin, visited, start);
411+ _doOrphanCheck (packageGraph , origin, visited);
412+ _doSearchIndexCheck (packageGraph , origin, visited);
410413 }
411414}
412415
@@ -424,10 +427,10 @@ class DartDocFailure {
424427/// The results of a [DartDoc.generateDocs] call.
425428class DartDocResults {
426429 final PackageMeta packageMeta;
427- final Package package ;
430+ final PackageGraph packageGraph ;
428431 final Directory outDir;
429432
430- DartDocResults (this .packageMeta, this .package , this .outDir);
433+ DartDocResults (this .packageMeta, this .packageGraph , this .outDir);
431434}
432435
433436class _Error implements Comparable <_Error > {
0 commit comments