1load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") 2load("//bazel:flags.bzl", "string_flag_with_values") 3 4package( 5 default_applicable_licenses = ["//:license"], 6) 7 8licenses(["notice"]) 9 10go_library( 11 name = "adb_test_runner_lib", 12 srcs = ["adb_test_runner.go"], 13 importpath = "go.skia.org/skia/tools/testrunners/common/android/adb_test_runner", 14 visibility = ["//visibility:private"], 15 deps = [ 16 "//bazel/device_specific_configs", 17 "@org_golang_x_exp//slices", 18 "@org_skia_go_infra//go/exec", 19 ], 20) 21 22go_binary( 23 name = "adb_test_runner", 24 embed = [":adb_test_runner_lib"], 25 visibility = ["//visibility:public"], 26) 27 28# This flag controls the platform for which the adb_test_runner Go program gets compiled when 29# building an adb_test target. This allows us to build an Android test from an x86_64 Linux machine 30# on GCE and switch the adb_test_runner platform to linux_arm64 so it can be executed from a 31# Raspberry Pi in a subsequent CI task. 32string_flag_with_values( 33 name = "adb_platform", 34 values = [ 35 # These are shorthand for rules_go platforms, e.g. 36 # @io_bazel_rules_go//go/toolchain:linux_amd64. 37 # 38 # To make the CPU part more readable, we replace "amd64" with "x86", which makes it more 39 # visually distinct from "arm64". We map the CPU dimension back to GOARCH style in 40 # adb_test.bzl. 41 # 42 # We can add more platforms as needed. The source of truth for rules_go platforms is 43 # https://github.com/bazelbuild/rules_go/blob/5933b6ed063488472fc14ceca232b3115e8bc39f/go/private/platforms.bzl. 44 "linux_x86", 45 "linux_arm64", 46 "darwin_x86", 47 "darwin_arm64", 48 "windows_x86", 49 "windows_arm64", 50 ], 51) 52 53go_test( 54 name = "adb_test_runner_test", 55 srcs = ["adb_test_runner_test.go"], 56 embed = [":adb_test_runner_lib"], 57 deps = [ 58 "@com_github_stretchr_testify//assert", 59 "@com_github_stretchr_testify//require", 60 "@org_skia_go_infra//go/exec", 61 ], 62) 63