aboutsummaryrefslogtreecommitdiff
path: root/bb.edn
blob: 00c6add5c9d8eaa5df9597438ea9f1594aecd81b (plain)
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
{:tasks
 {:requires ([babashka.fs :as fs]
             [clojure.string :as str])
  :init (let [windows? (str/starts-with? (System/getProperty "os.name") "Windows")]
          (if windows?
            (do
              (println "Cannot run on Windows !")
              (System/exit 1))))

  clean {:doc "Removes target folder."
         :task (fs/delete-tree "target")}

  nrepl {:doc "Starts a nrepl session."
         :task (apply clojure "-M:nrepl" *command-line-args*)}

  storm {:doc "Starts a nrepl session with storm debugger."
         :task (apply clojure "-M:storm" *command-line-args*)}

  lib:run:main {:doc "Run's main only for cljcc library."
                :task (apply shell {:dir "cljcc-compiler"} "clojure -M -m cljcc.cljcc" *command-line-args*)}

  lib:build:jar {:doc "Builds uberjar only for cljcc lib."
                 :task (shell {:dir "cljcc-compiler"} "clojure -T:build ci")}

  lib:build:wasm {:doc "Builds native WASM image."
                  :depends [lib:build:jar]
                  :task (shell {:dir "target/lib"}
                               "native-image"
                               "--tool:svm-wasm"
                               "-jar" "cljcc-lib.jar"
                               "-o" "cljcc-lib-wasm"
                               "--features=clj_easy.graal_build_time.InitClojureClasses"
                               "--initialize-at-build-time"
                               "--verbose")}

  cli:run:main {:doc "Run's main CLI function."
                :task (apply shell {:dir "cli"} "clojure -M -m cli.cli" *command-line-args*)}

  cli:build:jar {:doc "Builds uberjar for CLI."
                 :task (shell {:dir "cli"} "clojure -T:build ci")}

  cli:run:jar {:doc "Runs CLI jar."
               :depends [cli:build:jar]
               :task (apply shell "java -jar target/cli/cljcc-cli.jar" *command-line-args*)}

  cli:build:wasm {:doc "Builds native image for WASM."
                  :depends [cli:build:jar]
                  :task
                  (shell {:dir "target/cli"}
                         "native-image"
                         "--tool:svm-wasm"
                         "-jar" "cljcc-cli.jar"
                         "-o" "cljcc-cli-wasm"
                         "--features=clj_easy.graal_build_time.InitClojureClasses"
                         "--initialize-at-build-time"
                         "--verbose")}

  cli:build:native {:doc "Builds native image for CLI."
                    :depends [cli:build:jar]
                    :task
                    (shell {:dir "target/cli"}
                           "native-image"
                           "-jar" "cljcc-cli.jar"
                           "-o" "cljcc-cli"
                           "-Ob"        ; quick compilation flag for development
                           "-H:+ReportExceptionStackTraces"
                           "--features=clj_easy.graal_build_time.InitClojureClasses"
                           "--initialize-at-build-time"
                           "--report-unsupported-elements-at-runtime"
                           "--verbose"
                           "--no-fallback")}}}