xref: /aosp_15_r20/external/skia/infra/bots/BUILD.bazel (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1package(
2    default_applicable_licenses = ["//:license"],
3)
4
5licenses(["notice"])
6
7# This rule is a convenient way to build all the task drivers and copy them all into a single
8# place as a tar folder. Otherwise, we would need to run many separate bazel build commands and
9# then fish the executables out of a deep folder structure like:
10# _bazel_bin/infra/bots/task_drivers/bazel_build_all/bazel_build_all_/bazel_build_all
11# After this runs, the executables will all be in //_bazel_bin/built_task_drivers.tar
12# Why the tar file? Windows binaries are created with .exe and other platforms are not. However,
13# outs *must* be static, thus we cannot use a select. Bazel requires us to define all outputs
14# exactly, so the only way to support files with different names on different platforms is to
15# package them up into a file with the same name.
16# Cross compilation is handled as per https://github.com/bazelbuild/rules_go#how-do-i-cross-compile
17genrule(
18    name = "all_task_drivers",
19    srcs = [
20        "//infra/bots/task_drivers/bazel_build",
21        "//infra/bots/task_drivers/bazel_test_benchmark",
22        "//infra/bots/task_drivers/bazel_test_gm",
23        "//infra/bots/task_drivers/bazel_test_precompiled",
24        "//infra/bots/task_drivers/canvaskit_gold",
25        "//infra/bots/task_drivers/check_generated_files",
26        "//infra/bots/task_drivers/codesize",
27        "//infra/bots/task_drivers/compile_wasm_gm_tests",
28        "//infra/bots/task_drivers/cpu_tests",
29        "//infra/bots/task_drivers/g3_canary",
30        "//infra/bots/task_drivers/go_linters",
31        "//infra/bots/task_drivers/perf_puppeteer_canvas",
32        "//infra/bots/task_drivers/perf_puppeteer_render_skps",
33        "//infra/bots/task_drivers/perf_puppeteer_skottie_frames",
34        "//infra/bots/task_drivers/push_apps_from_skia_image",
35        "//infra/bots/task_drivers/recreate_skps",
36        "//infra/bots/task_drivers/run_gn_to_bp",
37        "//infra/bots/task_drivers/external_client",
38        "//infra/bots/task_drivers/run_wasm_gm_tests",
39        "//infra/bots/task_drivers/toolchain_layering_check",
40        "@org_skia_go_infra//infra/bots/task_drivers/build_push_docker_image",
41        "@org_skia_go_infra//infra/bots/task_drivers/canary",
42    ],
43    outs = ["built_task_drivers.tar"],
44    # Make a temporary directory in the output directory, as recommended by
45    # https://bazel.build/reference/be/make-variables#predefined_genrule_variables
46    # Reminder that $(@D) refers to that output directory and $(SRCS) refers to all
47    # the input files, in a space separated list.
48    cmd = "mkdir -p $(@D)/tmp_task_drivers && " +
49          # Copy all the task drivers to the same folder
50          "cp $(SRCS) $(@D)/tmp_task_drivers && " +
51          # Tar them up from that folder (so they will be in the top level of the tar directory)
52          # The parent directory of our temp directory is where the output tar file should go.
53          "cd $(@D)/tmp_task_drivers && tar --file ../built_task_drivers.tar --create . && " +
54          # Delete the temp folder (as per the recommendation above)
55          "cd .. && rm -rf tmp_task_drivers",
56)
57