Get the python runtime into the sandbox for downloader
Change-Id: I7e5dc002fa73496de53f1b77d10d390c77ca48e2
diff --git a/aos/downloader/downloader.bzl b/aos/downloader/downloader.bzl
index 3fb2fc8..139401a 100644
--- a/aos/downloader/downloader.bzl
+++ b/aos/downloader/downloader.bzl
@@ -31,6 +31,7 @@
return struct(
runfiles = ctx.runfiles(
files = to_download + ctx.files._downloader,
+ transitive_files = ctx.attr._downloader.default_runfiles.files,
collect_data = True,
collect_default = True,
),
@@ -43,7 +44,7 @@
downloader_srcs = ctx.files.srcs
)
-'''Creates a binary which downloads code to a robot.
+"""Creates a binary which downloads code to a robot.
Running this with `bazel run` will actually download everything.
@@ -55,41 +56,42 @@
start_srcs: Like srcs, except they also get put into start_list.txt.
default_target: The default host to download to. If not specified, defaults to
roboRIO-971.local.
-'''
+"""
+
aos_downloader = rule(
- implementation = _aos_downloader_impl,
- attrs = {
- '_downloader': attr.label(
- executable = True,
- cfg = 'host',
- default = Label('//aos/downloader'),
- ),
- 'start_srcs': attr.label_list(
- mandatory = True,
- allow_files = True,
- ),
- 'srcs': attr.label_list(
- mandatory = True,
- allow_files = True,
- ),
- 'dirs': attr.label_list(
- mandatory = False,
- providers = [
- 'downloader_dir',
- 'downloader_srcs',
- ]
- ),
- 'default_target': attr.string(
- default = 'roboRIO-971-frc.local',
- ),
- },
- executable = True,
- outputs = {
- '_startlist': '%{name}.start_list.dir/start_list.txt',
- },
+ attrs = {
+ "_downloader": attr.label(
+ executable = True,
+ cfg = "host",
+ default = Label("//aos/downloader"),
+ ),
+ "start_srcs": attr.label_list(
+ mandatory = True,
+ allow_files = True,
+ ),
+ "srcs": attr.label_list(
+ mandatory = True,
+ allow_files = True,
+ ),
+ "dirs": attr.label_list(
+ mandatory = False,
+ providers = [
+ "downloader_dir",
+ "downloader_srcs",
+ ],
+ ),
+ "default_target": attr.string(
+ default = "roboRIO-971-frc.local",
+ ),
+ },
+ executable = True,
+ outputs = {
+ "_startlist": "%{name}.start_list.dir/start_list.txt",
+ },
+ implementation = _aos_downloader_impl,
)
-'''Downloads files to a specific directory.
+"""Downloads files to a specific directory.
This rule does nothing by itself. Use it by adding to the dirs attribute of an
aos_downloader rule.
@@ -98,16 +100,17 @@
srcs: The files to download. They all go in the same directory.
dir: The directory (relative to the standard download directory) to put all
the files in.
-'''
+"""
+
aos_downloader_dir = rule(
- implementation = _aos_downloader_dir_impl,
- attrs = {
- 'srcs': attr.label_list(
- mandatory = True,
- allow_files = True,
- ),
- 'dir': attr.string(
- mandatory = True,
- ),
- },
+ attrs = {
+ "srcs": attr.label_list(
+ mandatory = True,
+ allow_files = True,
+ ),
+ "dir": attr.string(
+ mandatory = True,
+ ),
+ },
+ implementation = _aos_downloader_dir_impl,
)