From 7d118750097b45e49a64b6bb33b092d07533a82d Mon Sep 17 00:00:00 2001 From: Chris Nuernberger Date: Mon, 7 Jan 2019 17:17:50 -0700 Subject: [PATCH 1/2] Allow local/root jars --- src/lein_tools_deps/lein_project.clj | 7 +++++-- test-cases/local-root-issue.edn | 6 ++++++ test/lein_tools_deps/plugin_test.clj | 10 ++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 test-cases/local-root-issue.edn diff --git a/src/lein_tools_deps/lein_project.clj b/src/lein_tools_deps/lein_project.clj index 2a52c30..5cf2e49 100644 --- a/src/lein_tools_deps/lein_project.clj +++ b/src/lein_tools_deps/lein_project.clj @@ -17,6 +17,9 @@ (defmethod leinize :deps [[_artifact info]] (:paths info)) +(defmethod leinize :jar [[_artifact info]] + (:paths info)) + (defn filter-by-manifest [manifest-type tdeps] (filter (fn [[_artifact info]] (= manifest-type (:deps/manifest info))) @@ -28,8 +31,8 @@ (mapv leinize))) (defn lein-source-paths [project-root merged-deps tdeps] - (->> tdeps - (filter-by-manifest :deps) + (->> (concat (filter-by-manifest :deps tdeps) + (filter-by-manifest :jar tdeps)) (mapv leinize) (apply concat) (into (:paths merged-deps)) diff --git a/test-cases/local-root-issue.edn b/test-cases/local-root-issue.edn new file mode 100644 index 0000000..3d449ff --- /dev/null +++ b/test-cases/local-root-issue.edn @@ -0,0 +1,6 @@ +{:paths ["src"] + :deps {org.clojure/clojure {:mvn/version "1.9.0"} + camel-snake-kebab {:mvn/version "0.4.0"} + techascent/tech.resource {:mvn/version "4.0"}} + :aliases {:test {:extra-deps + {com.sun/dt {:local/root "test-cases/lib/dt.jar"}}}}} diff --git a/test/lein_tools_deps/plugin_test.clj b/test/lein_tools_deps/plugin_test.clj index 55e23a3..c407864 100644 --- a/test/lein_tools_deps/plugin_test.clj +++ b/test/lein_tools_deps/plugin_test.clj @@ -89,3 +89,13 @@ (is (thrown? ExceptionInfo (sut/resolve-dependencies-with-deps-edn project)))) (is (thrown? ExceptionInfo (sut/resolve-dependencies-with-deps-edn {})))) + +(deftest apply-middleware-local-root + (let [project (apply-middleware {:root (absolute-base-path) + :lein-tools-deps/config {:aliases [:test] + :config-files ["test-cases/local-root-issue.edn"]} + :dependencies [['org.clojure/clojure "1.9.0"]]})] + (is (map? project)) + (is (= #{"/home/chrisn/dev/cnuernber/lein-tools-deps/test-cases/lib/dt.jar" + "/home/chrisn/dev/cnuernber/lein-tools-deps/src"} + (set (:source-paths project)))))) From 01d91c0d4cf047aa711519094861ae9588e0e262 Mon Sep 17 00:00:00 2001 From: Chris Nuernberger Date: Wed, 9 Jan 2019 12:02:12 -0700 Subject: [PATCH 2/2] making the test not specific to my machine. --- test/lein_tools_deps/plugin_test.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/lein_tools_deps/plugin_test.clj b/test/lein_tools_deps/plugin_test.clj index c407864..eb219ef 100644 --- a/test/lein_tools_deps/plugin_test.clj +++ b/test/lein_tools_deps/plugin_test.clj @@ -96,6 +96,6 @@ :config-files ["test-cases/local-root-issue.edn"]} :dependencies [['org.clojure/clojure "1.9.0"]]})] (is (map? project)) - (is (= #{"/home/chrisn/dev/cnuernber/lein-tools-deps/test-cases/lib/dt.jar" - "/home/chrisn/dev/cnuernber/lein-tools-deps/src"} + (is (= #{(str (absolute-base-path) "/test-cases/lib/dt.jar") + (str (absolute-base-path) "/src")} (set (:source-paths project))))))