| Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago | 1 | #!/bin/sh |
| 2 | #_( |
| 3 | exec "$(dirname "$0")/bb" "$0" "$@" |
| 4 | ) |
| 5 | |
| 6 | ;; buck2, with the machine's paths written where the BUCK files can read them. |
| 7 | ;; |
| 8 | ;; The same arrangement jolt-native uses, and for the same reason: a BUCK file |
| 9 | ;; may not look around the machine, and these answers differ on every one. |
| 10 | ;; Generated rather than committed, so no checkout carries another's paths. |
| 11 | (require '[babashka.classpath :as cp]) |
| 12 | (cp/add-classpath (str (babashka.fs/parent *file*))) |
| 13 | (require '[frq.paths :as paths] |
| 14 | '[babashka.fs :as fs] |
| 15 | '[babashka.process :as p]) |
| 16 | |
| 17 | (def root (str (fs/canonicalize (fs/path (fs/parent *file*) "..")))) |
| 18 | (def android-home (paths/env "ANDROID_HOME" (str (fs/path (fs/home) ".local" "share" "android-sdk")))) |
| 19 | (def chez (paths/env "CHEZ_ANDROID" (str (fs/path (fs/home) ".cache" "vidya-chez-android")))) |
| 20 | (def openssl (paths/env "OPENSSL_ANDROID" (str (fs/path (fs/home) ".cache" "frq-openssl-android" "lib")))) |
| 21 | |
| 22 | (paths/require-paths! "path" |
| 23 | [(fs/path android-home "build-tools" "36.0.0" "aapt2") |
| 24 | (fs/path android-home "platforms" "android-36" "android.jar") |
| 25 | (fs/path chez "boot" "tarm64le" "scheme.boot") |
| 26 | (fs/path openssl "libssl.so")]) |
| 27 | |
| Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago | 28 | ;; The boot image is compiled from source roots outside this cell — glimmer and |
| 29 | ;; glimmer-vidya, out of the jolt cache — which cannot be action inputs. Hash |
| 30 | ;; them here so the digest reaches the action instead. See android/BUCK. |
| Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago | 31 | (def boot-stamp |
| 32 | (paths/out (str (fs/path root "android" "build-jolt-boot.bb")) "--stamp")) |
| 33 | |
| 34 | (spit (str (fs/path root ".buckconfig.local")) |
| 35 | (str "[frq]\n" |
| 36 | " android_home = " android-home "\n" |
| 37 | " chez_android = " chez "\n" |
| 38 | " openssl_android = " openssl "\n" |
| 39 | " boot_stamp = " boot-stamp "\n")) |
| 40 | |
| 41 | (System/exit |
| 42 | (:exit @(apply p/process {:inherit true :dir root} |
| 43 | (str (fs/path root "scripts" "buck2")) *command-line-args*))) |