Skip to content

Commit d878241

Browse files
committed
Fix #220: don't use default HEAD tag in pom <scm>
- The pom task now no longer explicitly adds HEAD as the scm tag in pom.xml if no tag is specified and no git commit can be automatically discovered. HEAD is already the Maven default so it wasn't necessary, and it confused other tasks that were looking at the pom.xml and comparing the scm info (see below). - The pom task now correctly supports the <developerConnection> and <connection> elements as children of <scm>. Specify these in the :scm option map via :connection and :developerConnection. (This is probably only useful for creating pom.xml files for Maven to use, but it's in there, anyway.) - The push task no longer throws an exception if the :ensure-tag option is specified but no scm info is available in the pom.xml. It now prints a warning to stderr instead.
1 parent 76980e6 commit d878241

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

boot/core/src/boot/task/built_in.clj

+4-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291

292292
(let [tgt (core/tmp-dir!)]
293293
(core/with-pre-wrap fileset
294-
(let [tag (or (:tag scm) (util/guard (git/last-commit)) "HEAD")
294+
(let [tag (or (:tag scm) (util/guard (git/last-commit)))
295295
scm (when scm (assoc scm :tag tag))
296296
opts (assoc *opts* :scm scm :dependencies (:dependencies (core/get-env)))]
297297
(core/empty-dir! tgt)
@@ -734,8 +734,10 @@
734734
(format "not a release version (%s)" v))
735735
(assert (or (not ensure-snapshot) snapshot?)
736736
(format "not a snapshot version (%s)" v))
737-
(assert (or (not ensure-tag) (= t ensure-tag))
737+
(assert (or (not ensure-tag) (not t) (= t ensure-tag))
738738
(format "scm tag in pom doesn't match (%s, %s)" t ensure-tag))
739+
(when (and ensure-tag (not t))
740+
(util/warn "The --ensure-tag option was specified but scm info is missing from pom.xml\n"))
739741
(assert (or (not ensure-version) (= v ensure-version))
740742
(format "jar version doesn't match project version (%s, %s)" v ensure-version))
741743
(util/info "Deploying %s...\n" (.getName f))

boot/worker/src/boot/jgit.clj

-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
[]
4242
(with-repo (->> (jgit/git-log repo) first .getName)))
4343

44-
;;; FIXME: handle case where repo is not at ".", need to add ".." for each
45-
;;; subdirectory level we are below the repo root, so this is broken
46-
4744
(defn ls-files
4845
[& {:keys [ref untracked]}]
4946
(with-repo

boot/worker/src/boot/pom.clj

+17-5
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@
3434
:scm {:url (util/guard (xml1-> z :scm :url text))
3535
:tag (util/guard (xml1-> z :scm :tag text))}}))
3636

37-
(defn pom-xml [{p :project v :version d :description l :license
38-
{su :url st :tag} :scm u :url deps :dependencies :as env}]
37+
(defn pom-xml [{p :project
38+
v :version
39+
d :description
40+
l :license
41+
{su :url
42+
st :tag
43+
sc :connection
44+
sd :developerConnection} :scm
45+
u :url
46+
deps :dependencies
47+
:as env}]
3948
(let [[g a] (util/extract-ids p)
4049
ls (map (fn [[name url]] {:name name :url url}) l)]
4150
(project
@@ -55,9 +64,12 @@
5564
(url lu)
5665
(name ln)
5766
(comments lc))))
58-
(scm
59-
(url su)
60-
(tag (or st "HEAD")))
67+
(when (or su st sc sd)
68+
(scm
69+
(when sc (connection sc))
70+
(when sd (developerConnection sd))
71+
(when su (url su))
72+
(when st (tag st))))
6173
(dependencies
6274
(for [[p v & {es :exclusions s :scope}] deps
6375
:let [[g a] (util/extract-ids p)]]

0 commit comments

Comments
 (0)