blob: 9d0011392e5b30905af5da4fa716f81984047766 [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001load("//frc971/downloader:downloader.bzl", "aos_downloader")
2load("//tools/build_rules:label.bzl", "expand_label")
Lee Mracek6821fe02018-11-01 17:27:30 -04003
Brian Silverman26478412020-06-25 14:58:18 -07004def robot_downloader(
5 start_binaries,
6 name = "download",
7 binaries = [],
8 data = [],
9 dirs = None,
Philipp Schraderdada1072020-11-24 11:34:46 -080010 target_compatible_with = ["@//tools/platforms/hardware:roborio"],
Brian Silverman26478412020-06-25 14:58:18 -070011 target_type = "roborio"):
Alex Perrycb7da4b2019-08-28 19:35:56 -070012 """Sets up the standard robot download targets.
Lee Mracek6821fe02018-11-01 17:27:30 -040013
Alex Perrycb7da4b2019-08-28 19:35:56 -070014 Attrs:
15 start_binaries: A list of cc_binary targets to start on the robot.
16 dirs: Passed through to aos_downloader.
Alex Perrycb7da4b2019-08-28 19:35:56 -070017 """
Lee Mracek6821fe02018-11-01 17:27:30 -040018
Alex Perrycb7da4b2019-08-28 19:35:56 -070019 aos_downloader(
Brian Silverman26478412020-06-25 14:58:18 -070020 name = name,
21 start_srcs = ([
Alex Perrycb7da4b2019-08-28 19:35:56 -070022 "//aos:prime_start_binaries",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080023 ] if target_type == "roborio" else []) + start_binaries,
Brian Silverman26478412020-06-25 14:58:18 -070024 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070025 "//aos:prime_binaries",
Austin Schuhc0ec2a82022-02-24 17:26:29 -080026 ] + binaries + data + ["//frc971/raspi/rootfs:chrt.sh"],
Brian Silverman26478412020-06-25 14:58:18 -070027 dirs = dirs,
28 target_type = target_type,
Philipp Schraderdada1072020-11-24 11:34:46 -080029 target_compatible_with = target_compatible_with,
Alex Perrycb7da4b2019-08-28 19:35:56 -070030 )
Lee Mracek6821fe02018-11-01 17:27:30 -040031
Alex Perrycb7da4b2019-08-28 19:35:56 -070032 aos_downloader(
Brian Silverman26478412020-06-25 14:58:18 -070033 name = name + "_stripped",
34 start_srcs = ([
35 "//aos:prime_start_binaries_stripped",
36 ] if target_type == "roborio" else []) +
37 [expand_label(binary) + ".stripped" for binary in start_binaries],
38 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070039 "//aos:prime_binaries_stripped",
Austin Schuhc0ec2a82022-02-24 17:26:29 -080040 ] + [expand_label(binary) + ".stripped" for binary in binaries] + data + ["//frc971/raspi/rootfs:chrt.sh"],
Brian Silverman26478412020-06-25 14:58:18 -070041 dirs = dirs,
42 target_type = target_type,
Philipp Schraderdada1072020-11-24 11:34:46 -080043 target_compatible_with = target_compatible_with,
Alex Perrycb7da4b2019-08-28 19:35:56 -070044 )