forked from phronmophobic/llama.clj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.clj
81 lines (74 loc) · 3.21 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
73
74
75
76
77
78
79
80
81
(ns build
(:require [clojure.tools.build.api :as b]
[clojure.string :as str]))
(def lib 'com.phronemophobic/llama-clj)
(def version "0.8-alpha1")
(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 src-pom "./pom-template.xml")
(defn clean [_]
(b/delete {:path "target"}))
(defn compile [_]
#_(b/javac {:src-dirs ["src-java"]
:class-dir class-dir
:basis basis
:javac-opts ["-source" "8" "-target" "8"]}))
(defn jar [opts]
(compile opts)
(b/write-pom {:class-dir class-dir
:src-pom src-pom
:lib lib
:version 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}))
(defn deploy [opts]
(jar opts)
(try ((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))
(catch Exception e
(if-not (str/includes? (ex-message e) "redeploying non-snapshots is not allowed")
(throw e)
(println "This release was already deployed."))))
opts)
(defn deploy-combined [opts]
(let [ggml-deps
'{com.phronemophobic.cljonda/llama-cpp-darwin-aarch64 {:mvn/version "6e88a462d7d2d281e33f35c3c41df785ef633bc1"}
com.phronemophobic.cljonda/llama-cpp-darwin-x86-64 {:mvn/version "6e88a462d7d2d281e33f35c3c41df785ef633bc1"}
com.phronemophobic.cljonda/llama-cpp-linux-x86-64 {:mvn/version "6e88a462d7d2d281e33f35c3c41df785ef633bc1"}}
gguf-deps
'{com.phronemophobic.cljonda/llama-cpp-gguf-linux-x86-64 {:mvn/version "c3f197912f1ce858ac114d70c40db512de02e2e0"}
com.phronemophobic.cljonda/llama-cpp-gguf-darwin-aarch64 {:mvn/version "c3f197912f1ce858ac114d70c40db512de02e2e0"}
com.phronemophobic.cljonda/llama-cpp-gguf-darwin-x86-64 {:mvn/version "c3f197912f1ce858ac114d70c40db512de02e2e0"}}
basis (b/create-basis {:project
{:deps
(merge
{lib {:mvn/version version}}
ggml-deps
gguf-deps)}})
combined-lib 'com.phronemophobic/llama-clj-combined]
(clean opts)
(b/write-pom {:class-dir class-dir
:src-pom src-pom
:lib combined-lib
:version version
:basis basis})
(b/jar {:jar-file jar-file
:class-dir class-dir})
(try ((requiring-resolve 'deps-deploy.deps-deploy/deploy)
(merge {:installer :remote
:artifact jar-file
:pom-file (b/pom-path {:lib combined-lib
:class-dir class-dir})}
opts))
(catch Exception e
(if-not (str/includes? (ex-message e) "redeploying non-snapshots is not allowed")
(throw e)
(println "This release was already deployed."))))))