Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | load("//frc971/downloader:downloader.bzl", "aos_downloader") |
| 2 | load("//tools/build_rules:label.bzl", "expand_label") |
Lee Mracek | 6821fe0 | 2018-11-01 17:27:30 -0400 | [diff] [blame] | 3 | |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 4 | def robot_downloader( |
| 5 | start_binaries, |
| 6 | name = "download", |
| 7 | binaries = [], |
| 8 | data = [], |
| 9 | dirs = None, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 10 | target_compatible_with = ["@//tools/platforms/hardware:roborio"], |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 11 | target_type = "roborio"): |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 12 | """Sets up the standard robot download targets. |
Lee Mracek | 6821fe0 | 2018-11-01 17:27:30 -0400 | [diff] [blame] | 13 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 14 | Attrs: |
| 15 | start_binaries: A list of cc_binary targets to start on the robot. |
| 16 | dirs: Passed through to aos_downloader. |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 17 | """ |
Lee Mracek | 6821fe0 | 2018-11-01 17:27:30 -0400 | [diff] [blame] | 18 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 19 | aos_downloader( |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 20 | name = name, |
| 21 | start_srcs = ([ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 22 | "//aos:prime_start_binaries", |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 23 | ] if target_type == "roborio" else []) + start_binaries, |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 24 | srcs = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 25 | "//aos:prime_binaries", |
Austin Schuh | c0ec2a8 | 2022-02-24 17:26:29 -0800 | [diff] [blame] | 26 | ] + binaries + data + ["//frc971/raspi/rootfs:chrt.sh"], |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 27 | dirs = dirs, |
| 28 | target_type = target_type, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 29 | target_compatible_with = target_compatible_with, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 30 | ) |
Lee Mracek | 6821fe0 | 2018-11-01 17:27:30 -0400 | [diff] [blame] | 31 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 32 | aos_downloader( |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 33 | 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 Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 39 | "//aos:prime_binaries_stripped", |
Austin Schuh | c0ec2a8 | 2022-02-24 17:26:29 -0800 | [diff] [blame] | 40 | ] + [expand_label(binary) + ".stripped" for binary in binaries] + data + ["//frc971/raspi/rootfs:chrt.sh"], |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 41 | dirs = dirs, |
| 42 | target_type = target_type, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 43 | target_compatible_with = target_compatible_with, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 44 | ) |