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, |
| 10 | default_target = None, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame^] | 11 | target_compatible_with = ["@//tools/platforms/hardware:roborio"], |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 12 | target_type = "roborio"): |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 13 | """Sets up the standard robot download targets. |
Lee Mracek | 6821fe0 | 2018-11-01 17:27:30 -0400 | [diff] [blame] | 14 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 15 | 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 Mracek | 6821fe0 | 2018-11-01 17:27:30 -0400 | [diff] [blame] | 20 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 21 | aos_downloader( |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 22 | name = name, |
| 23 | start_srcs = ([ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 24 | "//aos:prime_start_binaries", |
James Kuszmaul | 2d8fa2a | 2020-03-01 13:51:50 -0800 | [diff] [blame] | 25 | ] if target_type == "roborio" else []) + start_binaries, |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 26 | srcs = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 27 | "//aos:prime_binaries", |
Austin Schuh | ed5b26d | 2019-12-05 20:51:59 -0800 | [diff] [blame] | 28 | ] + binaries + data, |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 29 | dirs = dirs, |
| 30 | target_type = target_type, |
| 31 | default_target = default_target, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame^] | 32 | target_compatible_with = target_compatible_with, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 33 | ) |
Lee Mracek | 6821fe0 | 2018-11-01 17:27:30 -0400 | [diff] [blame] | 34 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 35 | aos_downloader( |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 36 | 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 Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 42 | "//aos:prime_binaries_stripped", |
Austin Schuh | ed5b26d | 2019-12-05 20:51:59 -0800 | [diff] [blame] | 43 | ] + [expand_label(binary) + ".stripped" for binary in binaries] + data, |
Brian Silverman | 2647841 | 2020-06-25 14:58:18 -0700 | [diff] [blame] | 44 | dirs = dirs, |
| 45 | target_type = target_type, |
| 46 | default_target = default_target, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame^] | 47 | target_compatible_with = target_compatible_with, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 48 | ) |