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:
39
apriltag/robotpy_native_build_info.bzl
generated
39
apriltag/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True) + native.glob([
|
||||
@@ -20,25 +22,42 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/apriltag/_init_robotpy_native_apriltag.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/apriltag/_init_robotpy_native_apriltag.py",
|
||||
pc_file = "native/apriltag/robotpy-native-apriltag.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/apriltag/robotpy-native-apriltag.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "apriltag",
|
||||
library = "shared/apriltag",
|
||||
base_path = "native/apriltag/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-apriltag",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":apriltag.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//wpimath:robotpy-native-wpimath",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpimath==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["apriltag"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"apriltag = native.apriltag",
|
||||
|
||||
4
apriltag/robotpy_pybind_build_info.bzl
generated
4
apriltag/robotpy_pybind_build_info.bzl
generated
@@ -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", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -198,6 +198,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-apriltag",
|
||||
srcs = native.glob(["src/main/python/robotpy_apriltag/**/*.py"]) + [
|
||||
"src/main/python/robotpy_apriltag/_init__apriltag.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -219,6 +220,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["apriltag = robotpy_apriltag"],
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ requires = [
|
||||
name = "robotpy-native-apriltag"
|
||||
version = "0.0.0"
|
||||
description = "WPILib AprilTag Library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -14,6 +14,7 @@ requires = [
|
||||
name = "robotpy-apriltag"
|
||||
version = "0.0.0"
|
||||
description = "RobotPy bindings for WPILib's AprilTag library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
@@ -2,14 +2,13 @@ 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("@rules_python//python:defs.bzl", "py_binary")
|
||||
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")
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_default_cc_project")
|
||||
load("//shared/bazel/rules/robotpy:pytest_util.bzl", "robotpy_py_test")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "robotpy_library")
|
||||
|
||||
filegroup(
|
||||
name = "doxygen-files",
|
||||
@@ -188,30 +187,21 @@ package_default_cc_project(
|
||||
maven_group_id = "org.wpilib.commandsv2",
|
||||
)
|
||||
|
||||
py_library(
|
||||
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(
|
||||
robotpy_library(
|
||||
name = "commandsv2-py",
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
wheel = ":commandsv2-wheel",
|
||||
srcs = glob(["src/main/python/**/*.py"]),
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
description_file = "src/main/python/README.md",
|
||||
distribution = "robotpy-commands-v2",
|
||||
imports = ["src/main/python"],
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
python_requires = ">=3.10",
|
||||
requires = [
|
||||
"wpilib==0.0.0",
|
||||
"typing_extensions>=4.1.0,<5",
|
||||
],
|
||||
strip_path_prefixes = ["commandsv2/src/main/python"],
|
||||
summary = "WPILib command framework v2",
|
||||
deps = [
|
||||
"//wpilibc:robotpy-wpilib",
|
||||
requirement("typing-extensions"),
|
||||
|
||||
@@ -7,7 +7,7 @@ name = "robotpy-commands-v2"
|
||||
version = "0.0.0"
|
||||
description = "WPILib command framework v2"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
license-files = ["LICENSE"]
|
||||
dependencies = [
|
||||
@@ -24,7 +24,7 @@ name = "RobotPy Development Team"
|
||||
email = "robotpy@googlegroups.com"
|
||||
|
||||
[project.urls]
|
||||
"Source code" = "https://github.com/robotpy/robotpy-commands-v2"
|
||||
"Source code" = "https://github.com/robotpy/mostrobotpy"
|
||||
|
||||
[tool.hatch.version]
|
||||
source = "vcs"
|
||||
|
||||
39
datalog/robotpy_native_build_info.bzl
generated
39
datalog/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
@@ -17,23 +19,40 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/datalog/_init_robotpy_native_datalog.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/datalog/_init_robotpy_native_datalog.py",
|
||||
pc_file = "native/datalog/robotpy-native-datalog.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/datalog/robotpy-native-datalog.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "datalog",
|
||||
library = "shared/datalog",
|
||||
base_path = "native/datalog/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-datalog",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":datalog.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["datalog"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"datalog = native.datalog",
|
||||
|
||||
4
datalog/robotpy_pybind_build_info.bzl
generated
4
datalog/robotpy_pybind_build_info.bzl
generated
@@ -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", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -193,6 +193,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-wpilog",
|
||||
srcs = native.glob(["src/main/python/wpilog/**/*.py"]) + [
|
||||
"src/main/python/wpilog/_init__wpilog.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -213,6 +214,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["wpilog = wpilog"],
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ requires = [
|
||||
name = "robotpy-native-datalog"
|
||||
version = "0.0.0"
|
||||
description = "WPILib Utility Library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -12,6 +12,7 @@ requires = [
|
||||
name = "robotpy-wpilog"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib logging library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
39
hal/robotpy_native_build_info.bzl
generated
39
hal/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
@@ -17,25 +19,42 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/wpihal/_init_robotpy_native_wpihal.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpihal/_init_robotpy_native_wpihal.py",
|
||||
pc_file = "native/wpihal/robotpy-native-wpihal.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//ntcore:native/ntcore/robotpy-native-ntcore.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/wpihal/robotpy-native-wpihal.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "wpiHal",
|
||||
library = "shared/wpiHal",
|
||||
base_path = "native/wpihal/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-wpihal",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":wpiHal.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//ntcore:robotpy-native-ntcore",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-ntcore==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["hal"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpihal = native.wpihal",
|
||||
|
||||
4
hal/robotpy_pybind_build_info.bzl
generated
4
hal/robotpy_pybind_build_info.bzl
generated
@@ -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", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -402,6 +402,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-hal",
|
||||
srcs = native.glob(["src/main/python/hal/**/*.py"]) + [
|
||||
"src/main/python/hal/simulation/_init__simulation.py",
|
||||
"src/main/python/hal/_init__wpiHal.py",
|
||||
@@ -426,6 +427,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["hal_simulation = hal.simulation", "wpihal = hal"],
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ requires = [
|
||||
name = "robotpy-native-wpihal"
|
||||
version = "0.0.0"
|
||||
description = "WPILib HAL implementation"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -13,6 +13,7 @@ requires = [
|
||||
name = "robotpy-hal"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib HAL"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
39
ntcore/robotpy_native_build_info.bzl
generated
39
ntcore/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
@@ -17,27 +19,44 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/ntcore/_init_robotpy_native_ntcore.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/ntcore/_init_robotpy_native_ntcore.py",
|
||||
pc_file = "native/ntcore/robotpy-native-ntcore.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//datalog:native/datalog/robotpy-native-datalog.pc",
|
||||
"//wpinet:native/wpinet/robotpy-native-wpinet.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/ntcore/robotpy-native-ntcore.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "ntcore",
|
||||
library = "shared/ntcore",
|
||||
base_path = "native/ntcore/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-ntcore",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":ntcore.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//datalog:robotpy-native-datalog",
|
||||
"//wpinet:robotpy-native-wpinet",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpinet==0.0.0", "robotpy-native-datalog==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["ntcore"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"ntcore = native.ntcore",
|
||||
|
||||
4
ntcore/robotpy_pybind_build_info.bzl
generated
4
ntcore/robotpy_pybind_build_info.bzl
generated
@@ -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", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -468,6 +468,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "pyntcore",
|
||||
srcs = native.glob(["src/main/python/ntcore/**/*.py"]) + [
|
||||
"src/main/python/ntcore/_init__ntcore.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -490,6 +491,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["ntcore = ntcore"],
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@ requires = [
|
||||
name = "robotpy-native-ntcore"
|
||||
version = "0.0.0"
|
||||
description = "WPILib NetworkTables Library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -16,6 +16,7 @@ requires = [
|
||||
name = "pyntcore"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrappers for the FIRST ntcore library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
39
romiVendordep/robotpy_native_build_info.bzl
generated
39
romiVendordep/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
@@ -17,23 +19,40 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/romi/_init_robotpy_native_romi.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/romi/_init_robotpy_native_romi.py",
|
||||
pc_file = "native/romi/robotpy-native-romi.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//wpilibc:native/wpilib/robotpy-native-wpilib.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/romi/robotpy-native-romi.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "romiVendordep",
|
||||
library = "shared/romiVendordep",
|
||||
base_path = "native/romi/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-romi",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":romiVendordep.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//wpilibc:robotpy-native-wpilib",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpilib==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["romiVendordep"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"romi = native.romi",
|
||||
|
||||
4
romiVendordep/robotpy_pybind_build_info.bzl
generated
4
romiVendordep/robotpy_pybind_build_info.bzl
generated
@@ -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", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -160,6 +160,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-romi",
|
||||
srcs = native.glob(["src/main/python/romi/**/*.py"]) + [
|
||||
"src/main/python/romi/_init__romi.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -181,6 +182,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["romi = romi"],
|
||||
"robotpy_cli.2027": ["run-romi = romi.cli:RunRomi"],
|
||||
|
||||
@@ -11,6 +11,7 @@ requires = [
|
||||
name = "robotpy-native-romi"
|
||||
version = "0.0.0"
|
||||
description = "WPILib Romi support library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -14,6 +14,7 @@ requires = [
|
||||
name = "robotpy-romi"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib Romi Vendor library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
@@ -31,6 +31,7 @@ py_binary(
|
||||
deps = [
|
||||
":generation_utils",
|
||||
":hack_pkgcfgs",
|
||||
"//shared/bazel/rules/robotpy/hatchlib_native_port:generate_native_lib_files",
|
||||
requirement("semiwrap"),
|
||||
requirement("jinja2"),
|
||||
],
|
||||
|
||||
@@ -3,12 +3,14 @@ import json
|
||||
|
||||
import tomli
|
||||
from jinja2 import BaseLoader, Environment
|
||||
from packaging.markers import Marker
|
||||
|
||||
from shared.bazel.rules.robotpy.generation_utils import (
|
||||
fixup_python_dep_name,
|
||||
fixup_root_package_name,
|
||||
fixup_shared_lib_name,
|
||||
)
|
||||
from shared.bazel.rules.robotpy.hatchlib_native_port.config import PcFileConfig
|
||||
from shared.bazel.rules.robotpy.hatchlib_native_port.validate import parse_input
|
||||
|
||||
|
||||
def main():
|
||||
@@ -40,20 +42,48 @@ def main():
|
||||
env.filters["double_quotes"] = double_quotes
|
||||
env.filters["get_pc_dep"] = get_pc_dep
|
||||
env.filters["get_python_dep"] = get_python_dep
|
||||
env.filters["strip_src_prefix"] = lambda x: str(x).removeprefix("src/")
|
||||
template = env.from_string(BUILD_FILE_TEMPLATE)
|
||||
|
||||
nativelib_config = raw_config["tool"]["hatch"]["build"]["hooks"]["nativelib"]
|
||||
project_name = nativelib_config["pcfile"][0]["name"]
|
||||
project_name = raw_config["project"]["name"].replace("robotpy-native-", "")
|
||||
root_package = fixup_root_package_name(project_name)
|
||||
shared_library_name = fixup_shared_lib_name(project_name)
|
||||
pc_files = []
|
||||
|
||||
local_pc_names = set()
|
||||
for i, raw_pc in enumerate(nativelib_config.get("pcfile", [])):
|
||||
pcfile = parse_input(
|
||||
raw_pc,
|
||||
PcFileConfig,
|
||||
"pyproject.toml",
|
||||
f"tool.hatch.build.hooks.nativelib.pcfile[{i}]",
|
||||
)
|
||||
if pcfile.enable_if and not Marker(pcfile.enable_if).evaluate():
|
||||
continue
|
||||
pc_files.append(pcfile)
|
||||
local_pc_names.add(pcfile.get_pc_path().name[:-3])
|
||||
|
||||
requires = set()
|
||||
for pcfile in pc_files:
|
||||
if pcfile.requires:
|
||||
for dep in pcfile.requires:
|
||||
if dep not in local_pc_names:
|
||||
requires.add(dep)
|
||||
|
||||
maven_downloads = raw_config["tool"]["hatch"]["build"]["hooks"]["robotpy"][
|
||||
"maven_lib_download"
|
||||
]
|
||||
with open(args.output_file, "w") as f:
|
||||
f.write(
|
||||
template.render(
|
||||
raw_project_config=raw_config["project"],
|
||||
nativelib_config=nativelib_config,
|
||||
root_package=root_package,
|
||||
shared_library_name=shared_library_name,
|
||||
maven_downloads=maven_downloads,
|
||||
third_party_dirs=args.third_party_dirs or [],
|
||||
pc_files=pc_files,
|
||||
requires=requires,
|
||||
project_name=project_name,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -61,9 +91,11 @@ def main():
|
||||
BUILD_FILE_TEMPLATE = """# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True){% if third_party_dirs %} + native.glob([
|
||||
@@ -71,7 +103,7 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
"src/main/native/thirdparty/{{dir}}/include/**",
|
||||
{%- endfor %}
|
||||
]){%- endif %},
|
||||
out = "native/{{nativelib_config.pcfile[0].name}}/include",
|
||||
out = "native/{{project_name}}/include",
|
||||
root_paths = ["src/main/native/include/"],
|
||||
replace_prefixes = {
|
||||
"{{root_package}}/src/generated/main/native/include": "",
|
||||
@@ -84,30 +116,57 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = [{% for pcfile in pc_files %}"{{pcfile.get_init_module_path() | strip_src_prefix}}"{% if not loop.last %}, {% endif %}{%- endfor %}]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/{{nativelib_config.pcfile[0].name}}/_init_{{raw_project_config.name.replace("-", "_")}}.py",
|
||||
pc_file = "native/{{nativelib_config.pcfile[0].name}}/{{raw_project_config.name}}.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
{%- for dep in nativelib_config.pcfile[0].requires | sort %}
|
||||
{%- for dep in requires | sort %}
|
||||
"{{dep | get_pc_dep}}",
|
||||
{%- endfor %}
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = [{% for pcfile in pc_files %}"{{pcfile.pcfile | strip_src_prefix}}"{% if not loop.last %}, {% endif %}{%- endfor %}],
|
||||
)
|
||||
{%- for maven_info in maven_downloads %}
|
||||
{%- for lib in maven_info["libs"] %}
|
||||
|
||||
copy_native_file(
|
||||
name = "{{lib}}",
|
||||
library = "shared/{{lib}}",
|
||||
base_path = "native/{{project_name}}/",
|
||||
)
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "{{raw_project_config.name}}",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
{%- for maven_info in maven_downloads %}
|
||||
{%- for lib in maven_info["libs"] %}
|
||||
":{{lib}}.copy_lib",
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
{%- for dep in nativelib_config.pcfile[0].requires | sort %}
|
||||
{%- for dep in requires | sort %}
|
||||
"{{dep | get_python_dep}}",
|
||||
{%- endfor %}
|
||||
],
|
||||
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}}",
|
||||
requires = {{raw_project_config.dependencies | double_quotes}},
|
||||
python_requires = "{{raw_project_config["requires-python"]}}",
|
||||
strip_path_prefixes = ["{{root_package}}"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"{{nativelib_config.pcfile[0].name}} = native.{{nativelib_config.pcfile[0].name}}",
|
||||
{%- for pcfile in pc_files %}
|
||||
"{{pcfile.name}} = native.{{pcfile.name}}",
|
||||
{%- endfor %}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
@@ -209,6 +209,8 @@ class BazelExtensionModule:
|
||||
transitive_deps = set()
|
||||
self._get_transitive_native_dependencies(dep_name, transitive_deps)
|
||||
for d in transitive_deps:
|
||||
if d == "robotpy-native-mrclib":
|
||||
continue
|
||||
base_library = fixup_root_package_name(
|
||||
d.replace("robotpy-native-", "")
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import functools
|
||||
import os
|
||||
import pathlib
|
||||
import platform
|
||||
import sys
|
||||
@@ -22,9 +23,7 @@ is_macos = platform_sys == "Darwin"
|
||||
|
||||
|
||||
class NativelibHook:
|
||||
def __init__(self, output_pcfile, output_libinit, config, metadata):
|
||||
self.output_pcfile = output_pcfile
|
||||
self.output_libinit = output_libinit
|
||||
def __init__(self, output_pcfile, config, metadata):
|
||||
|
||||
self.config = config
|
||||
self.root_pth = output_pcfile.parent.parent.parent
|
||||
@@ -32,7 +31,19 @@ class NativelibHook:
|
||||
|
||||
def initialize(self):
|
||||
for pcfg in self._pcfiles:
|
||||
self._generate_pcfile(pcfg, {})
|
||||
pcfile = self._generate_pcfile(pcfg, {})
|
||||
self._add_pkg_config_path(str(pcfile.parent))
|
||||
|
||||
def _add_pkg_config_path(self, *paths: str) -> None:
|
||||
current = os.environ.get("PKG_CONFIG_PATH")
|
||||
entries = current.split(os.pathsep) if current else []
|
||||
|
||||
for path in paths:
|
||||
if path not in entries:
|
||||
entries.append(path)
|
||||
|
||||
if entries:
|
||||
os.environ["PKG_CONFIG_PATH"] = os.pathsep.join(entries)
|
||||
|
||||
def _get_pkg_from_path(self, path: pathlib.Path) -> str:
|
||||
rel = path.relative_to(self.root_pth)
|
||||
@@ -43,7 +54,7 @@ class NativelibHook:
|
||||
) -> pathlib.Path:
|
||||
|
||||
pcfile_rel = pcfg.get_pc_path()
|
||||
pcfile = self.output_pcfile
|
||||
pcfile = self.root_pth / str(pcfile_rel).removeprefix("src/")
|
||||
prefix_rel = pcfile_rel.parent
|
||||
prefix_path = pcfile.parent
|
||||
|
||||
@@ -147,7 +158,7 @@ class NativelibHook:
|
||||
build_data: T.Dict[str, T.Any],
|
||||
):
|
||||
libinit_py_rel = pcfg.get_init_module_path()
|
||||
self.root_pth / libinit_py_rel
|
||||
libinit_py = self.root_pth / str(libinit_py_rel).removeprefix("src/")
|
||||
|
||||
libdir = prefix_path
|
||||
if pcfg.libdir:
|
||||
@@ -165,7 +176,7 @@ class NativelibHook:
|
||||
else:
|
||||
requires = []
|
||||
|
||||
_write_libinit_py(self.output_libinit, lib_paths, requires)
|
||||
_write_libinit_py(libinit_py, lib_paths, requires)
|
||||
|
||||
def _make_shared_lib_fname(self, lib: str):
|
||||
if is_windows:
|
||||
@@ -298,9 +309,8 @@ def _write_libinit_py(
|
||||
|
||||
def main():
|
||||
pyproject_toml = sys.argv[1]
|
||||
libinit_file = pathlib.Path(sys.argv[2])
|
||||
pc_file = pathlib.Path(sys.argv[3])
|
||||
pkgcfgs = [pathlib.Path(x) for x in sys.argv[4:]]
|
||||
pc_file = pathlib.Path(sys.argv[2])
|
||||
pkgcfgs = [pathlib.Path(x) for x in sys.argv[3:]]
|
||||
|
||||
hack_pkgconfig(pkgcfgs)
|
||||
|
||||
@@ -310,7 +320,7 @@ def main():
|
||||
nativelib_cfg = raw_config["tool"]["hatch"]["build"]["hooks"]["nativelib"]
|
||||
metadata = raw_config["project"]
|
||||
|
||||
generator = NativelibHook(pc_file, libinit_file, nativelib_cfg, metadata)
|
||||
generator = NativelibHook(pc_file, nativelib_cfg, metadata)
|
||||
generator.initialize()
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
{%- if version_file %}
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
{%- endif %}
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "create_pybind_library", "robotpy_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%}
|
||||
@@ -193,6 +193,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
{% endif %}
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "{{raw_project_config.name}}",
|
||||
srcs = native.glob(["{{stripped_include_prefix}}/{{top_level_name}}/**/*.py"]) + [
|
||||
{%- for em in extension_modules %}
|
||||
"{{stripped_include_prefix}}/{{ em.gen_pkgconf.libinit_py.replace(".", "/") }}.py",
|
||||
@@ -222,6 +223,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
project_urls = {{raw_project_config.urls | jsonify}},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = {{raw_project_config.dependencies | jsonify}},
|
||||
python_requires = {{raw_project_config["requires-python"] | jsonify}},
|
||||
entry_points = {
|
||||
{%- for group, entries in entry_points.items() %}
|
||||
"{{ group }}": {{entries | jsonify}},
|
||||
|
||||
@@ -87,11 +87,14 @@ def robotpy_library(
|
||||
deps = [],
|
||||
data = [],
|
||||
strip_path_prefixes = None,
|
||||
distribution = None,
|
||||
summary = None,
|
||||
project_urls = None,
|
||||
author_email = None,
|
||||
entry_points = None,
|
||||
requires = None,
|
||||
description_file = None,
|
||||
python_requires = None,
|
||||
**kwargs):
|
||||
"""
|
||||
Defines a python library that is wrapping a series of pybind extensions.
|
||||
@@ -110,7 +113,7 @@ def robotpy_library(
|
||||
|
||||
py_wheel(
|
||||
name = "{}-wheel".format(name),
|
||||
distribution = name,
|
||||
distribution = distribution,
|
||||
stamp = 1,
|
||||
version = "$(ROBOTPY_VERSION)",
|
||||
summary = summary,
|
||||
@@ -120,6 +123,8 @@ def robotpy_library(
|
||||
deps = data + [":{}-lib".format(name)],
|
||||
strip_path_prefixes = strip_path_prefixes,
|
||||
entry_points = entry_points,
|
||||
description_file = description_file,
|
||||
python_requires = python_requires,
|
||||
license = "BSD-3-Clause",
|
||||
tags = ["robotpy"],
|
||||
)
|
||||
@@ -172,90 +177,25 @@ def copy_native_file(name, library, base_path):
|
||||
tags = ["robotpy"],
|
||||
)
|
||||
|
||||
def _folder_prefix(name):
|
||||
if "/" in name:
|
||||
last_slash = name.rfind("/")
|
||||
return (name[0:last_slash], name[last_slash + 1:])
|
||||
else:
|
||||
return ("", name)
|
||||
|
||||
def native_wrappery_library(
|
||||
name,
|
||||
pyproject_toml,
|
||||
libinit_file,
|
||||
pc_file,
|
||||
pc_deps,
|
||||
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
|
||||
"""
|
||||
def generate_native_files(name, pyproject_toml, pc_deps, libinit_files, pc_files):
|
||||
cmd = "$(locations //shared/bazel/rules/robotpy/hatchlib_native_port:generate_native_lib_files) "
|
||||
cmd += " $(location " + pyproject_toml + ")"
|
||||
cmd += " $(OUTS) "
|
||||
cmd += " $(location " + pc_files[0] + ") "
|
||||
for pc_dep in pc_deps:
|
||||
cmd += " $(location " + pc_dep + ")"
|
||||
|
||||
native.genrule(
|
||||
name = name + ".gen",
|
||||
srcs = [pyproject_toml],
|
||||
outs = [libinit_file, pc_file],
|
||||
outs = libinit_files + pc_files,
|
||||
cmd = cmd,
|
||||
tools = ["//shared/bazel/rules/robotpy/hatchlib_native_port:generate_native_lib_files"] + pc_deps,
|
||||
visibility = ["//visibility:public"],
|
||||
tags = ["robotpy"],
|
||||
)
|
||||
|
||||
prefix, libname = _folder_prefix(native_shared_library)
|
||||
|
||||
copy_native_file(
|
||||
name = libname,
|
||||
library = native_shared_library,
|
||||
base_path = install_path,
|
||||
target_compatible_with = robotpy_compatibility_select(),
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
name = name + ".pc_wrapper",
|
||||
srcs = [pc_file],
|
||||
)
|
||||
|
||||
py_library(
|
||||
name = name + "-lib",
|
||||
srcs = [libinit_file],
|
||||
data = [pc_file, ":{}.copy_lib".format(libname), headers],
|
||||
deps = deps,
|
||||
imports = ["."],
|
||||
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,
|
||||
srcs = pc_files,
|
||||
)
|
||||
@@ -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"},
|
||||
]
|
||||
|
||||
39
wpilibc/robotpy_native_build_info.bzl
generated
39
wpilibc/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
@@ -17,11 +19,11 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/wpilib/_init_robotpy_native_wpilib.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpilib/_init_robotpy_native_wpilib.py",
|
||||
pc_file = "native/wpilib/robotpy-native-wpilib.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//ntcore:native/ntcore/robotpy-native-ntcore.pc",
|
||||
"//hal:native/wpihal/robotpy-native-wpihal.pc",
|
||||
@@ -29,6 +31,25 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
"//wpinet:native/wpinet/robotpy-native-wpinet.pc",
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/wpilib/robotpy-native-wpilib.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "wpilibc",
|
||||
library = "shared/wpilibc",
|
||||
base_path = "native/wpilib/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-wpilib",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":wpilibc.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//ntcore:robotpy-native-ntcore",
|
||||
"//hal:robotpy-native-wpihal",
|
||||
@@ -36,12 +57,10 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
"//wpinet:robotpy-native-wpinet",
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
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",
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["wpilibc"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpilib = native.wpilib",
|
||||
|
||||
4
wpilibc/robotpy_pybind_build_info.bzl
generated
4
wpilibc/robotpy_pybind_build_info.bzl
generated
@@ -2,7 +2,7 @@
|
||||
|
||||
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
||||
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:robotpy_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")
|
||||
|
||||
@@ -1720,6 +1720,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "wpilib",
|
||||
srcs = native.glob(["src/main/python/wpilib/**/*.py"]) + [
|
||||
"src/main/python/wpilib/_init__wpilib.py",
|
||||
"src/main/python/wpilib/simulation/_init__simulation.py",
|
||||
@@ -1749,6 +1750,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
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"],
|
||||
|
||||
@@ -15,6 +15,7 @@ requires = [
|
||||
name = "robotpy-native-wpilib"
|
||||
version = "0.0.0"
|
||||
description = "WPILib Robotics Library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -16,6 +16,7 @@ requires = [
|
||||
name = "wpilib"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
39
wpimath/robotpy_native_build_info.bzl
generated
39
wpimath/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True) + native.glob([
|
||||
@@ -22,23 +24,40 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/wpimath/_init_robotpy_native_wpimath.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpimath/_init_robotpy_native_wpimath.py",
|
||||
pc_file = "native/wpimath/robotpy-native-wpimath.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/wpimath/robotpy-native-wpimath.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "wpimath",
|
||||
library = "shared/wpimath",
|
||||
base_path = "native/wpimath/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-wpimath",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":wpimath.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["wpimath"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpimath = native.wpimath",
|
||||
|
||||
4
wpimath/robotpy_pybind_build_info.bzl
generated
4
wpimath/robotpy_pybind_build_info.bzl
generated
@@ -2,7 +2,7 @@
|
||||
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
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:robotpy_rules.bzl", "create_pybind_library", "robotpy_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")
|
||||
|
||||
@@ -1281,6 +1281,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-wpimath",
|
||||
srcs = native.glob(["src/main/python/wpimath/**/*.py"]) + [
|
||||
"src/main/python/wpimath/_init__wpimath.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -1301,6 +1302,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["wpimath-casters = wpimath", "wpimath = wpimath"],
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -121,6 +121,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "wpimath_test",
|
||||
srcs = native.glob(["src/test/python/cpp/wpimath_test/**/*.py"]) + [
|
||||
"src/test/python/cpp/wpimath_test/_init__wpimath_test.py",
|
||||
],
|
||||
@@ -138,6 +139,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
project_urls = None,
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = None,
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["wpimath_test = wpimath_test"],
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ requires = [
|
||||
name = "robotpy-native-wpimath"
|
||||
version = "0.0.0"
|
||||
description = "WPILib Math Library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -14,6 +14,7 @@ requires = [
|
||||
name = "robotpy-wpimath"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib Math library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
@@ -8,6 +8,7 @@ requires = [
|
||||
name = "wpimath_test"
|
||||
version = "0.1"
|
||||
description = "Test project for verifying robotpy-build behavior"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
39
wpinet/robotpy_native_build_info.bzl
generated
39
wpinet/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True) + native.glob([
|
||||
@@ -22,23 +24,40 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/wpinet/_init_robotpy_native_wpinet.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpinet/_init_robotpy_native_wpinet.py",
|
||||
pc_file = "native/wpinet/robotpy-native-wpinet.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/wpinet/robotpy-native-wpinet.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "wpinet",
|
||||
library = "shared/wpinet",
|
||||
base_path = "native/wpinet/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-wpinet",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":wpinet.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//wpiutil:robotpy-native-wpiutil",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["wpinet"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpinet = native.wpinet",
|
||||
|
||||
4
wpinet/robotpy_pybind_build_info.bzl
generated
4
wpinet/robotpy_pybind_build_info.bzl
generated
@@ -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", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -141,6 +141,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-wpinet",
|
||||
srcs = native.glob(["src/main/python/wpinet/**/*.py"]) + [
|
||||
"src/main/python/wpinet/_init__wpinet.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -161,6 +162,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
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"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["wpinet = wpinet"],
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ requires = [
|
||||
name = "robotpy-native-wpinet"
|
||||
version = "0.0.0"
|
||||
description = "WPILib Networking Library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -14,6 +14,7 @@ requires = [
|
||||
name = "robotpy-wpinet"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib networking library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
@@ -9,8 +9,8 @@ load("//shared/bazel/rules:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_
|
||||
load("//shared/bazel/rules:packaging.bzl", "package_default_jni_project")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
load("//shared/bazel/rules/robotpy:build_info_gen.bzl", "generate_robotpy_native_wrapper_build_info", "generate_robotpy_pybind_build_info")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library")
|
||||
load("//shared/bazel/rules/robotpy:pytest_util.bzl", "robotpy_py_test")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "create_pybind_library")
|
||||
load("//wpiutil:generate.bzl", "generate_wpiutil")
|
||||
load("//wpiutil:robotpy_native_build_info.bzl", "define_native_wrapper")
|
||||
load("//wpiutil:robotpy_pybind_build_info.bzl", "define_pybind_library", "publish_library_casters", "wpiutil_extension")
|
||||
|
||||
39
wpiutil/robotpy_native_build_info.bzl
generated
39
wpiutil/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True) + native.glob([
|
||||
@@ -40,21 +42,38 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/wpiutil/_init_robotpy_native_wpiutil.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/wpiutil/_init_robotpy_native_wpiutil.py",
|
||||
pc_file = "native/wpiutil/robotpy-native-wpiutil.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/wpiutil/robotpy-native-wpiutil.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "wpiutil",
|
||||
library = "shared/wpiutil",
|
||||
base_path = "native/wpiutil/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-wpiutil",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":wpiutil.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
],
|
||||
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",
|
||||
requires = ["msvc-runtime>=14.42.34433; platform_system == 'Windows'"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["wpiutil"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"wpiutil = native.wpiutil",
|
||||
|
||||
4
wpiutil/robotpy_pybind_build_info.bzl
generated
4
wpiutil/robotpy_pybind_build_info.bzl
generated
@@ -2,7 +2,7 @@
|
||||
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
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:robotpy_rules.bzl", "create_pybind_library", "robotpy_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")
|
||||
|
||||
@@ -238,6 +238,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-wpiutil",
|
||||
srcs = native.glob(["src/main/python/wpiutil/**/*.py"]) + [
|
||||
"src/main/python/wpiutil/_init__wpiutil.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -257,6 +258,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-wpiutil==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["wpiutil-casters = wpiutil", "wpiutil = wpiutil"],
|
||||
},
|
||||
|
||||
@@ -10,6 +10,7 @@ requires = [
|
||||
name = "robotpy-native-wpiutil"
|
||||
version = "0.0.0"
|
||||
description = "WPILib Utility Library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -12,6 +12,7 @@ requires = [
|
||||
name = "robotpy-wpiutil"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib utilities library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
39
xrpVendordep/robotpy_native_build_info.bzl
generated
39
xrpVendordep/robotpy_native_build_info.bzl
generated
@@ -1,9 +1,11 @@
|
||||
# THIS FILE IS AUTO GENERATED
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
||||
load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "native_wrappery_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
|
||||
|
||||
def define_native_wrapper(name, pyproject_toml = None):
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
|
||||
|
||||
copy_to_directory(
|
||||
name = "{}.copy_headers".format(name),
|
||||
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True),
|
||||
@@ -17,23 +19,40 @@ def define_native_wrapper(name, pyproject_toml = None):
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
native_wrappery_library(
|
||||
libinit_files = ["native/xrp/_init_robotpy_native_xrp.py"]
|
||||
|
||||
generate_native_files(
|
||||
name = name,
|
||||
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml",
|
||||
libinit_file = "native/xrp/_init_robotpy_native_xrp.py",
|
||||
pc_file = "native/xrp/robotpy-native-xrp.pc",
|
||||
pyproject_toml = pyproject_toml,
|
||||
pc_deps = [
|
||||
"//wpilibc:native/wpilib/robotpy-native-wpilib.pc",
|
||||
],
|
||||
libinit_files = libinit_files,
|
||||
pc_files = ["native/xrp/robotpy-native-xrp.pc"],
|
||||
)
|
||||
|
||||
copy_native_file(
|
||||
name = "xrpVendordep",
|
||||
library = "shared/xrpVendordep",
|
||||
base_path = "native/xrp/",
|
||||
)
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-native-xrp",
|
||||
srcs = libinit_files,
|
||||
data = [
|
||||
name + ".pc_wrapper",
|
||||
":xrpVendordep.copy_lib",
|
||||
"{}.copy_headers".format(name),
|
||||
],
|
||||
deps = [
|
||||
"//wpilibc:robotpy-native-wpilib",
|
||||
],
|
||||
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",
|
||||
requires = ["robotpy-native-wpilib==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
strip_path_prefixes = ["xrpVendordep"],
|
||||
entry_points = {
|
||||
"pkg_config": [
|
||||
"xrp = native.xrp",
|
||||
|
||||
4
xrpVendordep/robotpy_pybind_build_info.bzl
generated
4
xrpVendordep/robotpy_pybind_build_info.bzl
generated
@@ -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", "create_pybind_library", "robotpy_library")
|
||||
load("//shared/bazel/rules/robotpy:robotpy_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")
|
||||
|
||||
@@ -190,6 +190,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
|
||||
robotpy_library(
|
||||
name = name,
|
||||
distribution = "robotpy-xrp",
|
||||
srcs = native.glob(["src/main/python/xrp/**/*.py"]) + [
|
||||
"src/main/python/xrp/_init__xrp.py",
|
||||
"{}.generate_version".format(name),
|
||||
@@ -210,6 +211,7 @@ def define_pybind_library(name, pkgcfgs = []):
|
||||
project_urls = None,
|
||||
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
|
||||
requires = ["robotpy-native-xrp==0.0.0", "wpilib==0.0.0"],
|
||||
python_requires = ">=3.11",
|
||||
entry_points = {
|
||||
"pkg_config": ["xrp = xrp"],
|
||||
"robotpy_cli.2027": ["run-xrp = xrp.cli:RunXrp"],
|
||||
|
||||
@@ -11,6 +11,7 @@ requires = [
|
||||
name = "robotpy-native-xrp"
|
||||
version = "0.0.0"
|
||||
description = "WPILib XRP vendor library"
|
||||
requires-python = ">=3.11"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -14,6 +14,7 @@ requires = [
|
||||
name = "robotpy-xrp"
|
||||
version = "0.0.0"
|
||||
description = "Binary wrapper for WPILib XRP Vendor library"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user