-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.clj
72 lines (61 loc) · 2.5 KB
/
build.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(ns build
(:refer-clojure :exclude [compile])
(:require [clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as dd]))
(def lib 'com.fluree/db)
(def version "3.0.0-alpha2")
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file "target/fluree-db.jar")
(def source-uri "https://github.com/fluree/db")
(defn compile [_]
(b/javac {:src-dirs ["src/java"]
:class-dir class-dir
:basis basis
:javac-opts ["--release" "11"]}))
(defn clean [_]
(b/delete {:path "target"}))
(defn jar [_]
(compile nil)
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src/clj"]
:scm {:url source-uri
:connection "scm:git:https://github.com/fluree/db.git"
:developerConnection "scm:git:[email protected]:fluree/db.git"}
:pom-data [[:licenses
[:license
[:name "EPL-2.0"]
[:url "https://www.eclipse.org/legal/epl-2.0"]]]]})
(b/copy-dir {:src-dirs ["src/clj" "resources"]
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
(defn install [_]
(b/install {:basis basis
:lib lib
:version version
:jar-file jar-file
:class-dir class-dir}))
(defn docs [{:keys [output-path]}]
;; This is (for now) the best way to run things like codox that expect the
;; full project classpath to be available.
(let [opts (cond-> {:version version
:source-uri (str source-uri
"/blob/v{version}/{filepath}#L{line}")}
output-path (assoc :output-path output-path))]
(b/process {:command-args ["clojure" "-X:docs" (pr-str opts)]})))
(defn deploy [_]
(dd/deploy {:installer :remote
:artifact jar-file
:pom-file (b/pom-path {:lib lib, :class-dir class-dir})}))
(defn sync-package-json [{:keys [target node?]}]
(let [node-arg (when node? "--node")
cmd-args (remove nil? ["bb" "run" "sync-package-json" version
(str target) node-arg])]
(println "cmd args:" (pr-str cmd-args))
(b/process {:command-args cmd-args})))
(defn print-version [_]
(println (pr-str {:version version})))