mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
This also updates the bazel scripts to behave more like the C++ and Java examples, and updates the copybara scripts to be able to sync up `mostrobotpy`
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
|
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file")
|
|
load("@rules_python//python:defs.bzl", "py_binary")
|
|
load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")
|
|
load(":define_examples.bzl", "define_examples", "define_snippets")
|
|
|
|
py_binary(
|
|
name = "generate_bazel_files",
|
|
srcs = ["generate_bazel_files.py"],
|
|
target_compatible_with = select({
|
|
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
|
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
|
"//conditions:default": [],
|
|
}),
|
|
deps = [
|
|
requirement("tomli"),
|
|
],
|
|
)
|
|
|
|
cmd = "$(locations :generate_bazel_files) $(OUTS)"
|
|
|
|
genrule(
|
|
name = "generate_bazel_files_rule",
|
|
srcs = [
|
|
"examples/examples.toml",
|
|
"snippets/snippets.toml",
|
|
],
|
|
outs = ["gen/example_projects.bzl"],
|
|
cmd = cmd,
|
|
tools = [":generate_bazel_files"],
|
|
)
|
|
|
|
write_source_file(
|
|
name = "write_example_project_list",
|
|
diff_args = ["-u"],
|
|
in_file = ":generate_bazel_files_rule",
|
|
out_file = "example_projects.bzl",
|
|
suggested_update_target = "//:write_all",
|
|
tags = ["pregeneration"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
py_console_script_binary(
|
|
name = "robotpy",
|
|
pkg = "@allwpilib_pip_deps//robotpy_cli",
|
|
)
|
|
|
|
define_examples()
|
|
|
|
define_snippets()
|