Skip to main content

What is binary caching?

Binary caching is a feature that lets kmpkg save the compiled files of a package in a shared location and reuse them when asked to build the same package with the same configuration. We call the output produced by each package build a "binary package".

Why use binary caching?

Most ports in the kmpkg curated registry are built from source. Building from source ensures maximum compatibility by using the same environment, build tools, and configurations you use for your project in your dependencies. However, this can also result in duplicated builds when multiple projects, developers, or machines require the same dependencies.

Binary caches can be hosted in a variety of environments. The most basic form of binary caching is a directory that holds zipped archives of a package's build output. More advanced scenarios include NuGet package feeds hosted in GitHub Packages, Azure DevOps Artifacts, or other such services.

Binary caching is especially effective in scenarios where dependencies and configuration don't change often, such as in CI (Continuous Integration) or build servers. Binary packages are particularly susceptible to configuration changes (compiler version, compilation flags, installed tools, or kmpkg-specific script changes) which makes sharing them between developer machines difficult. See kmpkg export for a different option to share built packages.

See the binary caching reference documentation to learn about the different storage backends.

Next steps

Set up a local binary cache

Here are other tasks to try next: