-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbb.edn
123 lines (103 loc) · 5.13 KB
/
bb.edn
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{:min-bb-version "1.3.182"
:paths ["." "scripts"]
:deps {lread/status-line {:git/url "https://github.com/lread/status-line.git"
:sha "cf44c15f30ea3867227fa61ceb823e5e942c707f"}}
:tasks
{:requires ([babashka.fs :as fs]
[babashka.tasks :as tasks]
[babashka.process :refer [tokenize]]
[build-shared :as bs]
[clojure.string :as str])
:enter (when (not (str/starts-with? (:name (current-task)) "-"))
(println (format "-[graal-build-time %s]----" (:name (current-task)))))
:init
(do
(def windows? (str/starts-with? (System/getProperty "os.name")
"Windows"))
(defn clojure
"Clojure defaulting to stderr output"
[arg & args]
(apply tasks/clojure (str "-J-Dclojure.main.report=stderr " arg) args)))
clean {:doc "Clean target dir"
:task (do
(doseq [dir ["target" ".cpcache"]]
(fs/delete-tree dir))
(doseq [dir ["test-hello-world" "test-single-segment"]]
(shell {:dir dir} "bb clean")))}
compile-sources {:doc "Compile sources"
:task (if (seq (fs/modified-since bs/class-dir ["deps.edn" "src"]))
(clojure "-T:build compile-sources")
(println "Sources already compiled to" bs/class-dir))}
jar {:doc "Build jar"
:depends [compile-sources]
:task (if (seq (fs/modified-since bs/jar-file [bs/class-dir]))
(clojure "-T:build jar")
(println "Jar is already up to date" bs/jar-file))}
jar-name {:doc "Return jar name for test-hello-world build"
:task (println bs/jar-file)}
install {:doc "Install jar in local maven repo"
:depends [jar]
:task (clojure "-T:build install")}
build-hello-world {:doc "Build jars, classes for testing"
:task (shell {:dir "test-hello-world"}
"bb build")}
build-single-segment {:doc "Build jars, classes for single segment testing"
:task (shell {:dir "test-single-segment"}
"bb build")}
test {:doc "Runs tests"
:task (clojure "-X:test")}
native-image-test {:doc "Runs native image hello world tests"
:task (shell {:dir "test-hello-world"}
"bb native-image-test")}
lint {:doc "[--rebuild] Lint source code with clj-kondo"
:task lint/-main}
outdated {:doc "Report on outdated dependencies"
:task (clojure "-M:outdated" (str "--directory=" (str/join ":" ["."
"test-hello-world"
"test-hello-world/lib1"
"test-hello-world/lib2"
"test-single-segment"
"build-helper"])))}
change-log-check {:doc "Checks that change log is ready for publish"
:task (bs/change-log-check)}
-change-log-update {:doc "Updates change log for current version"
:depends [change-log-check]
:task (bs/change-log-update)}
-bump-version (do
(bs/refresh-version)
(println "Bumping current version" bs/version)
(load-file "scripts/bump_version.clj")
(bs/refresh-version)
(println "Bumped version to" bs/version))
-commit-release (do
(println "Committing changes made for release")
(shell "git add resources/clj-easy/graal-build-time-version.txt CHANGELOG.md")
(shell "git commit -m 'Bump version'"))
-tag (do
(println (str "Tagging with version v" bs/version))
(shell (str "git tag v" bs/version)))
publish {:doc "Cut a new release"
:task (do
(run 'change-log-check)
(run '-bump-version)
(run '-change-log-update)
(run '-commit-release)
(run '-tag)
(println "Pushing commit to github")
(shell "git push --atomic origin main"
(str "v" bs/version)))}
-current-branch (->> (shell {:out :string} "git rev-parse --abbrev-ref HEAD")
:out
str/trim)
-can-release {:depends [-current-branch]
:task (= "main" -current-branch)}
deploy {:doc "Deploys to clojars, automatically run on CI"
:depends [-can-release]
:task (if -can-release
(do
(run 'jar)
(println "All set for deployment 🚀🚀")
(tasks/clojure
{:continue true}
"-J-Dclojure.main.report=stderr -T:build deploy"))
(println "Conditions for release did not pass, not deploying."))}}}