Skip to content

Commit

Permalink
feat(mobile-build): add tmux config to have better devx
Browse files Browse the repository at this point in the history
  • Loading branch information
n0izn0iz committed Nov 28, 2019
1 parent 6f2a035 commit 375de19
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
28 changes: 28 additions & 0 deletions 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}"
16 changes: 13 additions & 3 deletions js/packages/berty-app/Makefile
Expand Up @@ -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))
Expand All @@ -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 \
Expand Down

0 comments on commit 375de19

Please sign in to comment.