Skip to content

Commit ad88b12

Browse files
authored
Merge pull request #226 from liquidz/dev
Next release
2 parents bac2568 + 3fb431f commit ad88b12

File tree

7 files changed

+91
-16
lines changed

7 files changed

+91
-16
lines changed

CHANGELOG.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
All notable changes to this project will be documented in this file. This change log follows the conventions of http://keepachangelog.com/[keepachangelog.com].
22

33
== Unreleased (dev)
4+
// {{{
5+
=== Changed
6+
* Bumped rewrite-indented to 0.2.36.
7+
8+
=== Fixed
9+
* https://github.com/liquidz/antq/issues/192[#192]: Fixed to be able to upgrade third party actions which containing a name attribute.
10+
* https://github.com/liquidz/antq/issues/225[#225]: Fixed to handle `:git/url` when scanning transitive dependencies.
11+
// }}}
412

513
== 2.5.1089 (2023-06-16)
614
// {{{

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
clj-commons/clj-yaml {:mvn/version "1.0.26"}
1111
version-clj/version-clj {:mvn/version "2.0.2"}
1212
rewrite-clj/rewrite-clj {:mvn/version "1.1.47"}
13-
com.github.liquidz/rewrite-indented {:mvn/version "0.1.29"}}
13+
com.github.liquidz/rewrite-indented {:mvn/version "0.2.36"}}
1414

1515
:tools/usage
1616
{:ns-default antq.tool}

src/antq/dep/transitive.clj

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,20 @@
2222

2323
(defmethod dep->dep-map :git-sha
2424
[dep]
25-
{(symbol (:name dep))
26-
{:git/sha (:version dep)}})
25+
(let [extra-url (get-in dep [:extra :url])]
26+
{(symbol (:name dep))
27+
(cond-> {:git/sha (:version dep)}
28+
(seq extra-url)
29+
(assoc :git/url extra-url))}))
2730

2831
(defmethod dep->dep-map :git-tag-and-sha
2932
[dep]
30-
{(symbol (:name dep))
31-
{:git/tag (:version dep)
32-
:git/sha (get-in dep [:extra :sha])}})
33+
(let [extra-url (get-in dep [:extra :url])]
34+
{(symbol (:name dep))
35+
(cond-> {:git/tag (:version dep)
36+
:git/sha (get-in dep [:extra :sha])}
37+
(seq extra-url)
38+
(assoc :git/url extra-url))}))
3339

