shorebirdtech / shorebird

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

feat: Artifacts should be lazy loaded and handed by themselves #2289

Open erickzanardo opened 5 months ago

erickzanardo commented 5 months ago

Description

We use a couple of different artifacts in shorebird, like aot_tools, bundletool, etc. Most of them (if not all?) are platform specific, and those artifacts are cached to avoid the constant fetching of them from the internet.

Right now, our caching code is the most smart, and in many instances we are caching artifacts that are not necessary.

For example, on the release command we call cache.updateAll in the beginning of its createRelease method. We update all the artifacts cached, even if we are running just an android build, which will make shorebird to potentially download artifacts not needed.

These updateAll calls should not make much difference on the developers workstation day to day, since most of the times everything will be cached anyway, but it can waste CI time where everything is a "cold installation".

A simple solution that could fix that would be to get rid of the updateAll method, and make the artifacts executable classes handle their own cache, for example, on the BundleTool class, it would call cache.update<BundleTool> (or similar), making the cache of the artifact contained in the context that they belong to.

Requirements

Related to: https://github.com/shorebirdtech/shorebird/issues/2211

erickzanardo commented 5 months ago

I wonder if we still need to do #1977 if go with this approach.