Skip to content
Snippets Groups Projects
Unverified Commit 46a95c35 authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Mac app build script improvements :apple: :wrench: (#13810)

parent 25e5f704
No related branches found
No related tags found
No related merge requests found
Showing
with 40 additions and 18 deletions
{:paths ["./"]
{:paths ["src"]
:deps
{common/common {:local/root "../bin/common"}
......
......@@ -5,6 +5,7 @@
[build :as build]
[codesign :as codesign]
[create-dmg :as create-dmg]
[download-jar :as download-jar]
[notarize :as notarize]
[sparkle-artifacts :as sparkle-artifacts]
[upload :as upload]]
......@@ -12,6 +13,7 @@
(def ^:private steps*
(ordered-map/ordered-map
:download-jar download-jar/download-jar!
:build build/build!
:codesign codesign/codesign!
:generate-sparkle-artifacts sparkle-artifacts/generate-sparkle-artifacts!
......
(ns macos-release.build
(:require [clojure.string :as str]
[macos-release.common :as c]))
[macos-release.common :as c]
[metabuild-common.core :as u]))
(def ^String info-plist-file
(c/assert-file-exists (str c/macos-source-dir "/Metabase/Metabase-Info.plist")))
......@@ -44,11 +45,11 @@
(defn- clean! []
(c/step "Clean XCode build artifacts"
(xcode-build "-project" xcode-project-file "clean")
(c/delete-file! c/artifacts-directory)))
(u/delete-file-if-exists! c/artifacts-directory)))
(defn- build-xcarchive! []
(let [filename (c/artifact "Metabase.xcarchive")]
(c/delete-file! filename)
(u/delete-file-if-exists! filename)
(c/step (format "Build %s" filename)
(xcode-build "-project" xcode-project-file
"-scheme" "Metabase"
......@@ -59,7 +60,7 @@
(defn- build-app! []
(let [filename (c/artifact "Metabase.app")]
(c/delete-file! filename)
(u/delete-file-if-exists! filename)
(c/step (format "Create %s" filename)
(xcode-build "-exportArchive"
"-exportOptionsPlist" export-options-plist-file
......
File moved
......@@ -7,6 +7,8 @@
(comment u/keep-me)
(set! *warn-on-reflection* true)
(p/import-vars
[u
announce
......
(ns macos-release.download-jar
(:require [macos-release.common :as c]
[metabuild-common.core :as u]))
(defn- uberjar-url []
(format "https://downloads.metabase.com/v%s/metabase.jar" (c/version)))
(def ^:private uberjar-dest-location
(u/filename c/root-directory "OSX" "Resources" "metabase.jar"))
(defn download-jar!
"Download the uberjar for the version of the Mac App we're building."
[]
(u/step (format "Download JAR for version %s" (c/version))
(u/download-file! (uberjar-url) uberjar-dest-location)))
File moved
File moved
......@@ -39,6 +39,7 @@
create-directory-unless-exists!
delete-file!
delete-file-if-exists!
download-file!
file-exists?
filename
find-files
......
......@@ -111,3 +111,12 @@
(throw (ex-info (format "Can't find project root directory: no parent directory of %s has a project.clj file"
(env/env :user-dir))
{:dir (env/env :user-dir)})))))
(defn download-file!
"Download a file from `url` to `dest-path` using `wget`."
[url dest-path]
{:pre [(string? url) (string? dest-path) (str/starts-with? url "http")]}
(steps/step (format "Download %s -> %s" url dest-path)
(delete-file-if-exists! dest-path)
(sh/sh {:quiet? true} "wget" "--quiet" "--no-cache" "--output-document" dest-path url)
(assert-file-exists dest-path)))
......@@ -36,9 +36,7 @@
(defn- validate-json-docker-tag []
(u/step (format "Check that Dockerrun.aws.json Docker tag is %s" (c/docker-tag))
(u/step "Download archive"
(u/delete-file-if-exists! archive-path)
(u/sh {:quiet? true} "wget" "--quiet" "--no-cache" "--output-document" archive-path
(c/artifact-download-url "metabase-aws-eb.zip")))
(u/download-file! (c/artifact-download-url "metabase-aws-eb.zip") archive-path))
(u/step "Unzip archive"
(u/delete-file-if-exists! archive-temp-dir)
(u/sh "unzip" (u/assert-file-exists archive-path) "-d" archive-temp-dir))
......
......@@ -27,8 +27,7 @@
(common.http/check-url-exists url)
(u/step (format "Check hash of %s" url)
(let [temp-location "/tmp/metabase.jar"]
(u/delete-file-if-exists! temp-location)
(u/sh {:quiet? true} "wget" "--quiet" "--no-cache" "--output-document" temp-location url)
(u/download-file! url temp-location)
(let [uberjar-hash (hash/sha-256-sum c/uberjar-path)
url-hash (hash/sha-256-sum temp-location)]
(u/announce "Hash of local metabase.jar is %s" uberjar-hash)
......
......@@ -123,10 +123,11 @@ The following steps are prereqs for *releasing* the Mac App:
-p <secret_password>
```
1) Install Clojure CLI
1) Install Clojure CLI. See [the instructions on
clojure.org](https://www.clojure.org/guides/getting_started) for more details.
```bash
brew install clojure
brew install clojure/tools/clojure
```
</details>
......@@ -139,12 +140,6 @@ After following the configuration steps above, to build and release the app you
1. Make sure you're on the appropriate release branch locally. The script reads the version number from the most recent tag
1. Copy latest uberjar to the Mac App build directory
```bash
cp path/to/metabase.jar OSX/Resources/metabase.jar
```
1. Bundle entire app, and upload to s3
```bash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment