skia2/gn/push_to_android.py
Mike Klein a005acc036 skia_android_serial = "auto"
Handy if you only have one device plugged in at a time.

Note that when used, this makes GN treat all devices' serial numbers as "auto", so it won't re-push if you swap devices until you change the binary that's being pushed.

Change-Id: I1f72133d6d8c4b5569734f191d414088e0b41f06
Reviewed-on: https://skia-review.googlesource.com/6948
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2017-01-12 16:30:17 +00:00

24 lines
631 B
Python
Executable File

#!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
host, serial, stamp = sys.argv[1:]
device = '/data/local/tmp/' + os.path.basename(host)
restrict = [] if serial == 'auto' else ['-s', serial]
# adb push is verbose, so eat its output with check_output().
subprocess.check_output(['adb'] + restrict + ['push', host, device])
subprocess.check_call(['adb'] + restrict + ['shell', 'chmod', '+x', device])
# Touch a file to let GN/Ninja know we succeeded.
with open(stamp, 'w'):
pass