mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[robotpy] Build examples (#8629)
This hooks up the bazel build to the robotpyExamples. It can use the (formly pyfrc or whatever) automatic unit tests for an example, as well as exposing the ability to run the example in simulation, with or without `halsim_gui` with a command such as `bazel run //robotpyExamples:AddressableLED-sim` This required building and using wheels instead of just a normal `py_library`, so that things like `ENTRY_POINTS` can be used. I took a bare bones approach to building and naming the wheels (for example the native ones don't have the OS info or python version in them, so they wouldn't be suitable publish to pypi, but that can always be updated later.
This commit is contained in:
1
.bazelrc
1
.bazelrc
@@ -74,6 +74,7 @@ build:ci --progress_report_interval=60 --show_progress_rate_limit=60
|
||||
build --build_metadata=REPO_URL=https://github.com/wpilibsuite/allwpilib.git
|
||||
|
||||
common --define="WPILIB_VERSION=2025.424242.3.1-unknown"
|
||||
common --define="ROBOTPY_VERSION=2025.424242.3.1"
|
||||
|
||||
# List of artifact types to build in CI.
|
||||
# Anything else gets skipped to speed up CI.
|
||||
|
||||
@@ -63,6 +63,7 @@ write_source_files(
|
||||
"//wpimath:write_wpimath",
|
||||
"//wpiunits:write_wpiunits",
|
||||
"//wpiutil:write_wpiutil",
|
||||
"//robotpyExamples:write_example_project_list",
|
||||
],
|
||||
tags = ["pregeneration"],
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@ bazel_dep(name = "bazel_skylib", version = "1.8.2")
|
||||
bazel_dep(name = "platforms", version = "1.0.0")
|
||||
bazel_dep(name = "rules_java", version = "8.14.0")
|
||||
bazel_dep(name = "rules_python", version = "1.7.0")
|
||||
bazel_dep(name = "rules_pycross", version = "0.8.1")
|
||||
|
||||
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
|
||||
python.toolchain(
|
||||
|
||||
6
MODULE.bazel.lock
generated
6
MODULE.bazel.lock
generated
@@ -20,6 +20,7 @@
|
||||
"https://bcr.bazel.build/modules/apple_support/2.0.0/source.json": "e9f1636f3a20e9da9f72612a38311c1fb2207294345a4157001aff93571f3da7",
|
||||
"https://bcr.bazel.build/modules/aspect_bazel_lib/2.14.0/MODULE.bazel": "2b31ffcc9bdc8295b2167e07a757dbbc9ac8906e7028e5170a3708cecaac119f",
|
||||
"https://bcr.bazel.build/modules/aspect_bazel_lib/2.14.0/source.json": "0cf1826853b0bef8b5cd19c0610d717500f5521aa2b38b72b2ec302ac5e7526c",
|
||||
"https://bcr.bazel.build/modules/aspect_bazel_lib/2.9.4/MODULE.bazel": "ccc41028429f894b02fde7ef67d416cba3ba5084ed9ddb9bb6107aa82d118776",
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd",
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8",
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d",
|
||||
@@ -112,7 +113,8 @@
|
||||
"https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513",
|
||||
"https://bcr.bazel.build/modules/rules_cc/0.1.5/MODULE.bazel": "88dfc9361e8b5ae1008ac38f7cdfd45ad738e4fa676a3ad67d19204f045a1fd8",
|
||||
"https://bcr.bazel.build/modules/rules_cc/0.2.13/MODULE.bazel": "eecdd666eda6be16a8d9dc15e44b5c75133405e820f620a234acc4b1fdc5aa37",
|
||||
"https://bcr.bazel.build/modules/rules_cc/0.2.13/source.json": "f872e892c5265c5532e526857532f4868708f88d64e5ebe517ea72e09da61bdb",
|
||||
"https://bcr.bazel.build/modules/rules_cc/0.2.14/MODULE.bazel": "353c99ed148887ee89c54a17d4100ae7e7e436593d104b668476019023b58df8",
|
||||
"https://bcr.bazel.build/modules/rules_cc/0.2.14/source.json": "55d0a4587c5592fad350f6e698530f4faf0e7dd15e69d43f8d87e220c78bea54",
|
||||
"https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6",
|
||||
"https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8",
|
||||
"https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74",
|
||||
@@ -158,6 +160,8 @@
|
||||
"https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2",
|
||||
"https://bcr.bazel.build/modules/rules_proto/7.1.0/MODULE.bazel": "002d62d9108f75bb807cd56245d45648f38275cb3a99dcd45dfb864c5d74cb96",
|
||||
"https://bcr.bazel.build/modules/rules_proto/7.1.0/source.json": "39f89066c12c24097854e8f57ab8558929f9c8d474d34b2c00ac04630ad8940e",
|
||||
"https://bcr.bazel.build/modules/rules_pycross/0.8.1/MODULE.bazel": "e8fea73f129f5cf81d39de0a4a8675c98e2392d32d7835c9fe55cb04445b39d5",
|
||||
"https://bcr.bazel.build/modules/rules_pycross/0.8.1/source.json": "766863bf7355ef02c76ca63b171f3e2ca8b277b5211cf22740ebf5363598b388",
|
||||
"https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f",
|
||||
"https://bcr.bazel.build/modules/rules_python/0.17.3/MODULE.bazel": "f0eb1c105334c80641ea03261e19329fdcf5232e2b134a94f016348190f05499",
|
||||
"https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300",
|
||||
|
||||
8
apriltag/robotpy_native_build_info.bzl
generated
8
apriltag/robotpy_native_build_info.bzl
generated
@@ -36,4 +36,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/apriltag",
|
||||
install_path = "native/apriltag/",
|
||||
strip_path_prefixes = ["apriltag"],
|
||||
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpimath==0.0.0"],
|
||||
summary = "WPILib AprilTag Library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"apriltag = native.apriltag",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
10
apriltag/robotpy_pybind_build_info.bzl
generated
10
apriltag/robotpy_pybind_build_info.bzl
generated
@@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def apriltag_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def apriltag_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
APRILTAG_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "AprilTag",
|
||||
@@ -214,6 +214,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//wpimath:robotpy-wpimath",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["apriltag/src/main/python", "apriltag"],
|
||||
summary = "RobotPy bindings for WPILib's AprilTag library",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-apriltag==0.0.0", "robotpy-wpiutil==0.0.0", "robotpy-wpimath==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["apriltag = robotpy_apriltag"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
||||
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_pycross//pycross:defs.bzl", "pycross_wheel_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
|
||||
load("@rules_python//python:packaging.bzl", "py_wheel")
|
||||
load("//commandsv2:generate.bzl", "generate_wpilib_new_commands")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
|
||||
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test", "wpilib_java_library")
|
||||
@@ -186,10 +188,29 @@ package_default_cc_project(
|
||||
)
|
||||
|
||||
py_library(
|
||||
name = "commandsv2-py",
|
||||
name = "commandsv2-py-lib",
|
||||
srcs = glob(["src/main/python/**/*.py"]),
|
||||
imports = ["src/main/python"],
|
||||
deps = [
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
requirement("typing-extensions"),
|
||||
],
|
||||
)
|
||||
|
||||
py_wheel(
|
||||
name = "commandsv2-wheel",
|
||||
distribution = "commandsv2",
|
||||
strip_path_prefixes = ["commandsv2/src/main/python"],
|
||||
tags = ["robotpy"],
|
||||
version = "$(ROBOTPY_VERSION)",
|
||||
deps = [":commandsv2-py-lib"],
|
||||
)
|
||||
|
||||
pycross_wheel_library(
|
||||
name = "commandsv2-py",
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
wheel = ":commandsv2-wheel",
|
||||
deps = [
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
requirement("typing-extensions"),
|
||||
|
||||
8
datalog/robotpy_native_build_info.bzl
generated
8
datalog/robotpy_native_build_info.bzl
generated
@@ -31,4 +31,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/datalog",
|
||||
install_path = "native/datalog/",
|
||||
strip_path_prefixes = ["datalog"],
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
summary = "WPILib Utility Library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"datalog = native.datalog",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
10
datalog/robotpy_pybind_build_info.bzl
generated
10
datalog/robotpy_pybind_build_info.bzl
generated
@@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpilog_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpilog_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPILOG_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "DataLog",
|
||||
@@ -208,6 +208,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//datalog:robotpy-native-datalog",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["datalog/src/main/python", "datalog"],
|
||||
summary = "Binary wrapper for FRC wpilog library",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-datalog==0.0.0", "robotpy-wpiutil==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["wpilog = wpilog"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
8
hal/robotpy_native_build_info.bzl
generated
8
hal/robotpy_native_build_info.bzl
generated
@@ -33,4 +33,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpiHal",
|
||||
install_path = "native/wpihal/",
|
||||
strip_path_prefixes = ["hal"],
|
||||
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-ntcore==0.0.0"],
|
||||
summary = "WPILib HAL implementation",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpihal = native.wpihal",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
12
hal/robotpy_pybind_build_info.bzl
generated
12
hal/robotpy_pybind_build_info.bzl
generated
@@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def hal_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def hal_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
HAL_SIMULATION_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "DriverStationData",
|
||||
@@ -141,7 +141,7 @@ def hal_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = []
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def wpihal_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpihal_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPIHAL_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "CANAPITypes",
|
||||
@@ -421,6 +421,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//ntcore:pyntcore",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["hal/src/main/python", "hal"],
|
||||
summary = "Binary wrapper for FRC HAL",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["pyntcore==0.0.0", "robotpy-native-wpihal==0.0.0", "robotpy-wpiutil==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["hal_simulation = hal.simulation", "wpihal = hal"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
8
ntcore/robotpy_native_build_info.bzl
generated
8
ntcore/robotpy_native_build_info.bzl
generated
@@ -35,4 +35,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/ntcore",
|
||||
install_path = "native/ntcore/",
|
||||
strip_path_prefixes = ["ntcore"],
|
||||
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpinet==0.0.0", "robotpy-native-datalog==0.0.0"],
|
||||
summary = "WPILib NetworkTables Library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"ntcore = native.ntcore",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
10
ntcore/robotpy_pybind_build_info.bzl
generated
10
ntcore/robotpy_pybind_build_info.bzl
generated
@@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def ntcore_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def ntcore_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
NTCORE_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "BooleanArrayTopic",
|
||||
@@ -485,6 +485,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//wpinet:robotpy-wpinet",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["ntcore/src/main/python", "ntcore"],
|
||||
summary = "Binary wrappers for the FRC ntcore library",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-ntcore==0.0.0", "robotpy-wpiutil==0.0.0", "robotpy-wpinet==0.0.0", "robotpy-wpilog==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["ntcore = ntcore"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
46
robotpyExamples/BUILD.bazel
Normal file
46
robotpyExamples/BUILD.bazel
Normal file
@@ -0,0 +1,46 @@
|
||||
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",
|
||||
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()
|
||||
44
robotpyExamples/define_examples.bzl
Normal file
44
robotpyExamples/define_examples.bzl
Normal file
@@ -0,0 +1,44 @@
|
||||
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
||||
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
|
||||
load("//robotpyExamples:example_projects.bzl", "PROJECTS")
|
||||
|
||||
def define_examples():
|
||||
for example_folder in PROJECTS:
|
||||
base_name = example_folder.replace("/", "_")
|
||||
common_kwargs = dict(
|
||||
srcs = [":robotpy_entry_point.py"],
|
||||
main = "robotpy_entry_point.py",
|
||||
data = native.glob([example_folder + "/**"]),
|
||||
imports = [example_folder],
|
||||
)
|
||||
common_deps = [
|
||||
":robotpy",
|
||||
"//apriltag:robotpy-apriltag",
|
||||
"//commandsv2:commandsv2-py",
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
"//romiVendordep:robotpy-romi",
|
||||
"//xrpVendordep:robotpy-xrp",
|
||||
requirement("numpy"),
|
||||
]
|
||||
|
||||
py_test(
|
||||
name = base_name + "-test",
|
||||
args = ["--main", "$(location " + example_folder + "/robot.py)", "test", "--builtin"],
|
||||
deps = common_deps,
|
||||
size = "small",
|
||||
**common_kwargs
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = base_name + "-run",
|
||||
args = ["--main", "$(location " + example_folder + "/robot.py)", "run"],
|
||||
deps = common_deps,
|
||||
**common_kwargs
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = base_name + "-sim",
|
||||
args = ["--main", "$(location " + example_folder + "/robot.py)", "sim"],
|
||||
deps = common_deps + ["//simulation/halsim_gui:robotpy-halsim-gui"],
|
||||
**common_kwargs
|
||||
)
|
||||
54
robotpyExamples/example_projects.bzl
Normal file
54
robotpyExamples/example_projects.bzl
Normal file
@@ -0,0 +1,54 @@
|
||||
PROJECTS = [
|
||||
"AddressableLED",
|
||||
"AprilTagsVision",
|
||||
"ArcadeDrive",
|
||||
"ArcadeDriveXboxController",
|
||||
"ArmSimulation",
|
||||
"CANPDP",
|
||||
"DifferentialDriveBot",
|
||||
"DifferentialDrivePoseEstimator",
|
||||
"DigitalCommunication",
|
||||
"DriveDistanceOffboard",
|
||||
"DutyCycleEncoder",
|
||||
"DutyCycleInput",
|
||||
"ElevatorExponentialProfile",
|
||||
"ElevatorExponentialSimulation",
|
||||
"ElevatorProfiledPID",
|
||||
"ElevatorSimulation",
|
||||
"ElevatorTrapezoidProfile",
|
||||
"Encoder",
|
||||
"EventLoop",
|
||||
"FlywheelBangBangController",
|
||||
"GettingStarted",
|
||||
"Gyro",
|
||||
"GyroMecanum",
|
||||
"HatchbotInlined",
|
||||
"HatchbotTraditional",
|
||||
"HidRumble",
|
||||
"HttpCamera",
|
||||
"I2CCommunication",
|
||||
"IntermediateVision",
|
||||
"MecanumBot",
|
||||
"MecanumDrive",
|
||||
"MecanumDrivePoseEstimator",
|
||||
"Mechanism2d",
|
||||
"MotorControl",
|
||||
"PotentiometerPID",
|
||||
"QuickVision",
|
||||
"RapidReactCommandBot",
|
||||
"RomiReference",
|
||||
"SelectCommand",
|
||||
"SimpleDifferentialDriveSimulation",
|
||||
"Solenoid",
|
||||
"StateSpaceArm",
|
||||
"StateSpaceElevator",
|
||||
"StateSpaceFlywheel",
|
||||
"StateSpaceFlywheelSysId",
|
||||
"SwerveBot",
|
||||
"SwerveDrivePoseEstimator",
|
||||
"SysId",
|
||||
"TankDrive",
|
||||
"TankDriveXboxController",
|
||||
"UnitTest",
|
||||
"XrpReference",
|
||||
]
|
||||
25
robotpyExamples/generate_bazel_files.py
Normal file
25
robotpyExamples/generate_bazel_files.py
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
import sys
|
||||
import tomli
|
||||
|
||||
def main():
|
||||
toml_filename = "robotpyExamples/examples.toml"
|
||||
output_file = "robotpyExamples/example_projects.bzl"
|
||||
|
||||
with open(toml_filename, "rb") as f:
|
||||
data = tomli.load(f)
|
||||
|
||||
contents = "PROJECTS = [\n"
|
||||
for test_folder in data["tests"]["base"]:
|
||||
contents += f' "{test_folder}",\n'
|
||||
contents += "]\n"
|
||||
|
||||
if len(sys.argv) == 2:
|
||||
output_file = sys.argv[1]
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
f.write(contents)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
8
romiVendordep/robotpy_native_build_info.bzl
generated
8
romiVendordep/robotpy_native_build_info.bzl
generated
@@ -31,4 +31,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/romiVendordep",
|
||||
install_path = "native/romi/",
|
||||
strip_path_prefixes = ["romiVendordep"],
|
||||
requires = ["robotpy-native-wpilib==0.0.0"],
|
||||
summary = "WPILib Romi support library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"romi = native.romi",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
11
romiVendordep/robotpy_pybind_build_info.bzl
generated
11
romiVendordep/robotpy_pybind_build_info.bzl
generated
@@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def romi_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def romi_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
ROMI_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "OnBoardIO",
|
||||
@@ -176,6 +176,15 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//simulation/halsim_ws_core:robotpy-halsim-ws",
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
],
|
||||
strip_path_prefixes = ["romiVendordep/src/main/python", "romiVendordep"],
|
||||
summary = "Binary wrapper for WPILib Romi Vendor library",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-romi==0.0.0", "wpilib==0.0.0", "robotpy-halsim-ws==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["romi = romi"],
|
||||
"robotpy_cli.2027": ["run-romi = romi.cli:RunRomi"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
@@ -102,6 +102,14 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/{{shared_library_name}}",
|
||||
install_path = "native/{{nativelib_config.pcfile[0].name}}/",
|
||||
strip_path_prefixes = ["{{root_package}}"],
|
||||
requires = {{raw_project_config.dependencies | double_quotes}},
|
||||
summary = "{{raw_project_config.description}}",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"{{nativelib_config.pcfile[0].name}} = native.{{nativelib_config.pcfile[0].name}}",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
"""
|
||||
|
||||
@@ -417,6 +417,19 @@ def generate_pybind_build_file(
|
||||
except:
|
||||
version_file = None
|
||||
|
||||
# The entry points defined above are implicit to how the project is broken down in the toml files.
|
||||
# This addes potentially extra explicitly declared entry points
|
||||
if "entry-points" in raw_config["project"]:
|
||||
explicit_entry_points = raw_config["project"]["entry-points"]
|
||||
for entry_point_type in explicit_entry_points:
|
||||
for ep_key, ep_value in explicit_entry_points[entry_point_type].items():
|
||||
entry_points[entry_point_type].append(f"{ep_key} = {ep_value}")
|
||||
|
||||
strip_path_prefixes = [
|
||||
f"{fixup_root_package_name(top_level_name)}/{stripped_include_prefix}",
|
||||
f"{fixup_root_package_name(top_level_name)}",
|
||||
]
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
f.write(
|
||||
template.render(
|
||||
@@ -426,6 +439,7 @@ def generate_pybind_build_file(
|
||||
python_deps=sorted(python_deps),
|
||||
all_local_native_deps=all_local_native_deps,
|
||||
stripped_include_prefix=stripped_include_prefix,
|
||||
strip_path_prefixes=strip_path_prefixes,
|
||||
yml_prefix=yml_prefix,
|
||||
package_root_file=package_root_file,
|
||||
raw_project_config=raw_config["project"],
|
||||
|
||||
@@ -13,6 +13,10 @@ def fixup_root_package_name(name):
|
||||
return "ntcore"
|
||||
if name == "halsim-ws":
|
||||
return "simulation/halsim_ws_core"
|
||||
if name == "wpimath_test":
|
||||
return "wpimath"
|
||||
if name == "robotpy_apriltag":
|
||||
return "apriltag"
|
||||
return name
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", {% if publish_casters_targets %}"publish_casters", {% endif %}"resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
{% for extension_module in extension_modules%}
|
||||
def {{extension_module.name}}_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def {{extension_module.name}}_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
{{extension_module.name|upper}}_HEADER_GEN = [
|
||||
{%- for header_cfg in extension_module.generation_data.values() %}
|
||||
struct(
|
||||
@@ -217,6 +217,16 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
{% if "requirement" in d %}{{d}}{% else %}"{{d}}"{% endif %},
|
||||
{%- endfor %}
|
||||
],
|
||||
strip_path_prefixes = [{% for spp in strip_path_prefixes %}"{{ spp }}"{% if not loop.last%}, {% endif %}{% endfor %}],
|
||||
summary = "{{raw_project_config.description}}",
|
||||
project_urls = {{raw_project_config.urls | jsonify}},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = {{raw_project_config.dependencies | jsonify}},
|
||||
entry_points = {
|
||||
{%- for group, entries in entry_points.items() %}
|
||||
"{{ group }}": {{entries | jsonify}},
|
||||
{%- endfor %}
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")
|
||||
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library")
|
||||
load("@rules_pycross//pycross:defs.bzl", "pycross_wheel_library")
|
||||
load("@rules_python//python:defs.bzl", "py_library")
|
||||
load("@rules_python//python:packaging.bzl", "py_wheel")
|
||||
load("//shared/bazel/rules/robotpy:compatibility_select.bzl", "robotpy_compatibility_select")
|
||||
|
||||
def create_pybind_library(
|
||||
@@ -82,21 +84,54 @@ def create_pybind_library(
|
||||
|
||||
def robotpy_library(
|
||||
name,
|
||||
deps = [],
|
||||
data = [],
|
||||
strip_path_prefixes = None,
|
||||
summary = None,
|
||||
project_urls = None,
|
||||
author_email = None,
|
||||
entry_points = None,
|
||||
requires = None,
|
||||
**kwargs):
|
||||
"""
|
||||
Defines a python library that is wrapping a series of pybind extensions.
|
||||
|
||||
Outputs:
|
||||
<name> - The python library
|
||||
<name>-wheel - A wheel for the library
|
||||
"""
|
||||
py_library(
|
||||
name = name,
|
||||
name = name + "-lib",
|
||||
data = data,
|
||||
deps = deps,
|
||||
tags = ["robotpy"],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
py_wheel(
|
||||
name = "{}-wheel".format(name),
|
||||
distribution = name,
|
||||
stamp = 1,
|
||||
version = "$(ROBOTPY_VERSION)",
|
||||
summary = summary,
|
||||
requires = requires,
|
||||
project_urls = project_urls,
|
||||
author_email = author_email,
|
||||
deps = data + [":{}-lib".format(name)],
|
||||
strip_path_prefixes = strip_path_prefixes,
|
||||
entry_points = entry_points,
|
||||
license = "BSD-3-Clause",
|
||||
tags = ["robotpy"],
|
||||
)
|
||||
|
||||
pycross_wheel_library(
|
||||
name = "{}".format(name),
|
||||
wheel = "{}-wheel".format(name),
|
||||
deps = deps,
|
||||
visibility = ["//visibility:public"],
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
def copy_native_file(name, library, base_path):
|
||||
"""
|
||||
Copies a compiled shared library into a naming format that can be used by robotpy rules. The libraries are named
|
||||
@@ -153,6 +188,12 @@ def native_wrappery_library(
|
||||
native_shared_library,
|
||||
install_path,
|
||||
headers,
|
||||
strip_path_prefixes = [],
|
||||
summary = None,
|
||||
project_urls = None,
|
||||
author_email = None,
|
||||
entry_points = None,
|
||||
requires = None,
|
||||
deps = []):
|
||||
"""
|
||||
This function provides a sugar wrapper for defining a python library that wraps an allwpilib native library
|
||||
@@ -187,11 +228,34 @@ def native_wrappery_library(
|
||||
)
|
||||
|
||||
py_library(
|
||||
name = name,
|
||||
name = name + "-lib",
|
||||
srcs = [libinit_file],
|
||||
data = [pc_file, ":{}.copy_lib".format(libname), headers],
|
||||
deps = deps,
|
||||
imports = ["."],
|
||||
visibility = ["//visibility:public"],
|
||||
tags = ["robotpy"],
|
||||
)
|
||||
|
||||
py_wheel(
|
||||
name = "{}-wheel".format(name),
|
||||
distribution = name,
|
||||
stamp = 1,
|
||||
version = "$(ROBOTPY_VERSION)",
|
||||
summary = summary,
|
||||
requires = requires,
|
||||
project_urls = project_urls,
|
||||
author_email = author_email,
|
||||
deps = [name + "-lib", ":{}.copy_lib".format(libname), headers, name + ".pc_wrapper"],
|
||||
strip_path_prefixes = strip_path_prefixes,
|
||||
entry_points = entry_points,
|
||||
tags = ["robotpy"],
|
||||
license = "BSD-3-Clause",
|
||||
)
|
||||
|
||||
pycross_wheel_library(
|
||||
name = "{}".format(name),
|
||||
wheel = "{}-wheel".format(name),
|
||||
visibility = ["//visibility:public"],
|
||||
tags = ["manual"],
|
||||
deps = deps,
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "copy_native_file", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
|
||||
def halsim_gui_ext_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def halsim_gui_ext_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
HALSIM_GUI_EXT_HEADER_GEN = [
|
||||
]
|
||||
|
||||
@@ -148,5 +148,13 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//wpimath:robotpy-wpimath",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["simulation/halsim_gui/src/main/python", "simulation/halsim_gui"],
|
||||
summary = "WPILib simulation GUI",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-wpiutil==0.0.0", "robotpy-wpimath==0.0.0", "robotpy-hal==0.0.0", "pyntcore==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["halsim_gui_ext = halsim_gui._ext"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@@ -270,11 +270,7 @@ define_pybind_library(
|
||||
|
||||
robotpy_py_test(
|
||||
"python_tests",
|
||||
srcs = glob(
|
||||
["src/test/python/**/*.py"],
|
||||
# TODO(pjreiniger) This excluded test needs the ENTRY_POINT hooks (i.e. have a dependency on a wheel)
|
||||
exclude = ["src/test/python/test_pytest_plugins.py"],
|
||||
),
|
||||
srcs = glob(["src/test/python/**/*.py"]),
|
||||
tags = ["exclusive"],
|
||||
deps = [
|
||||
":robotpy-wpilib",
|
||||
|
||||
8
wpilibc/robotpy_native_build_info.bzl
generated
8
wpilibc/robotpy_native_build_info.bzl
generated
@@ -39,4 +39,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpilibc",
|
||||
install_path = "native/wpilib/",
|
||||
strip_path_prefixes = ["wpilibc"],
|
||||
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpinet==0.0.0", "robotpy-native-ntcore==0.0.0", "robotpy-native-wpimath==0.0.0", "robotpy-native-wpihal==0.0.0"],
|
||||
summary = "WPILib Robotics Library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpilib = native.wpilib",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
13
wpilibc/robotpy_pybind_build_info.bzl
generated
13
wpilibc/robotpy_pybind_build_info.bzl
generated
@@ -6,7 +6,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpilib_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpilib_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPILIB_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "Filesystem",
|
||||
@@ -1084,7 +1084,7 @@ def wpilib_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includ
|
||||
tags = ["manual", "robotpy"],
|
||||
)
|
||||
|
||||
def wpilib_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpilib_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPILIB_SIMULATION_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "ADXL345Sim",
|
||||
@@ -1642,6 +1642,15 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
requirement("pytest-reraise"),
|
||||
requirement("robotpy-cli"),
|
||||
],
|
||||
strip_path_prefixes = ["wpilibc/src/main/python", "wpilibc"],
|
||||
summary = "Binary wrapper for FRC WPILib",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-wpilib==0.0.0", "robotpy-wpiutil==0.0.0", "robotpy-wpimath==0.0.0", "robotpy-hal==0.0.0", "pyntcore==0.0.0", "robotpy-cli~=2027.0.0a1", "pytest>=3.9", "pytest-reraise"],
|
||||
entry_points = {
|
||||
"pkg_config": ["wpilib = wpilib", "wpilib_simulation = wpilib.simulation"],
|
||||
"robotpy_cli.2027": ["add-tests = wpilib._impl.cli_add_tests:AddTests", "run = wpilib._impl.cli_run:Main", "sim = wpilib._impl.cli_sim:RobotSim", "test = wpilib._impl.cli_test:RobotTest"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
8
wpimath/robotpy_native_build_info.bzl
generated
8
wpimath/robotpy_native_build_info.bzl
generated
@@ -36,4 +36,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpimath",
|
||||
install_path = "native/wpimath/",
|
||||
strip_path_prefixes = ["wpimath"],
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
summary = "WPILib Math Library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpimath = native.wpimath",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
10
wpimath/robotpy_pybind_build_info.bzl
generated
10
wpimath/robotpy_pybind_build_info.bzl
generated
@@ -6,7 +6,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "publish_casters", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpimath_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpimath_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPIMATH_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "ComputerVisionUtil",
|
||||
@@ -1296,6 +1296,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//wpimath:robotpy-native-wpimath",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["wpimath/src/main/python", "wpimath"],
|
||||
summary = "Binary wrapper for FRC WPIMath library",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-wpimath==0.0.0", "robotpy-wpiutil==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["wpimath-casters = wpimath", "wpimath = wpimath"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpimath_test_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpimath_test_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPIMATH_TEST_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "module",
|
||||
@@ -133,6 +133,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
imports = ["src/test/python/cpp"],
|
||||
deps = [
|
||||
],
|
||||
strip_path_prefixes = ["wpimath/src/test/python/cpp", "wpimath"],
|
||||
summary = "Test project for verifying robotpy-build behavior",
|
||||
project_urls = None,
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = None,
|
||||
entry_points = {
|
||||
"pkg_config": ["wpimath_test = wpimath_test"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
8
wpinet/robotpy_native_build_info.bzl
generated
8
wpinet/robotpy_native_build_info.bzl
generated
@@ -36,4 +36,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpinet",
|
||||
install_path = "native/wpinet/",
|
||||
strip_path_prefixes = ["wpinet"],
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
summary = "WPILib Networking Library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpinet = native.wpinet",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
10
wpinet/robotpy_pybind_build_info.bzl
generated
10
wpinet/robotpy_pybind_build_info.bzl
generated
@@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpinet_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpinet_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPINET_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "PortForwarder",
|
||||
@@ -156,6 +156,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//wpinet:robotpy-native-wpinet",
|
||||
"//wpiutil:robotpy-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["wpinet/src/main/python", "wpinet"],
|
||||
summary = "Binary wrapper for FRC wpinet library",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-wpinet==0.0.0", "robotpy-wpiutil==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["wpinet = wpinet"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
8
wpiutil/robotpy_native_build_info.bzl
generated
8
wpiutil/robotpy_native_build_info.bzl
generated
@@ -50,4 +50,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/wpiutil",
|
||||
install_path = "native/wpiutil/",
|
||||
strip_path_prefixes = ["wpiutil"],
|
||||
requires = ["msvc-runtime>=14.42.34433; platform_system == 'Windows'"],
|
||||
summary = "WPILib Utility Library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpiutil = native.wpiutil",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
10
wpiutil/robotpy_pybind_build_info.bzl
generated
10
wpiutil/robotpy_pybind_build_info.bzl
generated
@@ -6,7 +6,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "publish_casters", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def wpiutil_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def wpiutil_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
WPIUTIL_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "Color",
|
||||
@@ -252,6 +252,14 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
deps = [
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
strip_path_prefixes = ["wpiutil/src/main/python", "wpiutil"],
|
||||
summary = "Binary wrapper for FRC WPIUtil library",
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["wpiutil-casters = wpiutil", "wpiutil = wpiutil"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
8
xrpVendordep/robotpy_native_build_info.bzl
generated
8
xrpVendordep/robotpy_native_build_info.bzl
generated
@@ -31,4 +31,12 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
headers = "{}.copy_headers".format(name),
|
||||
native_shared_library = "shared/xrpVendordep",
|
||||
install_path = "native/xrp/",
|
||||
strip_path_prefixes = ["xrpVendordep"],
|
||||
requires = ["robotpy-native-wpilib==0.0.0"],
|
||||
summary = "WPILib XRP vendor library",
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"xrp = native.xrp",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
12
xrpVendordep/robotpy_pybind_build_info.bzl
generated
12
xrpVendordep/robotpy_pybind_build_info.bzl
generated
@@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
|
||||
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
|
||||
|
||||
def xrp_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
||||
def xrp_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
|
||||
XRP_HEADER_GEN = [
|
||||
struct(
|
||||
class_name = "XRPGyro",
|
||||
@@ -205,6 +205,16 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
"//xrpVendordep:robotpy-native-xrp",
|
||||
],
|
||||
strip_path_prefixes = ["xrpVendordep/src/main/python", "xrpVendordep"],
|
||||
summary = "Binary wrapper for WPILib XRP Vendor library",
|
||||
project_urls = None,
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-xrp==0.0.0", "wpilib==0.0.0"],
|
||||
entry_points = {
|
||||
"pkg_config": ["xrp = xrp"],
|
||||
"robotpy_cli.2027": ["run-xrp = xrp.cli:RunXrp"],
|
||||
"robotpy_sim.2027": ["xrp = xrp.extension"],
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user