Home | History | Annotate | Download | only in bin
      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 
     11 dst_dir=/data/local/tmp
     12 path="$1"
     13 name="$(basename "$path")"
     14 shift
     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
     23 
     24 set -e
     25 set -x
     26 
     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\" $*"
     31