bitrise-steplib / bitrise-step-flutter-build

MIT License
7 stars 13 forks source link

Failed to collect flutter cache #44

Closed damian-molinski closed 1 year ago

damian-molinski commented 1 year ago

Issue description

Recently i started to notice warning in my workflow when using Flutter Build step

+------------------------------------------------------------------------------+

| (9) Flutter Build                                                            |
+------------------------------------------------------------------------------+
| id: flutter-build                                                            |
| version: 0.15.1                                                              |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2023-02-27T12:47:05Z                                                   |
+------------------------------------------------------------------------------+

Error (non fatal) says

Collecting cache
Failed to collect flutter cache, error: package resolution file (/Users/vagrant/git/.packages) not found, error: stat /Users/vagrant/git/.packages: no such file or directory

From what i was able to understand how this step works [ i'm very bad with go, sorry :( ] its failes at this line https://github.com/bitrise-steplib/bitrise-step-flutter-build/blob/master/cache.go#L215.

It's trying to find .packages directory but it does not exists (not even on my local machine.

https://dart.dev/tools/pub/cmd/pub-get#package-resolution says that .dart_tool/ is the place to look for package_config.json

and https://dart.dev/tools/pub/cmd/pub-get#the-system-package-cache that .pub-cache is at root dir unless env var(PUB_CACHE) is set (https://dart.dev/tools/pub/environment-variables).

.dart_tools/

damianmolinski@Damians-MBP ~ % ls -l Work/[project_name]/.dart_tool 
total 144
drwxr-xr-x   5 damianmolinski  staff    160 Feb 27 07:54 build
drwxr-xr-x   4 damianmolinski  staff    128 Feb 14 08:25 build_resolvers
drwxr-xr-x  15 damianmolinski  staff    480 Feb 27 12:02 flutter_build
drwxr-xr-x   5 damianmolinski  staff    160 Feb 15 13:26 flutter_gen
-rw-r--r--   1 damianmolinski  staff  31762 Feb 27 13:21 package_config.json
-rw-r--r--   1 damianmolinski  staff  35572 Feb 27 13:21 package_config_subset
drwxr-xr-x   5 damianmolinski  staff    160 Feb 27 13:21 pub
-rw-r--r--   1 damianmolinski  staff      5 Feb 27 13:21 version

.pub-cache/

damianmolinski@Damians-MBP ~ % ls -l .pub-cache                     
total 8
-rw-r--r--  1 damianmolinski  staff  370 Feb 23 13:16 README.md
drwxr-xr-x  2 damianmolinski  staff   64 Feb 23 13:16 _temp
drwxr-xr-x  5 damianmolinski  staff  160 Mar 17  2022 bin
drwxr-xr-x  5 damianmolinski  staff  160 Feb 15 08:24 git
drwxr-xr-x  5 damianmolinski  staff  160 Feb 24  2022 global_packages
drwxr-xr-x  4 damianmolinski  staff  128 Jan 18 07:54 hosted
drwxr-xr-x  3 damianmolinski  staff   96 Jan 18 07:57 hosted-hashes
drwxr-xr-x  3 damianmolinski  staff   96 Dec 29 10:54 log

Again step does not fail but it would be nice to speed up build time a bit with cache. If this is just warning sorry for bothering.

abdulhaq-e commented 1 year ago

I don't think it's just a warning. The push-cache step isn't recognizing any cache related to Flutter packages.

godrei commented 1 year ago

Hi @damian-molinski and @abdulhaq-e , we merged a PR to fix this issue and released a new version (0.16.0) with the changes. Could you please check if the issue still exists?

damian-molinski commented 1 year ago

Looks good to me 👍