mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Resync with `mostrobotpy` This mostly involves the big "ignore almost everything in the HAL project" and some fixups for the Addressable LED classes. Required two small hand fixes to get it building over here with bazel, and with more compiler warnings on. I also manually zeroed out the `repo_url` field in the toml files to avoid unnecessary churn whenever it goes from a release build to a development build. I already did this with `version` field in there, and will do a follow up PR that updates the copybara script to do it automatically. --------- Co-authored-by: Default email <default@default.com>
410 lines
16 KiB
Python
Generated
410 lines
16 KiB
Python
Generated
# THIS FILE IS AUTO GENERATED
|
|
|
|
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
|
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "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")
|
|
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 = []):
|
|
HAL_SIMULATION_HEADER_GEN = [
|
|
struct(
|
|
class_name = "DriverStationData",
|
|
yml_file = "semiwrap/simulation/DriverStationData.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/DriverStationData.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "MockHooks",
|
|
yml_file = "semiwrap/simulation/MockHooks.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/MockHooks.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "NotifierData",
|
|
yml_file = "semiwrap/simulation/NotifierData.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/NotifierData.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [
|
|
("HALSIM_NotifierInfo", "__HALSIM_NotifierInfo.hpp"),
|
|
],
|
|
),
|
|
struct(
|
|
class_name = "Reset",
|
|
yml_file = "semiwrap/simulation/Reset.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/Reset.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "SimDeviceData",
|
|
yml_file = "semiwrap/simulation/SimDeviceData.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/simulation/SimDeviceData.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
]
|
|
|
|
resolve_casters(
|
|
name = "hal_simulation.resolve_casters",
|
|
caster_deps = ["//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
|
casters_pkl_file = "hal_simulation.casters.pkl",
|
|
dep_file = "hal_simulation.casters.d",
|
|
)
|
|
|
|
gen_libinit(
|
|
name = "hal_simulation.gen_lib_init",
|
|
output_file = "src/main/python/hal/simulation/_init__simulation.py",
|
|
modules = ["native.wpihal._init_robotpy_native_wpihal", "wpiutil._init__wpiutil", "ntcore._init__ntcore"],
|
|
)
|
|
|
|
gen_pkgconf(
|
|
name = "hal_simulation.gen_pkgconf",
|
|
libinit_py = "hal.simulation._init__simulation",
|
|
module_pkg_name = "hal.simulation._simulation",
|
|
output_file = "hal_simulation.pc",
|
|
pkg_name = "hal_simulation",
|
|
install_path = "src/main/python/hal/simulation",
|
|
project_file = "src/main/python/pyproject.toml",
|
|
package_root = "src/main/python/hal/__init__.py",
|
|
)
|
|
|
|
gen_modinit_hpp(
|
|
name = "hal_simulation.gen_modinit_hpp",
|
|
input_dats = [x.class_name for x in HAL_SIMULATION_HEADER_GEN],
|
|
libname = "_simulation",
|
|
output_file = "semiwrap_init.hal.simulation._simulation.hpp",
|
|
)
|
|
|
|
run_header_gen(
|
|
name = "hal_simulation",
|
|
casters_pickle = "hal_simulation.casters.pkl",
|
|
header_gen_config = HAL_SIMULATION_HEADER_GEN,
|
|
trampoline_subpath = "src/main/python/hal/simulation",
|
|
deps = header_to_dat_deps,
|
|
local_native_libraries = [
|
|
"//datalog:robotpy-native-datalog.copy_headers",
|
|
"//hal:robotpy-native-wpihal.copy_headers",
|
|
"//ntcore:robotpy-native-ntcore.copy_headers",
|
|
"//wpinet:robotpy-native-wpinet.copy_headers",
|
|
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
|
],
|
|
)
|
|
|
|
create_pybind_library(
|
|
name = "hal_simulation",
|
|
install_path = "src/main/python/hal/simulation/",
|
|
extension_name = "_simulation",
|
|
generated_srcs = [":hal_simulation.generated_srcs"],
|
|
semiwrap_header = [":hal_simulation.gen_modinit_hpp"],
|
|
deps = [
|
|
":hal_simulation.tmpl_hdrs",
|
|
":hal_simulation.trampoline_hdrs",
|
|
"//hal:wpiHal",
|
|
"//ntcore:ntcore",
|
|
"//ntcore:ntcore_pybind_library",
|
|
"//wpiutil:wpiutil",
|
|
"//wpiutil:wpiutil_pybind_library",
|
|
],
|
|
dynamic_deps = [
|
|
"//hal:shared/wpiHal",
|
|
"//ntcore:shared/ntcore",
|
|
"//wpiutil:shared/wpiutil",
|
|
],
|
|
extra_hdrs = extra_hdrs,
|
|
extra_srcs = srcs,
|
|
includes = includes,
|
|
)
|
|
|
|
native.filegroup(
|
|
name = "hal_simulation.generated_files",
|
|
srcs = [
|
|
"hal_simulation.gen_modinit_hpp.gen",
|
|
"hal_simulation.header_gen_files",
|
|
"hal_simulation.gen_pkgconf",
|
|
"hal_simulation.gen_lib_init",
|
|
],
|
|
tags = ["manual", "robotpy"],
|
|
)
|
|
|
|
def wpihal_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []):
|
|
WPIHAL_HEADER_GEN = [
|
|
struct(
|
|
class_name = "CANAPITypes",
|
|
yml_file = "semiwrap/CANAPITypes.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/CANAPITypes.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [
|
|
("HAL_CANMessage", "__HAL_CANMessage.hpp"),
|
|
("HAL_CANReceiveMessage", "__HAL_CANReceiveMessage.hpp"),
|
|
],
|
|
),
|
|
struct(
|
|
class_name = "DriverStation",
|
|
yml_file = "semiwrap/DriverStation.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/DriverStation.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "DriverStationTypes",
|
|
yml_file = "semiwrap/DriverStationTypes.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/DriverStationTypes.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [
|
|
("HAL_ControlWord", "__HAL_ControlWord.hpp"),
|
|
("HAL_JoystickAxes", "__HAL_JoystickAxes.hpp"),
|
|
("HAL_JoystickPOVs", "__HAL_JoystickPOVs.hpp"),
|
|
("HAL_JoystickButtons", "__HAL_JoystickButtons.hpp"),
|
|
("HAL_JoystickDescriptor", "__HAL_JoystickDescriptor.hpp"),
|
|
("HAL_MatchInfo", "__HAL_MatchInfo.hpp"),
|
|
("HAL_JoystickTouchpadFinger", "__HAL_JoystickTouchpadFinger.hpp"),
|
|
("HAL_JoystickTouchpad", "__HAL_JoystickTouchpad.hpp"),
|
|
("HAL_JoystickTouchpads", "__HAL_JoystickTouchpads.hpp"),
|
|
("HAL_OpModeOption", "__HAL_OpModeOption.hpp"),
|
|
("wpi::hal::ControlWord", "wpi__hal__ControlWord.hpp"),
|
|
],
|
|
),
|
|
struct(
|
|
class_name = "Extensions",
|
|
yml_file = "semiwrap/Extensions.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Extensions.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "HALBase",
|
|
yml_file = "semiwrap/HALBase.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/HALBase.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "Main",
|
|
yml_file = "semiwrap/Main.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Main.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "Notifier",
|
|
yml_file = "semiwrap/Notifier.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Notifier.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "SimDevice",
|
|
yml_file = "semiwrap/SimDevice.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/SimDevice.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [
|
|
("wpi::hal::SimValue", "wpi__hal__SimValue.hpp"),
|
|
("wpi::hal::SimInt", "wpi__hal__SimInt.hpp"),
|
|
("wpi::hal::SimLong", "wpi__hal__SimLong.hpp"),
|
|
("wpi::hal::SimDouble", "wpi__hal__SimDouble.hpp"),
|
|
("wpi::hal::SimEnum", "wpi__hal__SimEnum.hpp"),
|
|
("wpi::hal::SimBoolean", "wpi__hal__SimBoolean.hpp"),
|
|
("wpi::hal::SimDevice", "wpi__hal__SimDevice.hpp"),
|
|
],
|
|
),
|
|
struct(
|
|
class_name = "Threads",
|
|
yml_file = "semiwrap/Threads.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/Threads.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
struct(
|
|
class_name = "UsageReporting",
|
|
yml_file = "semiwrap/UsageReporting.yml",
|
|
header_root = "$(execpath :robotpy-native-wpihal.copy_headers)",
|
|
header_file = "$(execpath :robotpy-native-wpihal.copy_headers)/wpi/hal/UsageReporting.h",
|
|
tmpl_class_names = [],
|
|
trampolines = [],
|
|
),
|
|
]
|
|
|
|
resolve_casters(
|
|
name = "wpihal.resolve_casters",
|
|
caster_deps = ["//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
|
|
casters_pkl_file = "wpihal.casters.pkl",
|
|
dep_file = "wpihal.casters.d",
|
|
)
|
|
|
|
gen_libinit(
|
|
name = "wpihal.gen_lib_init",
|
|
output_file = "src/main/python/hal/_init__wpiHal.py",
|
|
modules = ["native.wpihal._init_robotpy_native_wpihal", "wpiutil._init__wpiutil", "ntcore._init__ntcore"],
|
|
)
|
|
|
|
gen_pkgconf(
|
|
name = "wpihal.gen_pkgconf",
|
|
libinit_py = "hal._init__wpiHal",
|
|
module_pkg_name = "hal._wpiHal",
|
|
output_file = "wpihal.pc",
|
|
pkg_name = "wpihal",
|
|
install_path = "src/main/python/hal",
|
|
project_file = "src/main/python/pyproject.toml",
|
|
package_root = "src/main/python/hal/__init__.py",
|
|
)
|
|
|
|
gen_modinit_hpp(
|
|
name = "wpihal.gen_modinit_hpp",
|
|
input_dats = [x.class_name for x in WPIHAL_HEADER_GEN],
|
|
libname = "_wpiHal",
|
|
output_file = "semiwrap_init.hal._wpiHal.hpp",
|
|
)
|
|
|
|
run_header_gen(
|
|
name = "wpihal",
|
|
casters_pickle = "wpihal.casters.pkl",
|
|
header_gen_config = WPIHAL_HEADER_GEN,
|
|
trampoline_subpath = "src/main/python/hal",
|
|
deps = header_to_dat_deps,
|
|
local_native_libraries = [
|
|
"//datalog:robotpy-native-datalog.copy_headers",
|
|
"//hal:robotpy-native-wpihal.copy_headers",
|
|
"//ntcore:robotpy-native-ntcore.copy_headers",
|
|
"//wpinet:robotpy-native-wpinet.copy_headers",
|
|
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
|
],
|
|
)
|
|
|
|
create_pybind_library(
|
|
name = "wpihal",
|
|
install_path = "src/main/python/hal/",
|
|
extension_name = "_wpiHal",
|
|
generated_srcs = [":wpihal.generated_srcs"],
|
|
semiwrap_header = [":wpihal.gen_modinit_hpp"],
|
|
deps = [
|
|
":wpihal.tmpl_hdrs",
|
|
":wpihal.trampoline_hdrs",
|
|
"//hal:wpiHal",
|
|
"//ntcore:ntcore",
|
|
"//ntcore:ntcore_pybind_library",
|
|
"//wpiutil:wpiutil",
|
|
"//wpiutil:wpiutil_pybind_library",
|
|
],
|
|
dynamic_deps = [
|
|
"//hal:shared/wpiHal",
|
|
"//ntcore:shared/ntcore",
|
|
"//wpiutil:shared/wpiutil",
|
|
],
|
|
extra_hdrs = extra_hdrs,
|
|
extra_srcs = srcs,
|
|
includes = includes,
|
|
)
|
|
|
|
native.filegroup(
|
|
name = "wpihal.generated_files",
|
|
srcs = [
|
|
"wpihal.gen_modinit_hpp.gen",
|
|
"wpihal.header_gen_files",
|
|
"wpihal.gen_pkgconf",
|
|
"wpihal.gen_lib_init",
|
|
],
|
|
tags = ["manual", "robotpy"],
|
|
)
|
|
|
|
def define_pybind_library(name, pkgcfgs = []):
|
|
# Helper used to generate all files with one target.
|
|
native.filegroup(
|
|
name = "{}.generated_files".format(name),
|
|
srcs = [
|
|
"hal_simulation.generated_files",
|
|
"wpihal.generated_files",
|
|
],
|
|
tags = ["manual", "robotpy"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# Files that will be included in the wheel as data deps
|
|
native.filegroup(
|
|
name = "{}.generated_pkgcfg_files".format(name),
|
|
srcs = [
|
|
"src/main/python/hal/simulation/hal_simulation.pc",
|
|
"src/main/python/hal/wpihal.pc",
|
|
],
|
|
tags = ["manual", "robotpy"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# Contains all of the non-python files that need to be included in the wheel
|
|
native.filegroup(
|
|
name = "{}.extra_files".format(name),
|
|
srcs = native.glob(["src/main/python/hal/**"], exclude = ["src/main/python/hal/**/*.py"], allow_empty = True),
|
|
tags = ["manual", "robotpy"],
|
|
)
|
|
|
|
generate_version_file(
|
|
name = "{}.generate_version".format(name),
|
|
output_file = "src/main/python/hal/version.py",
|
|
template = "//shared/bazel/rules/robotpy:version_template.in",
|
|
)
|
|
|
|
robotpy_library(
|
|
name = name,
|
|
srcs = native.glob(["src/main/python/hal/**/*.py"]) + [
|
|
"src/main/python/hal/simulation/_init__simulation.py",
|
|
"src/main/python/hal/_init__wpiHal.py",
|
|
"{}.generate_version".format(name),
|
|
],
|
|
data = [
|
|
"{}.generated_pkgcfg_files".format(name),
|
|
"{}.extra_files".format(name),
|
|
":src/main/python/hal/simulation/_simulation",
|
|
":src/main/python/hal/_wpiHal",
|
|
":hal_simulation.trampoline_hdr_files",
|
|
":wpihal.trampoline_hdr_files",
|
|
],
|
|
imports = ["src/main/python"],
|
|
deps = [
|
|
"//hal:robotpy-native-wpihal",
|
|
"//ntcore:pyntcore",
|
|
"//wpiutil:robotpy-wpiutil",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
update_yaml_files(
|
|
name = "{}-update-yaml".format(name),
|
|
yaml_output_directory = "src/main/python/semiwrap",
|
|
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
|
"//datalog:robotpy-native-datalog.copy_headers",
|
|
"//hal:robotpy-native-wpihal.copy_headers",
|
|
"//ntcore:robotpy-native-ntcore.copy_headers",
|
|
"//wpinet:robotpy-native-wpinet.copy_headers",
|
|
"//wpiutil:robotpy-native-wpiutil.copy_headers",
|
|
],
|
|
package_root_file = "src/main/python/hal/__init__.py",
|
|
pkgcfgs = pkgcfgs,
|
|
pyproject_toml = "src/main/python/pyproject.toml",
|
|
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
|
|
)
|
|
|
|
scan_headers(
|
|
name = "{}-scan-headers".format(name),
|
|
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
|
|
"//hal:robotpy-native-wpihal.copy_headers",
|
|
],
|
|
package_root_file = "src/main/python/hal/__init__.py",
|
|
pkgcfgs = pkgcfgs,
|
|
pyproject_toml = "src/main/python/pyproject.toml",
|
|
)
|