|
2 | 2 |
|
3 | 3 | [](https://clojars.org/me.arrdem/lein-git-version) |
4 | 4 |
|
5 | | -This repo is a fork and to my taste a massive cleanup of |
6 | | -[cvillecsteele's |
7 | | -lein-git-version](https://github.com/cvillecsteele/lein-git-version) |
8 | | -which is itself an un-maintained alternative to |
9 | | -[michalmarczyk's](https://github.com/michalmarczyk/lein-git-version) |
10 | | -original project. |
| 5 | +Derive your Leiningen project version from your Git history. |
11 | 6 |
|
12 | 7 | ## Motivation |
13 | 8 |
|
14 | 9 | Leiningen projects, in their heritage from Maven, list an explicit |
15 | 10 | version as the 3rd element of a `project.clj` file. For instance |
16 | 11 |
|
17 | 12 | ```clojure |
18 | | -(defproject foo "some-version" |
| 13 | +(defproject foo "1.3.4" |
19 | 14 | ...) |
20 | 15 | ``` |
21 | 16 |
|
22 | | -There are a couple problems with this. First of all, until the |
| 17 | +There are a couple of problems with this. First of all, until the |
23 | 18 | arrival of `leiningen.release/bump-version` for the `lein release` |
24 | 19 | task, there was really no sane way to update the version of a property |
25 | | -short of a sed script which just rewrote the `project.clj`. |
| 20 | +short of a sed script to rewrite the `project.clj`. |
26 | 21 |
|
27 | 22 | While `bump-version` is a mostly acceptable solution, it still relies |
28 | | -on the filesystem (or to be more specific a code repository) |
29 | | -reflecting in a file under version control the logical identifier |
30 | | -attached to some point in the history of the repository. |
31 | | - |
32 | | -The problem with sticking a version identifier in the filesystem is |
33 | | -that it becomes a source of merge conflicts when multiple people are |
34 | | -collaborating on an artifact, and it may be difficult to automate |
35 | | -vesion management using merge hooks in workflows with automated |
36 | | -commits that can be difficult to implement. |
37 | | - |
38 | | -Moreover, in monorepo patterns ala |
39 | | -[lein-modules](https://github.com/jcrossley3/lein-modules), versions |
40 | | -for shared libraries which are distributed only as a component of |
41 | | -artifacts in the repository are no longer particularly a meaningful |
42 | | -construct. The commit ID or the version control label is the most |
43 | | -meaningful identifier. |
| 23 | + |
| 24 | +on storing the version identifier in a file, attached to some |
| 25 | +point in the history of the repository. |
| 26 | + |
| 27 | +The problem with sticking a version identifier in the filesystem/version |
| 28 | +history is that it becomes a source of merge conflicts. To avoid the |
| 29 | +merge conflicts, teams sometimes build complicated merge hooks or |
| 30 | +automated workflows. Now you have two problems. |
| 31 | + |
| 32 | +In monorepo patterns ala |
| 33 | +[lein-modules](https://github.com/jcrossley3/lein-modules), the problems |
| 34 | +above become amplified. Additionally, versions for inter-monorepo dependencies |
| 35 | +are not very meaningful as all dependencis are built from the same source |
| 36 | +commit, rather than depending on a specific Maven version identifier. |
| 37 | +Using a commit ID or version control tag/label is a more accurate and useful. |
44 | 38 |
|
45 | 39 | ## Usage |
46 | 40 |
|
@@ -90,7 +84,7 @@ arbitrary function of the current git status by specifying a |
90 | 84 | `status-to-version` function of the above status structure in the |
91 | 85 | `:git-version` map of your `project.clj`. |
92 | 86 |
|
93 | | -For instance, lein-git-version an earlier version of itself uses |
| 87 | +For instance, lein-git-version uses an earlier version of |
94 | 88 | itself to compute its own version. |
95 | 89 |
|
96 | 90 | ```clojure |
@@ -140,6 +134,15 @@ control, a source control ignored eg `"gen-resources/..."` directory |
140 | 134 | be used to isolate generated build artifacts from user |
141 | 135 | sources. Remember to add the target to your project's `:resource-paths`! |
142 | 136 |
|
| 137 | +## History |
| 138 | + |
| 139 | +This repo is a fork and to my taste a massive cleanup of |
| 140 | +[cvillecsteele's |
| 141 | +lein-git-version](https://github.com/cvillecsteele/lein-git-version) |
| 142 | +which is itself an un-maintained alternative to |
| 143 | +[michalmarczyk's](https://github.com/michalmarczyk/lein-git-version) |
| 144 | +original project. |
| 145 | + |
143 | 146 | ## License |
144 | 147 |
|
145 | 148 | Copyright © 2017 Reid McKenzie |
|
0 commit comments