L483
L483

Reputation: 226

dart doc in GitHub actions creates lengthy file names

In my flutter project I try to automatically generate documentation via a GitHub action that are then automatically served via GitHub pages. My workflow steps are:

sudo snap install flutter --classic
flutter
cd project
dart doc --output ../docs

After the action had generated the newest documentation, a recent pull attempt failed because git tried to pull files whose filename length is above the Windows character limit.

I looked into that and saw that the generated filename was the whole static path of the source code file, starting with file-___home_runner_work_my-project_my-project_project_lib.

Strangely, the log says that it generates docs for a 'library' - when generating docs for a single .dart file.

Generating docs for library main.dart from file:///home/runner/work/my-project/my-project/project/lib/main.dart...

And the log also tells:

Running in /home/runner/work/my-project/my-project

Running dart doc locally in the same way leads to similar results, except that the file names are at least a little bit shorter because they concatenate the not the whole path to the filename (the naming starts with the subdirectories of lib). But the logs also differ slightly for the files.

Generating docs for library main.dart from package:project/main.dart...

Other posts mentioned setting $FLUTTER_ROOT [1], [2]. I tried adding export FLUTTER_ROOT=~/dev/flutter before calling dart doc but this did not change anything.

It seems like the process just misses an environment variable or something like that but I was not able to figure it out with the dart doc and dartdoc documentation pages.

Upvotes: 0

Views: 61

Answers (1)

L483
L483

Reputation: 226

dart doc mentions:

To generate documentation, you must first run dart pub get and your package must pass dart analyze without errors.

And dartdoc also mentions:

You must first run dart pub get or flutter pub get

I overlooked this information. However, even without flutter pub get the documentation was still fully functional, so I did not notice until git pull did not work anymore.

Now the GitHub runner generates the same files as my local device. The filenames are still equivalent to their corresponding source code paths but the name contains only the subpath below lib.

Upvotes: 0

Related Questions