diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 3d75cd9e..04a45710 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -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) // {{{ diff --git a/deps.edn b/deps.edn index 06dbea9f..74a7a7b4 100644 --- a/deps.edn +++ b/deps.edn @@ -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"} @@ -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"]} diff --git a/src/antq/upgrade/clojure.clj b/src/antq/upgrade/clojure.clj index d22fad56..cf92f2c6 100644 --- a/src/antq/upgrade/clojure.clj +++ b/src/antq/upgrade/clojure.clj @@ -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] diff --git a/test/antq/upgrade/clojure_test.clj b/test/antq/upgrade/clojure_test.clj index 1771d891..1047900a 100644 --- a/test/antq/upgrade/clojure_test.clj +++ b/test/antq/upgrade/clojure_test.clj @@ -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 @@ -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))))) diff --git a/test/resources/dep/test_deps_namespaced_map.edn b/test/resources/dep/test_deps_namespaced_map.edn new file mode 100644 index 00000000..bfa6ca54 --- /dev/null +++ b/test/resources/dep/test_deps_namespaced_map.edn @@ -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"}}} diff --git a/test/resources/integration-testing/green/project.clj b/test/resources/integration-testing/green/project.clj index a74f6ef2..a5efd802 100644 --- a/test/resources/integration-testing/green/project.clj +++ b/test/resources/integration-testing/green/project.clj @@ -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"]]