;; Debian adjustments for project.clj

(require '[debian.dh-clojure-lein.client :as deb])

(defn adjust-deps [deps proj]
  "Drop dependencies on clojurescript and criterium."
  (cond-> deps
    (deb/get-dep deps 'org.clojure/clojurescript) (deb/del-dep 'org.clojure/clojurescript)
    (deb/get-dep deps 'criterium) (deb/del-dep 'criterium)))

(defn dh-clj-adjust-project [project when & _]
  "Drop plugins and process dependencies."
  (case when
    :before-plugins
      (-> (project)
        (update :plugins deb/del-dep 'lein-cljsbuild)
        (update :plugins deb/del-dep 'lein-codox)
        (update :plugins deb/del-dep 'lein-doo))
    :after-middleware
      (-> (project)
        (update :dependencies adjust-deps project))
    (project)))
