-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
(ns build | ||
(:refer-clojure :exclude [test]) | ||
(:require [clojure.tools.build.api :as b] ; for b/git-count-revs | ||
[org.corfield.build :as bb])) | ||
(:require | ||
[clojure.tools.build.api :as b] | ||
[deps-deploy.deps-deploy :as deploy])) | ||
|
||
(def lib 'io.github.suprematic/ncr.clj.bot-api) | ||
#_(def version "0.1.0-SNAPSHOT") | ||
; alternatively, use MAJOR.MINOR.COMMITS: | ||
(def version (format "0.3.%s" (b/git-count-revs nil))) | ||
(def class-dir "target/classes") | ||
(def jar-file (format "target/%s-%s.jar" (name lib) version)) | ||
|
||
(defn test "Run the tests." [opts] | ||
(bb/run-tests opts)) | ||
;; delay to defer side effects (artifact downloads) | ||
(def basis (delay (b/create-basis {:project "deps.edn"}))) | ||
|
||
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts] | ||
(-> opts | ||
(assoc :lib lib :version version) | ||
(bb/run-tests) | ||
(bb/clean) | ||
(bb/jar))) | ||
(defn clean [_] | ||
(println "\nCleaning target...") | ||
(b/delete {:path "target"})) | ||
|
||
(defn install "Install the JAR locally." [opts] | ||
(-> opts | ||
(assoc :lib lib :version version) | ||
(bb/install))) | ||
(defn jar [_] | ||
(println "\nWriting pom...") | ||
(b/write-pom {:class-dir class-dir | ||
:src-pom "template/pom.xml" | ||
:scm {:tag (str "v" version)} | ||
:lib lib | ||
:version version | ||
:basis @basis | ||
:src-dirs ["src"]}) | ||
(println "\nCopyin to target...") | ||
(b/copy-dir {:src-dirs ["src" "resources"] | ||
:target-dir class-dir}) | ||
(println "\nBuilding jar...") | ||
(b/jar {:class-dir class-dir | ||
:jar-file jar-file})) | ||
|
||
(defn deploy "Deploy the JAR to Clojars." [opts] | ||
(-> opts | ||
(assoc :lib lib :version version) | ||
(bb/deploy))) | ||
(defn deploy [_] | ||
(println "\nDeploying to clojars...") | ||
(deploy/deploy | ||
{:installer :remoet | ||
:artifact (b/resolve-path jar-file) | ||
:pom-file (b/pom-path {:lib lib :class-dir class-dir})})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters