          '[samestep.boot-refresh :refer [refresh]]
          '[tolitius.boot-check :as check])
 
-(bootlaces! version :dont-modify-paths? true)
+(deftask set-version
+  []
+  (let [version (deduce-version-from-git)]
+    (task-options!
+     jar {:file (str "frereth-cp-" version ".jar")}
+     pom {:version version})
+    (bootlaces! version :dont-modify-paths? true))
+  identity)
 
 (deftask build
   "Build the project locally as a JAR."

      ;; Q: Should this go into public domain like the rest
      ;; of the pieces?
      :license     {"Eclipse Public License"
                    "http://www.eclipse.org/legal/epl-v10.html"}})

(require '[adzerk.bootlaces :refer [bootlaces! build-jar push-snapshot push-release]]
         '[adzerk.boot-test :refer [test]]

  (let [port (or port 32767)]
    (comp (dev) (testing) (check-conflicts) (cider) (javac) (repl :port port :bind "0.0.0.0"))))

(deftask to-clojars
  "Publish"
  []
  (comp (set-version) (javac) (build-jar) (push-release)))

(deftask from-snapshot
  "Allow publishing a snapshot version"
  ;; TODO: Split this into 2 tasks.
  ;; One to wrap, pushing/popping options without updating the
  ;; fileset.
  ;; The other should do the actual changes in the pipeline
  []

  (let [old-version (deduce-version-from-git)
        version (str old-version "-SNAPSHOT")
        ;old-pom-options pom
        old-push-options push
        ]
    (comp
     ;; Q: Should fileset be a vector like this?
     ;; (it doesn't seem to make any difference. I've seen examples
     ;; both ways)
     (with-pre-wrap fileset
       (println "Setting bootlaces to publish version" version)
       ;; Note that this is really just setting the options to
       ;; push, which is part of boot.task.built-in.
       ;; Actually, the bootlaces task is just a wrapper around
       ;; that.
       (task-options! )
       ;(task-options! pom {:version version})
       (bootlaces! version :dont-modify-paths? true)
       fileset)
     (with-post-wrap fileset
       (bootlaces! old-version :dont-modify-paths? true)
       ;(task-options! pom old-pom-options)
       (task-options! push old-push-options)))))

(deftask run
  "Run the project."
