dart-lang / dartdoc

API documentation tool for Dart.
https://pub.dev/packages/dartdoc
BSD 3-Clause "New" or "Revised" License
473 stars 118 forks source link

Dartdoc can't read generated files that are built to cache #1968

Open evanweible-wf opened 5 years ago

evanweible-wf commented 5 years ago

Similar to https://github.com/dart-lang/sdk/issues/34098

If a package is using a builder that is configured to build to cache, its generated outputs will be in .dart_tool/build/. Some patterns exist where these types of built-to-cache files are included by source files, often as a part. The analysis server supports this and knows how to read those files from the cache when they do not exist in source, but dartdoc does not.

Based on the discussion had in https://github.com/dart-lang/sdk/issues/34098, it appears that this would be relatively uncommon because build-to-cache builders are generally supposed to target applications rather that published libraries, but it seems to me like it should still be supported given that other analysis-based tools support it.


An example error output when this situation does occur:

Generating docs for library dnd.over_react.g from package:web_skin_dart/dnd.over_react.g.dart...

dartdoc failed: FileSystemException: Cannot open file, path = '/Users/evanweible/dev/evanweible-wf/web_skin_dart/lib/dnd.over_react.g.dart' (OS Error: No such file or directory, errno = 2)
evanweible-wf commented 5 years ago
$ dartdoc --version
dartdoc version: 0.28.2
$ dart --version
Dart VM version: 2.3.0 (Fri May 3 10:32:31 2019 +0200) on "macos_x64"
robbecker-wf commented 5 years ago

@kevmoo @vsmenon FYI This is preventing us from being able to generate some documentation under Dart 2 unless we change the over_react builder to build to source. FYI.. We think this is related to https://github.com/dart-lang/sdk/issues/34098

kevmoo commented 5 years ago

CC @devoncarew

devoncarew commented 5 years ago

I think I understand the request; given that there's a workaround (build_to: source), and the issue won't be encountered by most users, I'm not sure this is something we can prioritize.

cc @keertip