mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[python] Improve robotpy generation (#8867)
The initial build file generation for robotpy projects was relatively naive and purpose built to get `allwpilib` compiling, without supporting all the available features. This modifies the generation scripts to be able to support multiple embedded libraries, which will be necessary for #8858, since `mrclib.so` will need to be bundled along with the hal libraries. In addition some cleanup was done to get the wheels looking more like what is in pypi.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_python//python:defs.bzl", "py_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_default_cc_project")
|
||||
load("//shared/bazel/rules:publishing.bzl", "host_architectures")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "copy_native_file")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pytest_util.bzl", "robotpy_py_test")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "robotpy_library")
|
||||
|
||||
cc_library(
|
||||
name = "headers",
|
||||
@@ -103,13 +103,28 @@ copy_native_file(
|
||||
library = "shared/halsim_ds_socket",
|
||||
)
|
||||
|
||||
py_library(
|
||||
generate_version_file(
|
||||
name = "generate_python_version",
|
||||
output_file = "src/main/python/halsim_ds_socket/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = "robotpy-halsim-ds-socket",
|
||||
srcs = glob(["src/main/python/**/*.py"]),
|
||||
data = [
|
||||
":halsim_ds_socket.copy_lib",
|
||||
],
|
||||
srcs = glob(["src/main/python/**/*.py"]) + [":generate_python_version"],
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
data = [":halsim_ds_socket.copy_lib"],
|
||||
distribution = "robotpy-halsim-ds-socket",
|
||||
entry_points = {
|
||||
"robotpy_sim.2027": ["ds-socket = halsim_ds_socket"],
|
||||
},
|
||||
imports = ["src/main/python"],
|
||||
requires = [
|
||||
"robotpy-native-wpihal==0.0.0",
|
||||
"robotpy-native-wpinet==0.0.0",
|
||||
],
|
||||
strip_path_prefixes = ["simulation/halsim_ds_socket/src/main/python"],
|
||||
summary = "WPILib simulator DS Socket Extension",
|
||||
deps = [
|
||||
"//hal:robotpy-native-wpihal",
|
||||
"//wpinet:robotpy-native-wpinet",
|
||||
|
||||
@@ -9,6 +9,7 @@ requires = [
|
||||
name = "robotpy-halsim-ds-socket"
|
||||
version = "0.0.0"
|
||||
description = "WPILib simulator DS Socket Extension"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 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", "copy_native_file", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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 = []):
|
||||
@@ -130,6 +130,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-halsim-gui",
|
||||
srcs = native.glob(["src/main/python/halsim_gui/**/*.py"]) + [
|
||||
"src/main/python/halsim_gui/_ext/_init__halsim_gui_ext.py",
|
||||
"{}.generate_version".format(name),
|
||||
|
||||
@@ -15,6 +15,7 @@ requires = [
|
||||
name = "robotpy-halsim-gui"
|
||||
version = "0.0.0"
|
||||
description = "WPILib simulation GUI"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
||||
load("@rules_python//python:defs.bzl", "py_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_default_cc_project")
|
||||
load("//shared/bazel/rules:publishing.bzl", "host_architectures")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "copy_native_file")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//shared/bazel/rules/robotpy:pytest_util.bzl", "robotpy_py_test")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "robotpy_library")
|
||||
|
||||
wpilib_cc_library(
|
||||
name = "halsim_ws_core",
|
||||
@@ -71,15 +71,35 @@ copy_native_file(
|
||||
library = "//simulation/halsim_ws_server:shared/halsim_ws_server",
|
||||
)
|
||||
|
||||
py_library(
|
||||
generate_version_file(
|
||||
name = "generate_python_version",
|
||||
output_file = "src/main/python/halsim_ws/version.py",
|
||||
template = "//shared/bazel/rules/robotpy:version_template.in",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = "robotpy-halsim-ws",
|
||||
srcs = glob(["src/main/python/**/*.py"]),
|
||||
srcs = glob(["src/main/python/**/*.py"]) + [":generate_python_version"],
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
data = [
|
||||
":halsim_ws_client.copy_lib",
|
||||
":halsim_ws_server.copy_lib",
|
||||
],
|
||||
distribution = "robotpy-halsim-ws",
|
||||
entry_points = {
|
||||
"robotpy_sim.2027": [
|
||||
"ws-client = halsim_ws.client",
|
||||
"ws-server = halsim_ws.server",
|
||||
],
|
||||
},
|
||||
imports = ["src/main/python"],
|
||||
visibility = ["//visibility:public"],
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
requires = [
|
||||
"robotpy-native-wpihal==0.0.0",
|
||||
"robotpy-native-wpinet==0.0.0",
|
||||
],
|
||||
strip_path_prefixes = ["simulation/halsim_ws_core/src/main/python"],
|
||||
summary = "WPILib simulator websim Extensions",
|
||||
deps = [
|
||||
"//hal:robotpy-native-wpihal",
|
||||
"//wpinet:robotpy-native-wpinet",
|
||||
|
||||
@@ -9,6 +9,7 @@ requires = [
|
||||
name = "robotpy-halsim-ws"
|
||||
version = "0.0.0"
|
||||
description = "WPILib simulator websim Extensions"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user