Skip to content

Commit 8fd8474

Browse files
committed
Another build script fix 🔧
1 parent a6e23bc commit 8fd8474

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

bin/build-mb/build.clj

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,22 @@
2323
"oss" :ce
2424
"ee" :ee)))
2525

26-
(defn- build-frontend! []
27-
(u/step "Build frontend"
28-
(u/step "Run 'yarn' to download javascript dependencies"
29-
(u/sh {:dir u/project-root-directory} "yarn"))
30-
(u/step "Run 'webpack' with NODE_ENV=production to assemble and minify frontend assets"
31-
(u/sh {:dir u/project-root-directory
32-
:env {"PATH" (env/env :path)
33-
"HOME" (env/env :user-home)
34-
"NODE_ENV" "production"
35-
"MB_EDITION" (name (edition-from-env-var))}}
36-
"./node_modules/.bin/webpack" "--bail"))
37-
(u/announce "Frontend built successfully.")))
26+
(defn- build-frontend! [edition]
27+
{:pre [(#{:ce :ee} edition)]}
28+
(let [mb-edition (case edition
29+
:ee "ee"
30+
:ce "oss")]
31+
(u/step (format "Build frontend with MB_EDITION=%s" mb-edition)
32+
(u/step "Run 'yarn' to download javascript dependencies"
33+
(u/sh {:dir u/project-root-directory} "yarn"))
34+
(u/step "Run 'webpack' with NODE_ENV=production to assemble and minify frontend assets"
35+
(u/sh {:dir u/project-root-directory
36+
:env {"PATH" (env/env :path)
37+
"HOME" (env/env :user-home)
38+
"NODE_ENV" "production"
39+
"MB_EDITION" mb-edition}}
40+
"./node_modules/.bin/webpack" "--bail"))
41+
(u/announce "Frontend built successfully."))))
3842

3943
(def uberjar-filename (u/filename u/project-root-directory "target" "uberjar" "metabase.jar"))
4044

@@ -45,7 +49,7 @@
4549
:ee "ee"
4650
:ce "oss")]
4751
(u/delete-file-if-exists! uberjar-filename)
48-
(u/step "Build uberjar"
52+
(u/step (format "Build uberjar with profile %s" profile)
4953
(u/sh {:dir u/project-root-directory} "lein" "clean")
5054
(u/sh {:dir u/project-root-directory} "lein" "with-profile" (str \+ profile) "uberjar")
5155
(u/assert-file-exists uberjar-filename)
@@ -57,8 +61,8 @@
5761
(version-info/generate-version-info-file! version))
5862
:translations (fn [_]
5963
(build-translation-resources!))
60-
:frontend (fn [_]
61-
(build-frontend!))
64+
:frontend (fn [{:keys [edition]}]
65+
(build-frontend! edition))
6266
:drivers (fn [_]
6367
(build-drivers/build-drivers!))
6468
:uberjar (fn [{:keys [edition]}]

0 commit comments

Comments
 (0)