Open jwinarske opened 2 months ago
We don't have a separate command for this today, but you can already do:
PUB_CACHE=.pub_cache dart pub get
Which would put the cache inside the current directory. This way you can zip everything up.
Then when extracting somewhere run
PUB_CACHE=.pub_cache dart pub get --offline
To fix the absolute references in the .dart_tool/package_config.json
The use case is building 100+ apps simultaneously with LTS support. The proposed archive method dramatically decreases build storage. As there is only one archive of a package, which may show up 100+ times. The compress pub cache approach uses much more disk space at scale. The pub cache restore step takes ~1 second when multi-threaded.
Not sure I follow the use case exactly:
You have 100 apps, and now you want to make a single archive with all of them, or one archive for each?
Can you spell out what exactly the proposed command would do?
@sigurdm Archive would not include any redundant packages; only single references for git and hosted artifacts.
pub archive
pub archive
Archive would not include any redundant packages;
Not sure what you mean by this. The procedure I outlined above would only fetch the packages needed.
only single references for git and hosted artifacts.
What are "references" in this context?
Not sure what you mean by this. The procedure I outlined above would only fetch the packages needed.
Yes this is true for a single application. If I look at all the artifacts fetched for 100 apps, there are many common packages shared between them. This means the archive folder would only contain one copy of each package version. Using a compressed pub archive duplicates the same package version many times; thus increasing disk space.
What are "references" in this context?
These would be considered a reference:
Archive listing for flutter-gallery archive_example.txt
File sizes
Flutter Gallery
I have a need to support Long Term Support (LTS); automotive and IOT.
I'm proposing a new sub command called archive.
This would cache source types hosted and git into an archive folder.
Then without Internet access you can restore said archive, and build.
I have an implementation in Python that does this today. I am using this with the Yocto build system: https://github.com/meta-flutter/meta-flutter/blob/scarthgap/tools/pubspec.py