blob: aebcb87c9e6e07b5bc2a0e6e84d7e8c946acef45 [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,
10 default_target = None,
Philipp Schraderdada1072020-11-24 11:34:46 -080011 target_compatible_with = ["@//tools/platforms/hardware:roborio"],
Brian Silverman26478412020-06-25 14:58:18 -070012 target_type = "roborio"):
Alex Perrycb7da4b2019-08-28 19:35:56 -070013 """Sets up the standard robot download targets.
Lee Mracek6821fe02018-11-01 17:27:30 -040014
Alex Perrycb7da4b2019-08-28 19:35:56 -070015 Attrs:
16 start_binaries: A list of cc_binary targets to start on the robot.
17 dirs: Passed through to aos_downloader.
18 default_target: Passed through to aos_downloader.
19 """
Lee Mracek6821fe02018-11-01 17:27:30 -040020
Alex Perrycb7da4b2019-08-28 19:35:56 -070021 aos_downloader(
Brian Silverman26478412020-06-25 14:58:18 -070022 name = name,
23 start_srcs = ([
Alex Perrycb7da4b2019-08-28 19:35:56 -070024 "//aos:prime_start_binaries",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080025 ] if target_type == "roborio" else []) + start_binaries,
Brian Silverman26478412020-06-25 14:58:18 -070026 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070027 "//aos:prime_binaries",
Austin Schuhed5b26d2019-12-05 20:51:59 -080028 ] + binaries + data,
Brian Silverman26478412020-06-25 14:58:18 -070029 dirs = dirs,
30 target_type = target_type,
31 default_target = default_target,
Philipp Schraderdada1072020-11-24 11:34:46 -080032 target_compatible_with = target_compatible_with,
Alex Perrycb7da4b2019-08-28 19:35:56 -070033 )
Lee Mracek6821fe02018-11-01 17:27:30 -040034
Alex Perrycb7da4b2019-08-28 19:35:56 -070035 aos_downloader(
Brian Silverman26478412020-06-25 14:58:18 -070036 name = name + "_stripped",
37 start_srcs = ([
38 "//aos:prime_start_binaries_stripped",
39 ] if target_type == "roborio" else []) +
40 [expand_label(binary) + ".stripped" for binary in start_binaries],
41 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070042 "//aos:prime_binaries_stripped",
Austin Schuhed5b26d2019-12-05 20:51:59 -080043 ] + [expand_label(binary) + ".stripped" for binary in binaries] + data,
Brian Silverman26478412020-06-25 14:58:18 -070044 dirs = dirs,
45 target_type = target_type,
46 default_target = default_target,
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = target_compatible_with,
Alex Perrycb7da4b2019-08-28 19:35:56 -070048 )