blob: 11423e01b92675a06f22de8811b08d6f78e1bb6c [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
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -08004
5def robot_downloader(start_binaries,
6 name="download",
7 binaries=[],
8 data=[],
9 dirs=None,
10 default_target=None,
11 restricted_to=["//tools:roborio"],
12 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(
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080022 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,
26 srcs=[
Alex Perrycb7da4b2019-08-28 19:35:56 -070027 "//aos:prime_binaries",
Austin Schuhed5b26d2019-12-05 20:51:59 -080028 ] + binaries + data,
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080029 dirs=dirs,
30 target_type=target_type,
31 default_target=default_target,
32 restricted_to=restricted_to,
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(
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080036 name=name + "_stripped",
37 start_srcs=([
Alex Perrycb7da4b2019-08-28 19:35:56 -070038 "//aos:prime_start_binaries_stripped",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080039 ] 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,
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080044 dirs=dirs,
45 target_type=target_type,
46 default_target=default_target,
47 restricted_to=restricted_to,
Alex Perrycb7da4b2019-08-28 19:35:56 -070048 )