-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.boot
101 lines (89 loc) · 3.83 KB
/
build.boot
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
(set-env!
:source-paths #{"src"}
:resource-paths #{"resources"}
:dependencies '[[thheller/shadow-cljs "2.4.20" :scope "test"]
[deraen/boot-sass "0.3.1" :scope "test"]
[cheshire "5.8.0"]
[org.clojure/clojure "1.10.0-alpha6"]
[org.clojure/clojurescript "1.10.339"]
[ring "1.7.0-RC1"]
[clj-time "0.14.4"]
[compojure "1.6.1"]
[reagent "0.8.1" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/create-react-class cljsjs/react-dom-server]]
[re-frame "0.10.5" :exclusions [reagent]]
[http-kit "2.3.0"]])
(task-options!
pom {:project 'puertorico
:version "0.1.0-SNAPSHOT"}
aot {:namespace '#{puertorico.server}}
jar {:main 'puertorico.server
:manifest {"Description" "Puerto Rico game in Clojure(Script)"
"Url" "https://github.com/kanwei/puertorico"}})
(defn get-shadow-cljs-deps []
(:dependencies (clojure.edn/read-string (slurp "shadow-cljs.edn"))))
(defn- generate-lein-project-file! []
(require 'clojure.java.io)
(let [pfile ((resolve 'clojure.java.io/file) "project.clj")
; Only works when pom options are set using task-options!
{:keys [project version]} (:task-options (meta #'boot.task.built-in/pom))
prop #(when-let [x (get-env %2)] [%1 x])
head (list* 'defproject (or project 'boot-project) (or version "0.0.0-SNAPSHOT")
(concat
(prop :url :url)
(prop :license :license)
(prop :description :description)
[:dependencies (vec (concat
(get-env :dependencies)
(get-shadow-cljs-deps)))
:repositories (get-env :repositories)
:source-paths (vec (concat (get-env :source-paths)
(get-env :resource-paths)))]))
proj (pp-str head)]
(spit pfile proj)))
(deftask lein-generate
"Generate a leiningen `project.clj` file.
This task generates a leiningen `project.clj` file based on the boot
environment configuration, including project name and version (generated
if not present), dependencies, and source paths. Additional keys may be added
to the generated `project.clj` file by specifying a `:lein` key in the boot
environment whose value is a map of keys-value pairs to add to `project.clj`."
[]
(generate-lein-project-file!))
(require '[deraen.boot-sass :refer :all])
(require '[boot.util :as util])
(require '[boot.core :as core])
(require '[boot.shadow-cljs :as cljs])
(require '[shadow.cljs.devtools.server :as shadow-server])
(require '[shadow.cljs.devtools.api :as shadow])
(deftask shadow-dev []
(core/with-pass-thru [fs]
(shadow-server/start!)
(shadow/watch :puertorico-client)))
(deftask dev
"Run when developing"
[]
(lein-generate)
(comp
(eval '(do (require '[puertorico.prboot :as prboot])
(prboot/initialize-dev)))
(shadow-dev)
(repl :port 63001
:server true)
(watch)
(sass :output-style :nested)))
(deftask releasejs
[]
#_(server/start!)
(shadow/release :puertorico-client))
(deftask uberjar
"Build uberjar"
[]
(comp
#_(cljs :optimizations :advanced
:compiler-options {:output-wrapper true})
(sass :output-style :compressed)
#_(cljs/release :builds #{:puertorico-client})
(aot)
#_(pom)
(uber)
(target)))