3440
;; ===== resolved-dep->dep =====
3541
(defn- parent-name

src/antq/upgrade/github_action.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
(loop [loc loc]
5757
(if-let [loc (ri.zip/find-next-string loc #(re-seq target-re %))]
5858
(recur (cond-> loc
59-
(some? (ri.zip/find-ancestor-string loc (action? "DeLaGuardo/setup-clojure")))
59+
(some? (ri.zip/find-previous-string loc (action? "DeLaGuardo/setup-clojure")))
6060
(ri.zip/update (update-value (:latest-version version-checked-dep)))
6161

6262
:always
@@ -68,7 +68,7 @@
6868
(loop [loc loc]
6969
(if-let [loc (ri.zip/find-next-string loc #(re-seq #"version\s*:" %))]
7070
(recur (cond-> loc
71-
(some? (ri.zip/find-ancestor-string loc (action? "DeLaGuardo/setup-clj-kondo")))
71+
(some? (ri.zip/find-previous-string loc (action? "DeLaGuardo/setup-clj-kondo")))
7272
(ri.zip/update (update-value (:latest-version version-checked-dep)))
7373

7474
:always
@@ -81,7 +81,7 @@
8181
(if-let [loc (or (ri.zip/find-next-string loc #(re-seq #"graalvm\s*:" %))
8282
(ri.zip/find-next-string loc #(re-seq #"graalvm-version\s*:" %)))]
8383
(recur (cond-> loc
84-
(some? (ri.zip/find-ancestor-string loc (action? "DeLaGuardo/setup-graalvm")))
84+
(some? (ri.zip/find-previous-string loc (action? "DeLaGuardo/setup-graalvm")))
8585
(ri.zip/update (update-value (:latest-version version-checked-dep)))
8686

8787
:always
@@ -93,7 +93,7 @@
9393
(loop [loc loc]
9494
(if-let [loc (ri.zip/find-next-string loc #(re-seq #"cljstyle-version\s*:" %))]
9595
(recur (cond-> loc
96-
(some? (ri.zip/find-ancestor-string loc (action? "0918nobita/setup-cljstyle")))
96+
(some? (ri.zip/find-previous-string loc (action? "0918nobita/setup-cljstyle")))
9797
(ri.zip/update (update-value (:latest-version version-checked-dep)))
9898

9999
:always

test/antq/dep/transitive_test.clj

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,41 @@
2727
:dependents ['foo/bob]}}
2828
{}))
2929

30+
(t/deftest dep->dep-map-test
31+
(t/testing "java"
32+
(t/is (= {'foo/bar {:mvn/version "1.2.3"}}
33+
(#'sut/dep->dep-map {:type :java
34+
:name "foo/bar"
35+
:version "1.2.3"}))))
36+
(t/testing "git-sha with git/url"
37+
(t/is (= {'foo/bar {:git/sha "86eddb89f2a2018fd984dffaadfec13e6735e92f"
38+
:git/url "https://github.com/liquidz/antq"}}
39+
(#'sut/dep->dep-map {:type :git-sha
40+
:name "foo/bar"
41+
:version "86eddb89f2a2018fd984dffaadfec13e6735e92f"
42+
:extra {:url "https://github.com/liquidz/antq"}}))))
43+
(t/testing "git-sha without git/url"
44+
(t/is (= {'com.github.liquidz/antq {:git/sha "86eddb89f2a2018fd984dffaadfec13e6735e92f"}}
45+
(#'sut/dep->dep-map {:type :git-sha
46+
:name "com.github.liquidz/antq"
47+
:version "86eddb89f2a2018fd984dffaadfec13e6735e92f"}))))
48+
(t/testing "git-tag-and-sha with git/url"
49+
(t/is (= {'foo/bar {:git/tag "1.2.3"
50+
:git/sha "86eddb8"
51+
:git/url "https://github.com/liquidz/antq"}}
52+
(#'sut/dep->dep-map {:type :git-tag-and-sha
53+
:name "foo/bar"
54+
:version "1.2.3"
55+
:extra {:sha "86eddb8"
56+
:url "https://github.com/liquidz/antq"}}))))
57+
(t/testing "git-tag-and-sha without git/url"
58+
(t/is (= {'com.github.liquidz/antq {:git/tag "1.2.3"
59+
:git/sha "86eddb8"}}
60+
(#'sut/dep->dep-map {:type :git-tag-and-sha
61+
:name "com.github.liquidz/antq"
62+
:version "1.2.3"
63+
:extra {:sha "86eddb8"}})))))
64+
3065
(t/deftest resolve-transitive-deps-test
3166
(with-redefs [deps/resolve-deps mock-resolve-deps]
3267
(t/is (= [(r/map->Dependency {:type :java

test/antq/upgrade/github_action_test.clj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
to-deps (->> dummy-clojure-cli-dep
9696
(upgrade/upgrader)
9797
(dep.gha/extract-deps ""))]
98-
(t/is (= #{{:name "clojure/brew-install" :version {:- 1 :+ "9.0.0"}}}
98+
(t/is (= #{{:name "clojure/brew-install" :version {:- 1 :+ "9.0.0"}}
99+
{:name "clojure/brew-install" :version {:- -1 :+ "9.0.0"}}}
99100
(h/diff-deps from-deps to-deps)))))
100101

101102
(t/testing "leiningen"
@@ -105,7 +106,8 @@
105106
to-deps (->> dummy-leiningen-dep
106107
(upgrade/upgrader)
107108
(dep.gha/extract-deps ""))]
108-
(t/is (= #{{:name "technomancy/leiningen" :version {:- 2 :+ "9.0.0"}}}
109+
(t/is (= #{{:name "technomancy/leiningen" :version {:- 2 :+ "9.0.0"}}
110+
{:name "technomancy/leiningen" :version {:- -2 :+ "9.0.0"}}}
109111
(h/diff-deps from-deps to-deps)))))
110112

111113
(t/testing "boot"
@@ -115,7 +117,8 @@
115117
to-deps (->> dummy-boot-dep
116118
(upgrade/upgrader)
117119
(dep.gha/extract-deps ""))]
118-
(t/is (= #{{:name "boot-clj/boot" :version {:- 3 :+ "9.0.0"}}}
120+
(t/is (= #{{:name "boot-clj/boot" :version {:- 3 :+ "9.0.0"}}
121+
{:name "boot-clj/boot" :version {:- -3 :+ "9.0.0"}}}
119122
(h/diff-deps from-deps to-deps))))))
120123

121124
(t/testing "clj-kondo"
@@ -125,7 +128,8 @@
125128
to-deps (->> dummy-clj-kondo-dep
126129
(upgrade/upgrader)
127130
(dep.gha/extract-deps ""))]
128-
(t/is (= #{{:name "clj-kondo/clj-kondo" :version {:- "5" :+ "9.0.0"}}}
131+
(t/is (= #{{:name "clj-kondo/clj-kondo" :version {:- "5" :+ "9.0.0"}}
132+
{:name "clj-kondo/clj-kondo" :version {:- "-5" :+ "9.0.0"}}}
129133
(h/diff-deps from-deps to-deps)))))
130134

131135
(t/testing "graalvm"
@@ -135,7 +139,8 @@
135139
to-deps (->> dummy-graalvm-dep
136140
(upgrade/upgrader)
137141
(dep.gha/extract-deps ""))]
138-
(t/is (= #{{:name "graalvm/graalvm-ce-builds" :version {:- "6" :+ "9.0.0"}}}
142+
(t/is (= #{{:name "graalvm/graalvm-ce-builds" :version {:- "6" :+ "9.0.0"}}
143+
{:name "graalvm/graalvm-ce-builds" :version {:- "-6" :+ "9.0.0"}}}
139144
(h/diff-deps from-deps to-deps)))))
140145

141146
(t/testing "cljstyle"
@@ -145,5 +150,6 @@
145150
to-deps (->> dummy-cljstyle-dep
146151
(upgrade/upgrader)
147152
(dep.gha/extract-deps ""))]
148-
(t/is (= #{{:name "greglook/cljstyle" :version {:- "7" :+ "9.0.0"}}}
153+
(t/is (= #{{:name "greglook/cljstyle" :version {:- "7" :+ "9.0.0"}}
154+
{:name "greglook/cljstyle" :version {:- "-7" :+ "9.0.0"}}}
149155
(h/diff-deps from-deps to-deps))))))

test/resources/dep/test_github_action_third_party.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,23 @@ jobs:
1919
- uses: 0918nobita/setup-cljstyle@master
2020
with:
2121
cljstyle-version: "7"
22+
23+
- name: with name
24+
uses: DeLaGuardo/setup-clojure@master
25+
with:
26+
cli: -1
27+
lein: -2
28+
boot: -3
29+
bb: -4
30+
- name: with name
31+
uses: DeLaGuardo/setup-clj-kondo@master
32+
with:
33+
version: '-5'
34+
- name: with name
35+
uses: DeLaGuardo/setup-graalvm@master
36+
with:
37+
graalvm: -6
38+
- name: with name
39+
uses: 0918nobita/setup-cljstyle@master
40+
with:
41+
cljstyle-version: "-7"

0 commit comments

Comments
 (0)