Skip to content

Generation failed: Bad state: Could not find "packageGraph.version" in given context #1688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dedeswim opened this issue May 8, 2018 · 2 comments
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@dedeswim
Copy link

dedeswim commented May 8, 2018

I am trying to generate the documentation for a Flutter project I'm working on.
I'm using dartdoc in the folder of my project.

It's the dartdoc of the Dart SDK installed with Chocolatey (so it's not the Flutter one), which I saved in my system PATH.
dart --version gives Dart VM version: 2.0.0-dev.53.0 (Thu May 3 12:35:47 2018 +0200) on "windows_x64".

I get exactly the same error using Flutter's Dart's dartdoc, so running path_to_flutter\flutter\bin\cache\dart-sdk\bin\dartdoc.bat' in my project's directory.

My flutter --version is:

Flutter 0.3.2 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 44b7e7d3f4 (3 weeks ago) • 2018-04-20 01:02:44 -0700
Engine • revision 09d05a3891
Tools • Dart 2.0.0-dev.48.0.flutter-fe606f890b

The output of dartdoc is, in both cases, after the parsing of all the project's files:

Generating documentation for 'pindery' into C:\Users\Edoardo Debenedetti\Documents\Tongji\Software Engineering\Progetto\pindery\doc\api\
parsing lib\catalogue\catalogue.dart...
parsing lib\catalogue\catalogue_element.dart...

[...]

Initialized dartdoc with 775 libraries in 61.7 seconds
documenting pindery

Generation failed: Bad state: Could not find "packageGraph.version" in given context
package:mustache4dart/mustache_context.dart 88                                               _MustacheContext._getInThisOrParent
package:mustache4dart/mustache_context.dart 78                                               _MustacheContext.field
package:mustache4dart/src/tokens.dart 169                                                    _ExpressionToken.apply
package:mustache4dart/src/tokens.dart 247                                                    _EscapeHtmlToken.apply
package:mustache4dart/src/tokens.dart 40                                                     Token.call
package:mustache4dart/src/tmpl.dart 101                                                      _Template._write
package:mustache4dart/src/tmpl.dart 76                                                       _Template.call
package:mustache4dart/src/mustache.dart 11                                                   render
package:mustache4dart/src/tokens.dart 211                                                    _PartialToken.apply
package:mustache4dart/src/tokens.dart 40                                                     Token.call
package:mustache4dart/src/tmpl.dart 101                                                      _Template._write
package:mustache4dart/src/tmpl.dart 76                                                       _Template.call
package:dartdoc/src/html/html_generator_instance.dart 287                                    HtmlGeneratorInstance._build
package:dartdoc/src/html/html_generator_instance.dart 171                                    HtmlGeneratorInstance.generatePackage
package:dartdoc/src/html/html_generator_instance.dart 90                                     HtmlGeneratorInstance._generateDocs
package:dartdoc/src/html/html_generator_instance.dart 36                                     HtmlGeneratorInstance.generate
===== asynchronous gap ===========================
dart:async                                                                                   _Completer.completeError
package:dartdoc/src/html/html_generator_instance.dart                                        HtmlGeneratorInstance.generate
===== asynchronous gap ===========================
dart:async                                                                                   new Future.microtask
package:dartdoc/src/html/html_generator_instance.dart 34                                     HtmlGeneratorInstance.generate
package:dartdoc/src/html/html_generator.dart 107                                             HtmlGenerator.generate
===== asynchronous gap ===========================
dart:async                                                                                   new Future.microtask
package:dartdoc/src/html/html_generator.dart 73                                              HtmlGenerator.generate
package:dartdoc/dartdoc.dart 144                                                             Dartdoc.generateDocs
===== asynchronous gap ===========================
dart:async                                                                                   _asyncThenWrapperHelper
package:dartdoc/dartdoc.dart 129                                                             Dartdoc.generateDocs
E:\b\build\slave\dart-sdk-windows-dev\build\sdk\third_party\pkg\dartdoc\bin\dartdoc.dart 77  main.<fn>.<fn>
===== asynchronous gap ===========================
dart:async                                                                                   new Future.microtask
E:\b\build\slave\dart-sdk-windows-dev\build\sdk\third_party\pkg\dartdoc\bin\dartdoc.dart 76  main.<fn>.<fn>
dart:async                                                                                   runZoned
E:\b\build\slave\dart-sdk-windows-dev\build\sdk\third_party\pkg\dartdoc\bin\dartdoc.dart 76  main.<fn>
===== asynchronous gap ===========================
dart:async                                                                                   new Future.microtask
E:\b\build\slave\dart-sdk-windows-dev\build\sdk\third_party\pkg\dartdoc\bin\dartdoc.dart 75  main.<fn>
package:stack_trace                                                                          Chain.capture
E:\b\build\slave\dart-sdk-windows-dev\build\sdk\third_party\pkg\dartdoc\bin\dartdoc.dart 75  main

Is it a problem of my project? How can I solve it?

Thank you very much.

@dedeswim dedeswim changed the title "Generation failed" when generating docs with dartdoc Generation failed: Bad state: Could not find "packageGraph.version" in given context May 8, 2018
@jcollins-g
Copy link
Contributor

This should not happen. As a wild guess, I tried documenting something that didn't have a version in its pubspec.yaml and reproduced an error that looks similar. Can you try adding a version number to your pubspec.yaml and retrying?

This is still a bug -- we should do something more useful than crash in this case.

@jcollins-g jcollins-g added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P1 A high priority bug; for example, a single project is unusable or has many test failures labels May 8, 2018
@dedeswim
Copy link
Author

dedeswim commented May 8, 2018

It seems to be working, after adding the version, both with the 'pure' Dart's dartdoc and Flutter's Dart dartdoc, thank you!
If I can be helpful in some way let me know! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants