Skip to content
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

Flutter recognition not working for transitive dependencies #177

Closed
mosuem opened this issue Feb 27, 2024 · 7 comments · Fixed by #178
Closed

Flutter recognition not working for transitive dependencies #177

mosuem opened this issue Feb 27, 2024 · 7 comments · Fixed by #178
Labels
bug Something isn't working

Comments

@mosuem
Copy link
Contributor

mosuem commented Feb 27, 2024

Describe the bug
The apitool checks if a package should use flutter ... or dart ... commands by checking the pubspec for flutter - but this does not work if flutter is a transitive dependency, leading to failures such as this. There, the package jnigen depends on jni which depends on flutter.

At least that is my working assumption on what is going on there. Maybe instead of the pubspec.yaml, the pubspec.lock file should be checked using package:pubspec_lock_parse?

@mosuem mosuem added the bug Something isn't working label Feb 27, 2024
@devmil
Copy link
Member

devmil commented Feb 27, 2024

@mosuem do you know how to reproduce this issue?
I tried to check out the commit that failed the pipeline and ran dart pub get in the pkgs/jnigen directory but dart was happy 🤷‍♂️
I even tried to run dart_apitool diff on main vs f6b527a3d4bc38f5c36a0147a8d91e830f34783f and this worked as well.
Maybe this has something to do with where dart and flutter are located (like stand-alone dart sdk vs dart sdk from Flutter)?

looking into the pubspec.lock will be difficult without a pub get run 😉 so we would need another way of detecting or specifying that Flutter requirement.

@devmil
Copy link
Member

devmil commented Feb 28, 2024

even running pub get with a stand-alone dart sdk here on a Mac seems to work.
I will try to use docker and a Linux environment to reproduce this issue

@mosuem
Copy link
Contributor Author

mosuem commented Feb 28, 2024

looking into the pubspec.lock will be difficult without a pub get run

right.. @HosseinYousefi any idea why the jni/jnigen repo might complain about using dart ... commands?

@HosseinYousefi
Copy link

right.. @HosseinYousefi any idea why the jni/jnigen repo might complain about using dart ... commands?

Based on the logs, it seems to be a location problem.

Maybe this has something to do with where dart and flutter are located (like stand-alone dart sdk vs dart sdk from Flutter)?

+1

Could not open flutter version file at `/opt/hostedtoolcache/flutter/master-any-x64/bin/cache/flutter.version.json`: PathNotFoundException: Cannot open file, path = '/opt/hostedtoolcache/flutter/master-any-x64/bin/cache/flutter.version.json' (OS Error: No such file or directory, errno = 2)

@devmil
Copy link
Member

devmil commented Mar 1, 2024

@mosuem @HosseinYousefi I tried to reproduce that issue inside a Docker container but this worked as well: https://gist.github.com/devmil/5c4d66e7f5aea38c18a49ac108a3c030

I also checked the health GH runner setup and if I'm not mistaken then it installs the stand-alone dart only if flutter is disabled, right?

@mosuem
Copy link
Contributor Author

mosuem commented Mar 4, 2024

I tried to reproduce that issue inside a Docker container but this worked as well

Thanks a lot for the effort in debugging this! Weird error..

I also checked the health GH runner setup and if I'm not mistaken then it installs the stand-alone dart only if flutter is disabled, right?

Yes, it should only install Flutter in this case.

@devmil
Copy link
Member

devmil commented Mar 4, 2024

@mosuem we could make that flutter / dart decision configurable so that packages could override the decision dart_apitool would make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants