Skip to content

Commit

Permalink
Merge pull request #252 from liquidz/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
liquidz authored Apr 12, 2024
2 parents 2dcac25 + aefcac6 commit 4130d7c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
All notable changes to this project will be documented in this file. This change log follows the conventions of http://keepachangelog.com/[keepachangelog.com].

== Unreleased (dev)
// {{{
=== Changed
* Bumped clojure to 1.11.2.
* Bumped tools.deps to 0.19.1417.
* Bumped malli to 0.15.0.
* Bumped kaocha to 1.88.1376.

=== Fixed
* https://github.com/liquidz/antq/issues/251[#251]: Fixed clojure upgrader to be able to upgrade deps in namespaced map.
// }}}

== 2.8.1185 (2024-02-23)
// {{{
Expand Down
8 changes: 4 additions & 4 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{:paths ["src"]
:deps
{org.clojure/clojure {:mvn/version "1.11.1"}
{org.clojure/clojure {:mvn/version "1.11.2"}
org.clojure/data.xml {:mvn/version "0.2.0-alpha9"}
org.clojure/data.zip {:mvn/version "1.1.0"}
org.clojure/tools.cli {:mvn/version "1.1.230"}
org.clojure/core.async {:mvn/version "1.6.681"}
org.clojure/tools.deps {:mvn/version "0.18.1398"}
org.clojure/tools.deps {:mvn/version "0.19.1417"}
org.clojure/data.json {:mvn/version "2.5.0"}
clj-commons/clj-yaml {:mvn/version "1.0.27"}
version-clj/version-clj {:mvn/version "2.0.2"}
Expand All @@ -24,8 +24,8 @@
{:extra-paths ["dev"
"test"
"test/resources"]
:extra-deps {metosin/malli {:mvn/version "0.14.0"}
lambdaisland/kaocha {:mvn/version "1.87.1366"}
:extra-deps {metosin/malli {:mvn/version "0.15.0"}
lambdaisland/kaocha {:mvn/version "1.88.1376"}
lambdaisland/deep-diff2 {:mvn/version "2.11.216"}}
:jvm-opts ["-Dclojure.core.async.go-checking=true"]}

Expand Down
16 changes: 14 additions & 2 deletions src/antq/upgrade/clojure.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@
[antq.util.zip :as u.zip]
[rewrite-clj.zip :as z]))

(defn- in-namespaced-map?
[loc]
(boolean
(some-> loc
z/up
z/leftmost
z/up
z/namespaced-map?)))

(defn- in-deps?
[loc]
(->> loc z/up z/left z/sexpr
(contains? const/clojure-deps-keys)))
(if (in-namespaced-map? loc)
(->> loc z/up z/leftmost z/up z/left z/sexpr
(contains? const/clojure-deps-keys))
(->> loc z/up z/left z/sexpr
(contains? const/clojure-deps-keys))))

(defn- skip-meta
[loc]
Expand Down
16 changes: 16 additions & 0 deletions test/antq/upgrade/clojure_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
:file (io/resource "dep/test_deps.edn")
:extra {:sha "123abcd"}}))

(defn- select-deps
[name-pred file]
(->> (slurp file)
(dep.clj/extract-deps "")
(filter #(name-pred (:name %)))
(map #(assoc % :file file))))

(t/deftest upgrade-dep-test
(t/testing "java"
(let [from-deps (->> dummy-java-dep
Expand Down Expand Up @@ -276,3 +283,12 @@
(dep.clj/extract-deps ""))]
(t/is (= #{{:name "dft/dft" :version {:- "6.0.0" :+ "9.0.0"}}}
(h/diff-deps from-deps to-deps)))))

(t/deftest upgrade-dep-namespaced-java-deps-test
(let [from-deps (->> (io/resource "dep/test_deps_namespaced_map.edn")
(select-deps #{"foo/bar"}))
to-deps (->> (assoc (first from-deps) :latest-version "9.0.0")
(upgrade/upgrader)
(dep.clj/extract-deps ""))]
(t/is (= #{{:name "foo/bar" :version {:- "1.0.0" :+ "9.0.0"}}}
(h/diff-deps from-deps to-deps)))))
8 changes: 8 additions & 0 deletions test/resources/dep/test_deps_namespaced_map.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{:deps #:foo{bar #:mvn{:version "1.0.0"}
git-sha #:git{:url "https://github.com/example/git-sha.git"
:sha "dummy-git-sha"}
git-tag-long-sha #:git{:url "https://github.com/example/git-tag-long.git"
:tag "v2.3.4"
:sha "1234567890abcdefghijklmnopqrstuvwxyz1234"}

local-repo/local-repo #:local{:root "./local"}}}
2 changes: 1 addition & 1 deletion test/resources/integration-testing/green/project.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(defproject green "n/a"
:description "Please keep me updated - `lein antq` should pass for this project"
:managed-dependencies [[com.stuartsierra/dependency "1.0.0"]]
:dependencies [[org.clojure/clojure "1.11.1"]
:dependencies [[org.clojure/clojure "1.11.2"]
[com.stuartsierra/dependency]]
:plugins [[lein-pprint "1.3.2"]
[com.github.liquidz/antq "RELEASE"]]
Expand Down

0 comments on commit 4130d7c

Please sign in to comment.