Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 8c569dc

Browse files
committed
fix: Cache clojure dependencies
Fixes #485. This speeds up builds that use the [Clojure CLI][clojure-cli] by avoiding network calls to download dependencies. When a repo has a `deps.edn` file, we assume it is a Clojure repo. We cache its dependencies by caching the following files: * `.m2` As a JVM language, most Clojure dependencies are stored in the global `.m2` directory. * `.gitlibs` The Clojure CLI can also download dependencies directly from git repositories rather than from a package manager. It caches these downloads in the `.gitlibs` directory. * `.cpcache` Clojure uses the `.cpcache` directory to avoid unnecessarily re-calculating the JVM classpath. Caching this directory won't prevent downloads, but does improve build time slightly. [clojure-cli]: https://clojure.org/reference/deps_and_cli
1 parent 0f09b1e commit 8c569dc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

run-build-functions.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,14 @@ install_dependencies() {
612612
fi
613613
fi
614614

615+
# Clojure CLI
616+
if [ -f deps.edn ]
617+
then
618+
restore_home_cache ".m2" "maven dependencies"
619+
restore_home_cache ".gitlibs" "clojure git dependencies"
620+
restore_cwd_cache ".cpcache" "clojure classpath"
621+
fi
622+
615623
# Hugo
616624
if [ -n "$HUGO_VERSION" ]
617625
then
@@ -699,6 +707,7 @@ cache_artifacts() {
699707

700708
cache_cwd_directory ".venv" "python virtualenv"
701709
cache_cwd_directory ".build" "swift build"
710+
cache_cwd_directory ".cpcache" "clojure classpath"
702711
cache_cwd_directory ".netlify/plugins" "build plugins"
703712
cache_cwd_directory ".netlify/rust-functions-cache" "Rust functions"
704713

@@ -713,6 +722,7 @@ cache_artifacts() {
713722
cache_home_directory ".emacs.d" "emacs cache"
714723
cache_home_directory ".m2" "maven dependencies"
715724
cache_home_directory ".boot" "boot dependencies"
725+
cache_home_directory ".gitlibs" "clojure git dependencies"
716726
cache_home_directory ".composer" "composer dependencies"
717727
cache_home_directory ".homebrew-cache", "homebrew cache"
718728
cache_home_directory ".rustup" "rust rustup cache"
@@ -934,4 +944,3 @@ install_go() {
934944
fi
935945

936946
}
937-

0 commit comments

Comments
 (0)