Skip to content

Commit

Permalink
remove build-clj build dep
Browse files Browse the repository at this point in the history
  • Loading branch information
jsn committed Jan 24, 2024
1 parent a205118 commit a50aadc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
49 changes: 31 additions & 18 deletions build.clj
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})}))
5 changes: 3 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
:extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
io.github.cognitect-labs/test-runner
{:git/tag "v0.5.1" :git/sha "dfb30dd"}}}
:build {:deps {io.github.seancorfield/build-clj
{:git/tag "v0.8.2" :git/sha "0ffdb4c"}}

:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.6"}
slipset/deps-deploy {:mvn/version "0.2.2"}}
:ns-default build}
:neil {:project {:name io.github.suprematic/ncr.clj.bot-api}}}}
1 change: 0 additions & 1 deletion template/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<url>https://github.com/suprematic/ncr.clj.bot-api</url>
<connection>scm:git:git://github.com/suprematic/ncr.clj.bot-api.git</connection>
<developerConnection>scm:git:ssh://git@github.com/suprematic/ncr.clj.bot-api.git</developerConnection>
<tag>v0.2.0-SNAPSHOT</tag>
</scm>
<dependencies>
<dependency>
Expand Down

0 comments on commit a50aadc

Please sign in to comment.