mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file")
|
|
load("@rules_jvm_external//:defs.bzl", "maven_export")
|
|
load("@rules_python//python:defs.bzl", "py_binary")
|
|
load("//wpilibcExamples:build_cpp_examples.bzl", "build_commands", "build_examples", "build_snippets", "build_templates", "build_tests")
|
|
|
|
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": [],
|
|
}),
|
|
)
|
|
|
|
cmd = "$(locations :generate_bazel_files) $(OUTS)"
|
|
|
|
genrule(
|
|
name = "generate_bazel_files_rule",
|
|
srcs = [
|
|
"src/main/cpp/commands/commands.json",
|
|
"src/main/cpp/examples/examples.json",
|
|
"src/main/cpp/snippets/snippets.json",
|
|
"src/main/cpp/templates/templates.json",
|
|
],
|
|
outs = ["gen/example_projects.bzl"],
|
|
cmd = cmd,
|
|
tools = [":generate_bazel_files"],
|
|
)
|
|
|
|
write_source_file(
|
|
name = "write_example_project_list",
|
|
in_file = ":generate_bazel_files_rule",
|
|
out_file = "example_projects.bzl",
|
|
suggested_update_target = "//:write_all",
|
|
tags = ["pregeneration"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
halsim_deps = [
|
|
]
|
|
|
|
build_commands()
|
|
|
|
build_examples(halsim_deps = halsim_deps)
|
|
|
|
build_snippets()
|
|
|
|
build_templates()
|
|
|
|
build_tests()
|
|
|
|
maven_export(
|
|
name = "examples_publish",
|
|
maven_coordinates = "org.wpilib.wpilibc:examples:$(WPILIB_VERSION)",
|
|
target = ":examples-zip",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
maven_export(
|
|
name = "commands_publish",
|
|
maven_coordinates = "org.wpilib.wpilibc:commands:$(WPILIB_VERSION)",
|
|
target = ":commands-zip",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
maven_export(
|
|
name = "templates_publish",
|
|
maven_coordinates = "org.wpilib.wpilibc:templates:$(WPILIB_VERSION)",
|
|
target = ":templates-zip",
|
|
visibility = ["//visibility:public"],
|
|
)
|