aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn22
-rwxr-xr-xgn/push_to_android.py21
2 files changed, 42 insertions, 1 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 681a7882e3..2c9335cca1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -25,6 +25,7 @@ declare_args() {
skia_use_piex = !is_win
skia_use_zlib = true
+ skia_android_serial = ""
skia_enable_android_framework_defines = false
skia_enable_discrete_gpu = true
skia_enable_gpu = true
@@ -771,11 +772,30 @@ if (skia_enable_tools) {
testonly = true
}
} else {
- executable(target_name) {
+ _executable = target_name
+ executable(_executable) {
forward_variables_from(invoker, "*", [ "is_shared_library" ])
testonly = true
}
}
+ if (is_android && skia_android_serial != "" && defined(_executable)) {
+ action("push_" + target_name) {
+ script = "gn/push_to_android.py"
+ deps = [
+ ":" + _executable,
+ ]
+ _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
+ outputs = [
+ _stamp,
+ ]
+ args = [
+ rebase_path("$root_build_dir/$_executable"),
+ skia_android_serial,
+ rebase_path(_stamp),
+ ]
+ testonly = true
+ }
+ }
}
test_lib("gpu_tool_utils") {
diff --git a/gn/push_to_android.py b/gn/push_to_android.py
new file mode 100755
index 0000000000..b9ab36fa52
--- /dev/null
+++ b/gn/push_to_android.py
@@ -0,0 +1,21 @@
+#!/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)
+
+# adb push is verbose, so eat its output with check_output().
+subprocess.check_output(['adb', '-s', serial, 'push', host, device])
+subprocess.check_call(['adb', '-s', serial, 'shell', 'chmod', '+x', device])
+
+# Touch a file to let GN/Ninja know we succeeded.
+with open(stamp, 'w'):
+ pass