nandi/frqpublic Fork 0
03d5a6b415596ef67c4a9f68cfd4476e3ebd0afb
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

apk.bb · 41 lines · 1.5 KBBlitzBasic Blame HistoryRaw
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago1#!/bin/sh
2#_(
3exec "$(dirname "$0")/bb" "$0" "$@"
4)
5
6;; The APK, built as a graph.
7;;
8;; apk.bb [build|install|run|log]
9;;
10;; The build itself is android/BUCK; this only asks buck for the file and then
11;; does what was asked with it. android/build-apk.bb is the same APK built step
12;; by step instead, for when the graph is what is being doubted.
13(require '[babashka.classpath :as cp])
14(cp/add-classpath (str (babashka.fs/parent *file*)))
15(require '[frq.paths :as paths]
16 '[babashka.fs :as fs]
17 '[babashka.process :as p]
18 '[clojure.string :as str])
19
20(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
21(def action (or (first *command-line-args*) "build"))
22(def adb (paths/env "ADB" (str (fs/path (fs/home) ".local" "share" "android-sdk"
23 "platform-tools" "adb"))))
24(def package "uk.nandi.frq")
25
26(defn apk []
27 (->> (paths/out (str (fs/path root "scripts" "buck.bb"))
28 "build" "--show-output" "//:apk")
29 str/split-lines
30 (some #(when (str/includes? % "frq.apk") (second (str/split % #"\s+"))))
31 (str root "/")))
32
33(case action
34 "build" (println (apk))
35 "install" (p/shell adb "install" "-r" (apk))
36 "run" (let [file (apk)]
37 (p/shell adb "install" "-r" file)
38 (p/shell adb "shell" "am" "force-stop" package)
39 (p/shell adb "shell" "am" "start" "-n" (str package "/.FrqActivity")))
40 "log" (p/shell adb "logcat" "-s" "VidyaJolt" "Vidya")
41 (paths/die "usage: apk.bb [build|install|run|log]"))