Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next release #252

Merged
merged 7 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading