mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-13 02:04:28 +00:00
[#3398] Replace re-natal with features added in build.clj script
get rid of build-conf.edn Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
f49de27e04
commit
25aa55f373
89
build.clj
89
build.clj
@ -1,5 +1,5 @@
|
|||||||
(require '[cljs.build.api :as api]
|
(require '[cljs.build.api :as api]
|
||||||
'[clojure.string :as string])
|
'[clojure.string :as str])
|
||||||
|
|
||||||
;; clj build.clj help # Prints details about tasks
|
;; clj build.clj help # Prints details about tasks
|
||||||
|
|
||||||
@ -82,10 +82,9 @@
|
|||||||
"[build-id] (optional): Build ID. When omitted, this task will compile all builds from the specified [env]."
|
"[build-id] (optional): Build ID. When omitted, this task will compile all builds from the specified [env]."
|
||||||
"[type] (optional): Build type - value could be \"once\" or \"watch\". Default: \"once\"."]}
|
"[type] (optional): Build type - value could be \"once\" or \"watch\". Default: \"once\"."]}
|
||||||
:figwheel {:desc "Start figwheel + CLJS REPL / nREPL"
|
:figwheel {:desc "Start figwheel + CLJS REPL / nREPL"
|
||||||
:usage ["Usage: clj -R:repl build.clj figwheel [build-ids] [port]"
|
:usage ["Usage: clj -R:repl build.clj figwheel [options]"
|
||||||
""
|
""
|
||||||
"[build-ids] (optional): A comma-sparated list of build IDs, i.e. \"android,ios\". Default: \"android\"."
|
"[-h|--help] to see all available options"]}
|
||||||
"[port] (optional): nREPL port. When omitted, CLJS REPL will start without nREPL session. Otherwise, an nREPL server will start on port supplied."]}
|
|
||||||
:test {:desc "Run tests"
|
:test {:desc "Run tests"
|
||||||
:usage ["Usage: clj -R:test build.clj test [build-id]"
|
:usage ["Usage: clj -R:test build.clj test [build-id]"
|
||||||
""
|
""
|
||||||
@ -169,7 +168,7 @@
|
|||||||
(println)
|
(println)
|
||||||
(->> usage
|
(->> usage
|
||||||
(map #(str " " %))
|
(map #(str " " %))
|
||||||
(string/join "\n")
|
(str/join "\n")
|
||||||
println)
|
println)
|
||||||
(println))))
|
(println))))
|
||||||
|
|
||||||
@ -205,24 +204,71 @@
|
|||||||
|
|
||||||
;;; Figwheeling task
|
;;; Figwheeling task
|
||||||
|
|
||||||
(defmethod task "figwheel" [[_ build-ids port]]
|
(def figwheel-cli-opts
|
||||||
|
[["-p" "--platform BUILD-IDS" "CLJS Build IDs for platforms <android|ios>"
|
||||||
|
:id :build-ids
|
||||||
|
:default [:android]
|
||||||
|
:parse-fn #(->> (.split % ",")
|
||||||
|
(map (comp keyword str/lower-case str/trim))
|
||||||
|
vec)
|
||||||
|
:validate [(fn [build-ids] (every? #(some? (#{:android :ios} %)) build-ids)) "Allowed \"android\", and/or \"ios\""]]
|
||||||
|
["-n" "--nrepl-port PORT" "nREPL Port"
|
||||||
|
:id :port
|
||||||
|
:parse-fn #(if (string? %) (Integer/parseInt %) %)
|
||||||
|
:validate [#(or (true? %) (< 0 % 0x10000)) "Must be a number between 0 and 65536"]]
|
||||||
|
["-a" "--android-device TYPE" "Android Device Type <avd|genymotion|real>"
|
||||||
|
:id :android-device
|
||||||
|
:parse-fn #(keyword (str/lower-case %))
|
||||||
|
:validate [#(some? (#{:avd :genymotion :real} %)) "Must be \"avd\", \"genymotion\", or \"real\""]]
|
||||||
|
["-i" "--ios-device TYPE" "iOS Device Type <simulator|real>"
|
||||||
|
:id :ios-device
|
||||||
|
:parse-fn #(keyword (str/lower-case %))
|
||||||
|
:validate [#(some? (#{:simulator :real} %)) "Must be \"simulator\", or \"real\""]]
|
||||||
|
["-h" "--help"]])
|
||||||
|
|
||||||
|
(defn print-and-exit [msg]
|
||||||
|
(println msg)
|
||||||
|
(System/exit 1))
|
||||||
|
|
||||||
|
(defn parse-figwheel-cli-opts [args]
|
||||||
|
(with-namespaces [[clojure.tools.cli :as cli]]
|
||||||
|
(let [{:keys [options errors summary]} (cli/parse-opts args figwheel-cli-opts)]
|
||||||
|
(cond
|
||||||
|
(:help options) (print-and-exit summary)
|
||||||
|
(not (nil? errors)) (print-and-exit errors)
|
||||||
|
:else options))))
|
||||||
|
|
||||||
|
(defmethod task "figwheel" [[_ & args]]
|
||||||
(with-namespaces [[figwheel-sidecar.repl-api :as ra]
|
(with-namespaces [[figwheel-sidecar.repl-api :as ra]
|
||||||
[hawk.core :as hawk]
|
[hawk.core :as hawk]
|
||||||
[re-frisk-sidecar.core :as rfs]]
|
[re-frisk-sidecar.core :as rfs]
|
||||||
(hawk/watch! [{:paths ["resources"]
|
[clj-rn.core :as clj-rn]
|
||||||
:handler (fn [ctx e]
|
[clj-rn.main :refer [get-main-config] :rename {get-main-config get-cljrn-config}]]
|
||||||
(let [path "src/status_im/utils/js_resources.cljs"
|
(let [{:keys [build-ids
|
||||||
js-resourced (slurp path)]
|
port
|
||||||
(spit path (str js-resourced " ;;"))
|
android-device
|
||||||
(spit path js-resourced))
|
ios-device]} (parse-figwheel-cli-opts args)
|
||||||
ctx)}])
|
hosts-map {:android (clj-rn/resolve-dev-host :android android-device)
|
||||||
|
:ios (clj-rn/resolve-dev-host :ios ios-device)}]
|
||||||
|
(clj-rn/enable-source-maps)
|
||||||
|
(clj-rn/write-env-dev hosts-map)
|
||||||
|
(doseq [build-id build-ids
|
||||||
|
:let [host-ip (get hosts-map build-id)
|
||||||
|
platform-name (if (= build-id :ios) "iOS" "Android")
|
||||||
|
{:keys [js-modules
|
||||||
|
name
|
||||||
|
resource-dirs]} (get-cljrn-config)]]
|
||||||
|
(clj-rn/rebuild-index-js build-id {:app-name name
|
||||||
|
:host-ip host-ip
|
||||||
|
:js-modules js-modules
|
||||||
|
:resource-dirs resource-dirs})
|
||||||
|
(when (= build-id :ios)
|
||||||
|
(clj-rn/update-ios-rct-web-socket-executor host-ip)
|
||||||
|
(println-colorized "Host in RCTWebSocketExecutor.m was updated" green-color))
|
||||||
|
(println-colorized (format "Dev server host for %s: %s" platform-name host-ip) green-color))
|
||||||
(ra/start-figwheel!
|
(ra/start-figwheel!
|
||||||
{:figwheel-options (cond-> {:builds-to-start (if build-ids
|
{:figwheel-options (cond-> {:builds-to-start build-ids}
|
||||||
(->> (.split build-ids ",")
|
port (merge {:nrepl-port port
|
||||||
(map (comp keyword string/trim))
|
|
||||||
vec)
|
|
||||||
[:android])}
|
|
||||||
port (merge {:nrepl-port (some-> port Long/parseLong)
|
|
||||||
:nrepl-middleware ["cider.nrepl/cider-middleware"
|
:nrepl-middleware ["cider.nrepl/cider-middleware"
|
||||||
"refactor-nrepl.middleware/wrap-refactor"
|
"refactor-nrepl.middleware/wrap-refactor"
|
||||||
"cemerick.piggieback/wrap-cljs-repl"]}))
|
"cemerick.piggieback/wrap-cljs-repl"]}))
|
||||||
@ -231,12 +277,11 @@
|
|||||||
{:id build-id
|
{:id build-id
|
||||||
:source-paths (conj source-paths "env/dev")
|
:source-paths (conj source-paths "env/dev")
|
||||||
:compiler compiler
|
:compiler compiler
|
||||||
:warning-handlers warning-handlers
|
|
||||||
:figwheel true}))})
|
:figwheel true}))})
|
||||||
(rfs/-main)
|
(rfs/-main)
|
||||||
(if-not port
|
(if-not port
|
||||||
(ra/cljs-repl)
|
(ra/cljs-repl)
|
||||||
(spit ".nrepl-port" port))))
|
(spit ".nrepl-port" port)))))
|
||||||
|
|
||||||
;;; Help
|
;;; Help
|
||||||
|
|
||||||
|
40
clj-rn.conf.edn
Normal file
40
clj-rn.conf.edn
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{:name "StatusIm"
|
||||||
|
|
||||||
|
;; JS modules
|
||||||
|
:js-modules ["realm"
|
||||||
|
"react-native-i18n"
|
||||||
|
"realm/react-native"
|
||||||
|
"dismissKeyboard"
|
||||||
|
"react-native-splash-screen"
|
||||||
|
"react-native-status"
|
||||||
|
"react-native-camera"
|
||||||
|
"react-native-qrcode"
|
||||||
|
"identicon.js"
|
||||||
|
"react-native-fs"
|
||||||
|
"react-native-dialogs"
|
||||||
|
"react-native-image-resizer"
|
||||||
|
"react-native-image-crop-picker"
|
||||||
|
"react-native-securerandom"
|
||||||
|
"react-native-webview-bridge"
|
||||||
|
"react-native-fcm"
|
||||||
|
"homoglyph-finder"
|
||||||
|
"web3"
|
||||||
|
"chance"
|
||||||
|
"instabug-reactnative"
|
||||||
|
"nfc-react-native"
|
||||||
|
"react-native-http-bridge"
|
||||||
|
"emojilib"
|
||||||
|
"react-native-config"
|
||||||
|
"react-native-svg"
|
||||||
|
"react-native-keychain"
|
||||||
|
"rn-snoopy"
|
||||||
|
"rn-snoopy/stream/bars"
|
||||||
|
"rn-snoopy/stream/filter"
|
||||||
|
"rn-snoopy/stream/buffer"
|
||||||
|
"react-native/Libraries/vendor/emitter/EventEmitter"
|
||||||
|
"react-native-background-timer"
|
||||||
|
"react-native-fetch-polyfill"
|
||||||
|
"react-native-testfairy"]
|
||||||
|
|
||||||
|
;; Resoures
|
||||||
|
:resource-dirs ["resources/images"]}
|
4
deps.edn
4
deps.edn
@ -28,6 +28,8 @@
|
|||||||
;; CIDER compatible nREPL
|
;; CIDER compatible nREPL
|
||||||
cider/cider-nrepl {:mvn/version "0.16.0"}
|
cider/cider-nrepl {:mvn/version "0.16.0"}
|
||||||
org.clojure/tools.nrepl {:mvn/version "0.2.13"}
|
org.clojure/tools.nrepl {:mvn/version "0.2.13"}
|
||||||
refactor-nrepl {:mvn/version "2.3.1"}}}
|
refactor-nrepl {:mvn/version "2.3.1"}
|
||||||
|
org.clojure/tools.cli {:mvn/version "0.3.7"}
|
||||||
|
clj-rn {:git/url "https://github.com/status-im/clj-rn" :sha "e3fe471c601b2fa890f8692757aab74adf96fa28"}}}
|
||||||
:test {:extra-deps {day8.re-frame/test {:mvn/version "0.1.5"}
|
:test {:extra-deps {day8.re-frame/test {:mvn/version "0.1.5"}
|
||||||
doo {:mvn/version "0.1.9"}}}}}
|
doo {:mvn/version "0.1.9"}}}}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user