diff options
| author | ArenaL5 <arenal5@gmx.com> | 2019-11-30 13:31:07 +0000 |
|---|---|---|
| committer | ArenaL5 <arenal5@gmx.com> | 2019-11-30 13:31:07 +0000 |
| commit | 5efae55c8d6f2328349984fb7d5fdd7081636eb2 (patch) | |
| tree | d7b3d410284e6edc634a1c0ee1e10cc6688100cc /scripts/adb.sh | |
| parent | 74bee1d671a17c3d8c607bf4a73fed724cae6571 (diff) | |
| download | AnySoftKeyboard-5efae55c8d6f2328349984fb7d5fdd7081636eb2.tar.gz AnySoftKeyboard-5efae55c8d6f2328349984fb7d5fdd7081636eb2.tar.bz2 | |
Add adb script for debugging
adb.sh can be run from everywhere in the project. It will filter a logcat and output only the tags related to the project, at the priority level you select.
Diffstat (limited to 'scripts/adb.sh')
| -rwxr-xr-x | scripts/adb.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/adb.sh b/scripts/adb.sh new file mode 100755 index 000000000..76922f8dd --- /dev/null +++ b/scripts/adb.sh @@ -0,0 +1,38 @@ +#! /bin/bash + +if (( $# != 1 )); then + echo "Syntax: adb.sh [E|W|I|D|V] + + adb.sh discards logcat lines not related with this project. + By default, it outputs messages with priority debug and higher; + use an initial to choose another level (Error/Warning/Info/Debug/Verbose)" +else + # These variables are just to higlight text: + color="\033[0;36m" + nocolor="\033[0m" + error="\033[0;31m" + # Retrieving current working path + oldpath="$(pwd)" + echo -e "${color}Searching${nocolor} for tags in source codeā¦" + # cd project_root_folder + # This will traverse from current folder to its parent folderwork until it finds a .git folder: + cd "$(dirname "$0")" + while [ ! -d ".git" ] + do + cd .. + if [[ "$(pwd)" == "/" ]]; then + echo -e "${error}Aborting.${nocolor} Not inside a Git project." + exit 1 + fi + done + tags=`grep -R 'TAG = ".*"' app/src/main/java/com/* jnidictionaryv1/src/main/java/com/* jnidictionaryv2/src/main/java/com/*` + # We can go back to our original folder now: + cd "$oldpath" + tags="$(echo $tags | sed -E 's![a-z/A-Z12]*\.java: (protected |private )?(static )?(final )?String [A-Z_]* = "([^\"]*)";!\4!g')" + comm="adb logcat $(echo "$tags " | sed "s/ /:$1 /g")*:S" + echo -e "${color}Running: $nocolor$comm" + # Run command: + echo -e "${color}Logcat:$nocolor" + $comm +fi + |
