-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #443 from lread/lread-dev-guide-and-some-tasks
Flesh out developer guide and add some bb tasks
- Loading branch information
Showing
12 changed files
with
739 additions
and
24 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
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
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
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
(ns build | ||
(:require [clojure.tools.build.api :as b] | ||
[clojure.string :as string])) | ||
|
||
(defn- num-releases | ||
"We'll assume num tags = num releases" | ||
[] | ||
(-> (b/git-process {:git-args "tags"}) | ||
(string/split-lines) | ||
count)) | ||
|
||
(def lib 'etaoin/etaoin) | ||
(def version (format "1.0.%d" (inc (num-releases)))) | ||
(def class-dir "target/classes") | ||
(def basis (b/create-basis {:project "deps.edn"})) | ||
(def jar-file (format "target/%s-%s.jar" (name lib) version)) | ||
(def built-jar-version-file "target/built-jar-version.txt") | ||
|
||
(defn clean [_] | ||
(b/delete {:path "target"})) | ||
|
||
(defn jar | ||
"Build library jar file. | ||
Also writes built version to target/built-jar-version.txt for easy peasy pickup by any interested downstream operation. | ||
We use the optional :version-suffix to optionally distinguish local installs from productin releases. | ||
For example, when installing for a cljdoc preview suffix is: cljdoc-preview." | ||
[{:keys [version-suffix] :as opts}] | ||
(let [version (if version-suffix | ||
(format "%s-%s" version version-suffix) | ||
version)] | ||
|
||
(b/write-pom {:class-dir class-dir | ||
:lib lib | ||
:version version | ||
:scm {:tag version} | ||
:basis basis | ||
:src-dirs ["src"]}) | ||
(b/copy-dir {:src-dirs ["src" "resources"] | ||
:target-dir class-dir}) | ||
(b/jar {:class-dir class-dir | ||
:jar-file jar-file}) | ||
(spit built-jar-version-file version) | ||
(assoc opts :built-jar-version version))) | ||
|
||
(defn install [opts] | ||
(clean opts) | ||
(let [{:keys [built-jar-version]} (jar opts)] | ||
(b/install {:class-dir class-dir | ||
:lib lib | ||
:version built-jar-version | ||
:basis basis | ||
:jar-file jar-file}))) | ||
|
||
(defn publish [opts] | ||
(clean opts) | ||
(jar opts) | ||
((requiring-resolve 'deps-deploy.deps-deploy/deploy) | ||
(merge {:installer :remote | ||
:artifact jar-file | ||
:pom-file (b/pom-path {:lib lib :class-dir class-dir})} | ||
opts)) | ||
opts) |
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
Oops, something went wrong.