mtklein | f3155ad | 2016-09-08 10:03:21 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Run a GN-built Android binary on the connected device. |
| 4 | # |
| 5 | # Example usage: |
| 6 | # $ ninja -C out dm |
| 7 | # $ droid out/dm --src gm --config gpu |
| 8 | # |
| 9 | # See https://skia.org/user/quick/gn for build instructions. |
| 10 | |
Hal Canary | 9db44ed | 2018-08-23 10:28:37 -0400 | [diff] [blame] | 11 | dst_dir=/data/local/tmp |
| 12 | path="$1" |
| 13 | name="$(basename "$path")" |
mtklein | f3155ad | 2016-09-08 10:03:21 -0700 | [diff] [blame] | 14 | shift |
Hal Canary | 9db44ed | 2018-08-23 10:28:37 -0400 | [diff] [blame] | 15 | |
| 16 | if ! [ -d resources ]; then |
| 17 | echo run this from the skia tree |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
| 21 | dirs='' |
| 22 | for dir in $(find resources -type d); do dirs="$dirs \"${dir}\""; done |
mtklein | f3155ad | 2016-09-08 10:03:21 -0700 | [diff] [blame] | 23 | |
| 24 | set -e |
| 25 | set -x |
| 26 | |
Hal Canary | 9db44ed | 2018-08-23 10:28:37 -0400 | [diff] [blame] | 27 | adb shell "cd \"$dst_dir\"; mkdir -p $dirs" |
| 28 | adb push --sync resources "${dst_dir}/" |
| 29 | adb push --sync "$path" "${dst_dir}/${name}" |
| 30 | adb shell "cd \"$dst_dir\"; chmod +x \"$name\"; \"./$name\" $*" |