diff --git a/build/shell/shortcut_build.sh b/build/shell/shortcut_build.sh new file mode 100755 index 0000000000..685b3aad20 --- /dev/null +++ b/build/shell/shortcut_build.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +read_char() { + stty -icanon -echo + eval "$1=\$(dd bs=1 count=1 2>/dev/null)" + stty icanon echo +} + +char= + +make run.${PLATFORM}.debug || true + +while true; do + echo + echo 'Press r -> Rebuild the native code' + printf 'Press q -> Quit tmux. If the pane is dead, use ctrl-b then & then y' + read_char char + + echo + echo + if [ "$char" = "r" ]; then + make run.${PLATFORM}.debug || true + elif [ "$char" = "q" ]; then + tmux kill-window + fi +done < "${1:-/dev/stdin}" diff --git a/js/packages/berty-app/Makefile b/js/packages/berty-app/Makefile index eb0cad52c1..1a483ada04 100644 --- a/js/packages/berty-app/Makefile +++ b/js/packages/berty-app/Makefile @@ -72,12 +72,11 @@ start: deps @echo "Metro dead ($(shell date))" cd $(PWD) && $(react-native) start \ --port=$(port) \ - --host=$(host) \ - & \ + --host=$(host) .PHONY: run run: export PWD := $(PWD) -run: deps $(if $(filter $(target), debug), start) +run: deps $(if $(filter $(platform), android), @$(berty_root)/build/shell/check-java.sh 18) $(if $(filter $(platform), android), \ $(if $(filter $(config), development), ANDROID_SDK_ROOT=$$HOME/.android clisim -af)) @@ -91,6 +90,17 @@ run: deps $(if $(filter $(target), debug), start) $(if $(filter $(platform), ios), --scheme=$(target)) \ $(if $(filter $(platform), ios), --simulator='$(device)') \ +# Use ctrl-b then pageup/pagedown to enter scroll, use escape to exit scroll mode +# Use cltr-b then & to close +# tmux: https://duckduckgo.com/?q=tmux+cheat+sheet&t=ffab&atb=v194-5__&ia=cheatsheet&iax=1 +.PHONY: run.%.tmux +run.%.tmux: export PWD := $(PWD) +run.%.tmux: deps + cd $(berty_root)/js && tmux \ + new-session '$(MAKE) start' \; \ + split-window 'PLATFORM=$* $(berty_root)/build/shell/shortcut_build.sh' \; \ + set-option remain-on-exit on + .PHONY: bundle bundle: deps.$(platform) cd $(PWD) && $(react-native) bundle \