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