12 Apr

Easier caching with environment variables and GitDependencies.exe

As I spoke about in my previous post on this, GitDependencies downloads your dependencies and even has a cache. You could centralize that cache, but you couldn’t specify how big it was, or how old things in it could be without making sure all of your calls to it were using the same command line parameters. Normally, this would be done by environment variables, or some other central config. So, I’ve added that.

Now, you can specify 3 environment variables:

UE4_GITDEPS – the original. This is the path to the central cache.

UE4_GITDEPS_CACHESIZE – this is the size of the cache, as a multiple of the combined size of all of the dependencies. To my mind, this makes no sense. This number should be a size in megabytes/gigabytes. But, this change is just exposing some variables, so it’s the same as it was.

UE4_GITDEPS_CACHEDAYS – this is how many days old a file has to be before GitDependencies will delete it when the cache is over its alloted size. This is not actually what the command line help said that it did, so that’s another change I made – updating the command line help.

Now you can specify these environment variables or not, and if you do, they are used over the default values. However, if the user specifies the value on the command line, it overrides both the defaults and the environment variable.

This was a really simple change, only taking about 20 minutes of my time, but once it’s setup it will end up saving a lot more.

Things I also wanted to do, but didn’t:

  • Fix the cache size. Why do I care what multiple of the download the cache is? I want to give it an upper limit of size in megabytes.
  • Add more feedback. When GitDependencies pulls a file from the cache, I want to know. When it’s done downloading, I want to know how effective the cache was, so show me how much of the download was skipped because of the cache.

For the curious, here’s the pull request.

Leave a Reply

Your email address will not be published. Required fields are marked *