Want to contribute? Fork us in GitHub!

Global EO Cache

The EO compilation process consists of several steps covered in detail in this blog post. Most of the steps have various files (.eo, .xmir, etc.) as their input/output, and sometimes it’s very handy to have them persisted somewhere for reuse between compilation runs. ~/.eo/ folder acts as such persistent storage. Let’s have a closer look at its structure and how it is bound to compilation process.

The folder has the following structure:

~/.eo/
   |-- pulled/
   |-- parsed/
   +-- optimized/

Each subfolder can be considered as a local cache serving a specific purpose. All caches store files based on version git-hash. For example, the org.eolang.array object source for version 0.27.0 within the Pulled cache will be stored as ~/.eo/pulled/99b64cf/org/eolang/array.eo, where 99b64cf is the git-hash for the 0.27.0 version tag. Also, note that the file path corresponds to the package of the object.

The Pulled cache contains .eo sources downloaded from Objectionary during the Pull step. Every time the pull step is executed, it first checks the presence of the file in the pulled cache and would only go to the remote Objectionary in case it’s missing locally. However, this behaviour can be adjusted by the Maven -U option (see Bypassing object cache).

The Parsed cache stores parsed .xmir files produced during the Parse step. The structure of this folder is similar to the pulled cache, namely it stores files based on hash+package: parsed/99b64cf/org/eolang/array.xmir. An EO object discovered during previous compilation cycles and which has a meaningful version (i.e. not like 0.0.0, *.*.* or empty), before actually being parsed would be checked in the parsed cache first. If it’s found it will be copied to the corresponding target. In case it’s missing, it would be parsed from the EO source.

The Optimized cache is used during the Optimize step and stores optimized .xmir files. It functions identically to the Parsed cache.

To summarize: the ~/.eo/ folder represents a local file cache for EO compilation artifacts to make the process more performant. It’s possible that for further optimizations we will see more caches within ~/.eo/ in the future.

And of course to clean up all caches you can always execute (for Bash) rm -rf ~/.eo :)