Skip to content

Commit

Permalink
Allow :checksum policy to be set at the top-level of project.clj as w…
Browse files Browse the repository at this point in the history
…ell.
  • Loading branch information
technomancy committed May 11, 2012
1 parent 3780bf6 commit 7d64102
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions leiningen-core/src/leiningen/core/classpath.clj
Expand Up @@ -53,6 +53,10 @@
"Call f with args when keys in project.clj have changed since the last run.
Stores value of project keys in stale directory inside :target-path."
[keys project f & args]
(prn :target-path (:target-path project))
(when-not (:target-path project)
(prn :no-target project)
(throw (Exception. "No target path!")))
(let [file (io/file (:target-path project) "stale"
(str/join "+" (map name keys)))
current-value (pr-str (map (juxt identity project) keys))
Expand Down Expand Up @@ -101,14 +105,17 @@
:username username
:password password})))

(defn- update-policy [update [repo-name opts]]
[repo-name (if update (assoc opts :update update) opts)])
(defn- update-policies [update checksum [repo-name opts]]
(let [opts (if update (assoc opts :update update) opts)
opts (if checksum (assoc opts :checksum checksum) opts)]
[repo-name opts]))

(defn- root-cause [e]
(last (take-while identity (iterate (memfn getCause) e))))

(defn- get-dependencies
[dependencies-key {:keys [repositories local-repo offline? update] :as project}
[dependencies-key {:keys [repositories local-repo offline? update checksum]
:as project}
& {:keys [add-classpath?]}]
{:pre [(every? vector? (project dependencies-key))]}
(try
Expand All @@ -119,7 +126,7 @@
:offline? offline?
:repositories (->> repositories
(map add-repo-auth)
(map (partial update-policy update)))
(map (partial update-policies update checksum)))
:coordinates (project dependencies-key)
:transfer-listener :stdout
:proxy (get-proxy-settings))
Expand Down
2 changes: 1 addition & 1 deletion sample.project.clj
Expand Up @@ -141,7 +141,7 @@
"snapshots" "http://blueant.com/archiva/snapshots"
"releases" "http://blueant.com/archiva/internal"}
;; You can set :update and :checksum policies here to have them
;; apply for all :repositories. Usually you will not set this
;; apply for all :repositories. Usually you will not set :update
;; directly but apply the "update" profile instead.
:update :always
;; the deploy task will give preference to repositories specified in
Expand Down
2 changes: 1 addition & 1 deletion todo.org
Expand Up @@ -8,7 +8,7 @@ See also https://github.com/technomancy/leiningen/issues
- [X] Make offline profile use dev profile (#514) (LHF)
- [X] Fix $JVM_OPTS (#565)
- [X] Move lein-newnew plugin into default profile (#540)
- [ ] Force checking of snapshots (#518) (LHF)
- [X] Force checking of snapshots (#518) (LHF)
** Intermediate
- [X] Pretty-print pom
- [X] deps :tree
Expand Down

0 comments on commit 7d64102

Please sign in to comment.