This repository has been archived by the owner on Jan 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 196
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I believe this would fix #485. |
This was referenced Apr 29, 2021
This speeds up builds of Clojure repos by avoiding network calls to download dependencies. When a repo has a `deps.edn` file, we assume it is a Clojure repo and would benefit from pre-populating and caching its primary dependencies. Since Clojure dependencies are ultimately stored in the global `.m2` directory, along with other Java dependencies, it suffices to restore `.m2`. The directory is automatically populated during a build performed with the [Clojure CLI tools][clojure-cli]. This extends 52f8eb9, which added support for repos which are built with the Clojure CLI tools. It is similar to f3a4d49 which introduced caching for Leiningen and Boot, two other ways of building Clojure code. [clojure-cli]: https://clojure.org/reference/deps_and_cli
For repos that are built with the [Clojure CLI tools][clojure-cli] (i.e., repos marked with a `deps.edn` file), we cache and restore the `.cpcache` directory. Clojure uses this directory to avoid unnecessarily re-calculating the JVM classpath. For most projects this additional cache will not lead to a large improvement in build times. We also download dependencies to the `.m2` cache before handing off to the build script. Technically, this is unnecessary since, presumably, the build script uses the Clojure CLI tools which have a side-effect of populating `.m2`. Therefore, the benefit of this change is simply to separate the two steps, isolating any errors that occure while fetching dependencies. [clojure-cli]: https://clojure.org/reference/deps_and_cli
The [Clojure CLI tools][clojure-cli] have a mechanism of downloading dependencies directly from git repositories rather than from a package manager. This patch caches the directory which stores these downloads, speeding up builds of repos that use these types of dependencies. [clojure-cli]: https://clojure.org/guides/deps_and_cli
mainej
force-pushed
the
cache-clojure
branch
from
September 25, 2021 18:42
227130f
to
f2d2b9c
Compare
Would love to see this merged! |
Closing this PR as it's against xenial branch and the Xenial image is going to be deprecated: https://answers.netlify.com/t/please-read-end-of-support-for-xenial-build-image-everything-you-need-to-know/68239 Feel free to reopen against focal. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds caching for repos built with the Clojure CLI tools. It extends 52f8eb9, which added initial support for building with the Clojure CLI tools, but did not address caching. It is similar to f3a4d49 which introduced caching for Leiningen and Boot, two other ways of building Clojure code.
This PR contains three commits. I'd like to see them all put into use, but the second one is certainly optional.
The first commit will significantly improve build times and decrease network bandwidth for Clojure repos. It does this by restoring the
.m2
directory before building, as otherJVM
based tools do.The second commit is less important. It has two parts.
.m2
directory before starting the build. Technically this is unnecessary. As opposed to a tool like, for example,bundler
, which expects to resolve and download dependencies before the "real" code is run, the Clojure CLI tools combine dependency management and code execution into one step. Therefore existing builds that use the Clojure CLI tools already populate.m2
. So, this change merely separates the steps, isolating errors that occur during download.The third commit caches the
~/.gitlibs
directory, which the Clojure CLI tools use to cache dependencies procured from git repos (as opposed to from package managers). This will improve build times and decrease network bandwidth for Clojure repos which use this type of dependency procurement.