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

Allow local/root jars #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions src/lein_tools_deps/lein_project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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))
Expand Down
6 changes: 6 additions & 0 deletions test-cases/local-root-issue.edn
Original file line number Diff line number Diff line change
@@ -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"}}}}}
10 changes: 10 additions & 0 deletions test/lein_tools_deps/plugin_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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 (= #{(str (absolute-base-path) "/test-cases/lib/dt.jar")
(str (absolute-base-path) "/src")}
(set (:source-paths project))))))