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