Skip to content

Commit 27af979

Browse files
committed
Move to release-num versioning scheme
For 1.0 we were using a 1.0.<commit-count> version scheme. Moving forward we'll use the simpler (at least for me) 1.1.<release-num> version scheme. We start <release-num> at 44 to account for the 44 known existing releases of rewrite-clj. Next release will be 1.1.45. There is some script code around built-versions that could be simplified. This was determined by the build in the past, but we know what our built-version will be prior to our build now. But I've left it as is for now. Added a new build dir for versioning code. This code is not entirely shared by build.clj and babashka, but having everything that talks about versions in one place makes good sense. Closes #179
1 parent a039f88 commit 27af979

File tree

9 files changed

+45
-27
lines changed

9 files changed

+45
-27
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ For a list of breaking changes see link:#v1-breaking[breaking changes].
1616

1717
=== Unreleased
1818

19+
* dropped the alpha status
1920
* now properly escaping inline double quotes for coerced strings https://github.com/clj-commons/rewrite-clj/issues/176[#176] - thanks to @ivarref for raising the issue!
21+
* changed rewrite-clj library version scheme from commit-count to release-num https://github.com/clj-commons/rewrite-clj/issues/179[#179]
2022
* docs:
2123
** docstring fix, was missing `list-node` from toc, thanks @rfhayashi!
2224

README.adoc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,7 @@ A library that reads and writes Clojure, ClojureScript and https://github.com/ed
2525

2626
== Status
2727

28-
*Warning*: v1 Alpha Release
29-
30-
Our first rewrite-clj v1 alpha release was in March of 2021. +
31-
Since then we have seen wide and successful adoption of rewrite-clj v1 with no show-stoppers. +
32-
I would drop the alpha status but have not yet seen the following features get a good shake yet in the wild:
33-
34-
. zippers with `:track-position?` enabled
35-
. zippers using `:auto-resolve` support
36-
. paredit API
28+
Rewrite-clj v1 has been successfully and widely adopted.
3729

3830
See https://github.com/clj-commons/rewrite-clj/projects/1[project page for current priorities].
3931

@@ -95,11 +87,11 @@ Have an update? Let us know!
9587

9688
== Versioning
9789

98-
Rewrite-clj versioning scheme is: `major`.`minor`.`patch`-`test-qualifier`
90+
Rewrite-clj versioning scheme is: `major`.`minor`.`release`-`test-qualifier`
9991

10092
* `major` increments when a non alpha release API has been broken - something, as a rule, we'd like to avoid.
10193
* `minor` increments to convey significant new features have been added.
102-
* `patch` indicates bug fixes - it is the total number of commits in the repo.
94+
* `release` indicates small changes or bug fixes - starting with v1.1, it is the rewrite-clj release count over the life of rewrite-clj.
10395
* `test-qualifier` is absent for stable releases.
10496
Can be `alpha`, `beta`, `rc1`, etc.
10597

bb.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{:min-bb-version "0.3.7"
2-
:paths ["script"]
2+
:paths ["script" "build"]
33
:deps {org.clojure/data.zip {:mvn/version "1.0.0"}
44
io.aviso/pretty {:mvn/version "1.1.1"}
55
dev.nubank/docopt {:mvn/version "0.6.1-fix7"}

build.clj

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
(ns build
2-
(:require [clojure.edn :as edn]
2+
(:require [build-util :as bu]
33
[clojure.java.io :as io]
44
[clojure.tools.build.api :as b]
55
[deps-deploy.deps-deploy :as dd]
66
[whitespace-linter]))
77

8+
89
(def lib 'rewrite-clj/rewrite-clj)
9-
(def version (let [version-template (-> "version.edn" slurp edn/read-string)
10-
patch (b/git-count-revs nil)]
11-
(str (:major version-template) "."
12-
(:minor version-template) "."
13-
patch
14-
(cond->> (:qualifier version-template)
15-
true (str "-")))))
10+
(def version (bu/version-string)) ;; the expectations is some pre-processing has bumped the version when releasing
1611
(def class-dir "target/classes")
1712
(def basis (b/create-basis {:project "deps.edn"}))
1813
(def jar-file (format "target/%s.jar" (name lib)))

build/build_util.clj

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(ns build-util
2+
"Utilities common to and/or shared between bb and build.clj"
3+
(:require [clojure.edn :as edn]
4+
[rewrite-clj.zip :as z]))
5+
6+
(defn- version []
7+
(edn/read-string (slurp "version.edn")))
8+
9+
(defn bump-version
10+
"Bump :release in version.edn file while preserving any formatting and comments"
11+
[]
12+
(spit "version.edn"
13+
(-> "version.edn"
14+
z/of-file
15+
(z/find-value z/next :release)
16+
z/right
17+
(z/edit inc)
18+
z/root-string)))
19+
20+
(defn version-string []
21+
(let [{:keys [major minor release qualifier]} (version)]
22+
(format "%s.%s.%s%s"
23+
major minor release (if qualifier
24+
(str "-" qualifier)
25+
""))))

deps.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.2" :git/sha "ba1a2bf"}
126126
slipset/deps-deploy {:mvn/version "0.2.0"}
127127
com.camsaul/whitespace-linter {:mvn/version "2022.01.27.04.43"}}
128+
:extra-paths ["src" "build"]
128129
:ns-default build}
129130

130131
;;

doc/04-maintainer-guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you so wish, you can also locally run all steps up to, but not including, dep
4949
----
5050
bb ci-release prep
5151
----
52-
Be aware though that you will NOT want to check in changes `prep` makes to `CHANGELOG.adoc` and `01-user-guide.adoc`.
52+
Be aware though that you will NOT want to check in changes `prep` makes to `version.edn`, `CHANGELOG.adoc` and `doc/01-user-guide.adoc`.
5353

5454
=== Invoking
5555

script/ci_release.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
;;
66

77
(ns ci-release
8-
(:require [clojure.java.io :as io]
8+
(:require [build-util :as bu]
9+
[clojure.java.io :as io]
910
[clojure.string :as string]
1011
[helper.fs :as fs]
1112
[helper.main :as main]
@@ -128,7 +129,7 @@
128129
(status/line :head (str "Committing and pushing changes made for " tag-version))
129130
(assert-on-ci "commit changes")
130131
(status/line :detail "Adding changes")
131-
(shell/command "git add doc/01-user-guide.adoc CHANGELOG.adoc")
132+
(shell/command "git add doc/01-user-guide.adoc CHANGELOG.adoc version.edn")
132133
(status/line :detail "Committing")
133134
(shell/command "git commit -m" (str "Release job: updates for version " tag-version))
134135
(status/line :detail "Version tagging")
@@ -177,6 +178,7 @@ Options
177178
last-version (last-release-tag)]
178179
(status/line :detail (str "Last version released: " (or last-version "<none>")))
179180
(io/make-parents "target")
181+
(bu/bump-version)
180182
(create-jar!)
181183
(let [version (built-version)]
182184
(status/line :detail (str "Built version: " version))

version.edn

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
;; :patch is determined by release workflow
2-
;; omit :qualifier for official releases
1+
;; describes last release and is also a template for the next release
2+
;; :release is incremented by release workflow
3+
;; omit :qualifier (ex. :qualifier "alpha") for official releases
34
{:major 1
4-
:minor 0
5-
:qualifier "alpha"}
5+
:minor 1
6+
:release 44}

0 commit comments

Comments
 (0)