shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
2k stars 121 forks source link

feat: specify flutter version in shorebird.yaml #2018

Open alexobviously opened 3 weeks ago

alexobviously commented 3 weeks ago

Description

Currently it is only possible to specify a specific flutter version by passing an argument when calling the Shorebird CLI. This works fine, but for big projects, it would be cleaner if we could specify a version in shorebird.yaml, consistent with how we specify dart/flutter verisons in pubspec.yaml etc.

Requirements

eseidel commented 3 weeks ago

Certainly fair. Another alternative would be for us to teach shorebird to read the version from fvm or similar.

https://github.com/shorebirdtech/shorebird/issues/1972 might be another approach to avoid needing to specify? But I agree, it would be nice to specify the flutter version in source control somehow, and we should just respect whatever way already exists to do that in the flutter community (e.g. fvm?).

alexobviously commented 3 weeks ago

I obviously can't speak for everyone and perhaps my experience is not the standard, but in our case, I'd say explicitly specifying in a single file would actually be the optimal solution, so that we get predictable results regardless of who on the team builds the release/patch, and it's easy to maintain that way too. But yeah maybe I am missing a much better workflow with fvm or similar.

btw I would be happy to have a go at adding this myself, just having a look through the shorebird_cli code and it looks pretty comprehensible

eseidel commented 3 weeks ago

If there is not a way to currently specify flutter version in source, that does seem reasonable that shorebird release should take the flutter version from shorebird.yaml by default. 🤷 Thanks for the suggestion!

erickzanardo commented 1 day ago

pubspec.yaml actually allows you to specify a flutter version, here is an example.

Its is meant to be used mainly on published packages as state in this comment, and it doesn't force you to pin a version, it allows a range, which I am not sure if can bring some confusion.

Either way, I feel it would bring even more confusion if we added yet another version field to shorebird.yaml that does something similar to the one on pubspec.yaml...

So I would suggest that instead of adding a new field to shorebird's config file, we could read the one on pubspec, respect the range (so if the field says >=3.22.0 and shorebird supports 3.22.1, the later will be used), and it can be overridden by the flag.