-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.clj
68 lines (62 loc) · 1.84 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
(ns build
(:require
[clojure.pprint :refer [pprint]]
[clojure.tools.build.api :as b]
[publicize.core :as p]))
(def lib 'land.bnert/publicize)
(def version "0.4.0")
(def target-dir "target")
(def class-dir (str target-dir "/classes"))
(def pom-data
[[:licenses
[:license
[:name "Eclipse Public License version 2.0"]
[:url "https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt"]
[:distribution "repo"]]]])
(defn clean [_]
(println "Cleaning...")
(b/delete {:path "target"})
(println "Done.")
{})
(defn basis [_]
(let [b (p/clean-clojure-dep (b/create-basis {:project "deps.edn"}))]
(println (keys b))
(pprint
(:deps b))
(pprint
(:libs b))))
(defn jar [_]
(clean nil)
(let [basis (p/clean-clojure-dep (b/create-basis {:project "deps.edn"}))
jar-path (format (str target-dir "/%s-%s.jar")
(name lib)
version)]
(println "Writing pom...")
(b/write-pom
{:basis basis
:class-dir class-dir
:lib lib
:pom-data pom-data
:src-dirs (get basis :paths ["src"])
:scm {:url "https://github.com/bnert-land/publicize"}
:version version})
(println "Copying src...")
(b/copy-dir
{:src-dirs (get basis :paths ["src"])
:target-dir class-dir})
(println "Building jar...")
(b/jar
{:class-dir class-dir
:jar-file jar-path})
(println "Done.")
{:jar-file jar-path
:lib lib
:pom-file (b/pom-path {:lib lib, :class-dir class-dir})
:version version}))
(defn publicize [_]
(let [result (jar nil)]
(println "Publicizing...")
(p/publicize (into result
{:username (System/getenv "CLOJARS_USERNAME")
:password (System/getenv "CLOJARS_PASSWORD")}))
(println "Done.")))