Files
allwpilib/robotpyExamples/BUILD.bazel
PJ Reiniger e7e51c9c05 [bazel][ci] Add CI action to generate pregen patch (#8816)
There were complaints about no patch files being created from CI when
the examples pre-gen fails for people who don't build with bazel. This
adds a new action step to run just the non-robotpy pregen.

I also added an argument to the diff tests to make it a unified diff,
which might make it easier to hand fix.
2026-04-25 11:06:02 -07:00

48 lines
1.4 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")
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.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()