diff --git a/.bazelrc b/.bazelrc index 63a96a2ccd..d7735ff777 100644 --- a/.bazelrc +++ b/.bazelrc @@ -74,6 +74,7 @@ build:ci --progress_report_interval=60 --show_progress_rate_limit=60 build --build_metadata=REPO_URL=https://github.com/wpilibsuite/allwpilib.git common --define="WPILIB_VERSION=2025.424242.3.1-unknown" +common --define="ROBOTPY_VERSION=2025.424242.3.1" # List of artifact types to build in CI. # Anything else gets skipped to speed up CI. diff --git a/BUILD.bazel b/BUILD.bazel index 4e60e8feb1..bcbb962eae 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -63,6 +63,7 @@ write_source_files( "//wpimath:write_wpimath", "//wpiunits:write_wpiunits", "//wpiutil:write_wpiutil", + "//robotpyExamples:write_example_project_list", ], tags = ["pregeneration"], ) diff --git a/MODULE.bazel b/MODULE.bazel index ad51caf454..de28107f88 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -23,6 +23,7 @@ bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "platforms", version = "1.0.0") bazel_dep(name = "rules_java", version = "8.14.0") bazel_dep(name = "rules_python", version = "1.7.0") +bazel_dep(name = "rules_pycross", version = "0.8.1") python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain( diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 6d9130872c..6f11bb78b8 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -20,6 +20,7 @@ "https://bcr.bazel.build/modules/apple_support/2.0.0/source.json": "e9f1636f3a20e9da9f72612a38311c1fb2207294345a4157001aff93571f3da7", "https://bcr.bazel.build/modules/aspect_bazel_lib/2.14.0/MODULE.bazel": "2b31ffcc9bdc8295b2167e07a757dbbc9ac8906e7028e5170a3708cecaac119f", "https://bcr.bazel.build/modules/aspect_bazel_lib/2.14.0/source.json": "0cf1826853b0bef8b5cd19c0610d717500f5521aa2b38b72b2ec302ac5e7526c", + "https://bcr.bazel.build/modules/aspect_bazel_lib/2.9.4/MODULE.bazel": "ccc41028429f894b02fde7ef67d416cba3ba5084ed9ddb9bb6107aa82d118776", "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d", @@ -112,7 +113,8 @@ "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", "https://bcr.bazel.build/modules/rules_cc/0.1.5/MODULE.bazel": "88dfc9361e8b5ae1008ac38f7cdfd45ad738e4fa676a3ad67d19204f045a1fd8", "https://bcr.bazel.build/modules/rules_cc/0.2.13/MODULE.bazel": "eecdd666eda6be16a8d9dc15e44b5c75133405e820f620a234acc4b1fdc5aa37", - "https://bcr.bazel.build/modules/rules_cc/0.2.13/source.json": "f872e892c5265c5532e526857532f4868708f88d64e5ebe517ea72e09da61bdb", + "https://bcr.bazel.build/modules/rules_cc/0.2.14/MODULE.bazel": "353c99ed148887ee89c54a17d4100ae7e7e436593d104b668476019023b58df8", + "https://bcr.bazel.build/modules/rules_cc/0.2.14/source.json": "55d0a4587c5592fad350f6e698530f4faf0e7dd15e69d43f8d87e220c78bea54", "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", @@ -158,6 +160,8 @@ "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", "https://bcr.bazel.build/modules/rules_proto/7.1.0/MODULE.bazel": "002d62d9108f75bb807cd56245d45648f38275cb3a99dcd45dfb864c5d74cb96", "https://bcr.bazel.build/modules/rules_proto/7.1.0/source.json": "39f89066c12c24097854e8f57ab8558929f9c8d474d34b2c00ac04630ad8940e", + "https://bcr.bazel.build/modules/rules_pycross/0.8.1/MODULE.bazel": "e8fea73f129f5cf81d39de0a4a8675c98e2392d32d7835c9fe55cb04445b39d5", + "https://bcr.bazel.build/modules/rules_pycross/0.8.1/source.json": "766863bf7355ef02c76ca63b171f3e2ca8b277b5211cf22740ebf5363598b388", "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", "https://bcr.bazel.build/modules/rules_python/0.17.3/MODULE.bazel": "f0eb1c105334c80641ea03261e19329fdcf5232e2b134a94f016348190f05499", "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", diff --git a/apriltag/robotpy_native_build_info.bzl b/apriltag/robotpy_native_build_info.bzl index 6e11869911..5fc24670f6 100644 --- a/apriltag/robotpy_native_build_info.bzl +++ b/apriltag/robotpy_native_build_info.bzl @@ -36,4 +36,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/apriltag", install_path = "native/apriltag/", + strip_path_prefixes = ["apriltag"], + requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpimath==0.0.0"], + summary = "WPILib AprilTag Library", + entry_points = { + "pkg_config": [ + "apriltag = native.apriltag", + ], + }, ) diff --git a/apriltag/robotpy_pybind_build_info.bzl b/apriltag/robotpy_pybind_build_info.bzl index d5a16ab4f7..5f186a6a64 100644 --- a/apriltag/robotpy_pybind_build_info.bzl +++ b/apriltag/robotpy_pybind_build_info.bzl @@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def apriltag_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def apriltag_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): APRILTAG_HEADER_GEN = [ struct( class_name = "AprilTag", @@ -214,6 +214,14 @@ def define_pybind_library(name, pkgcfgs = []): "//wpimath:robotpy-wpimath", "//wpiutil:robotpy-wpiutil", ], + strip_path_prefixes = ["apriltag/src/main/python", "apriltag"], + summary = "RobotPy bindings for WPILib's AprilTag library", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-apriltag==0.0.0", "robotpy-wpiutil==0.0.0", "robotpy-wpimath==0.0.0"], + entry_points = { + "pkg_config": ["apriltag = robotpy_apriltag"], + }, visibility = ["//visibility:public"], ) diff --git a/commandsv2/BUILD.bazel b/commandsv2/BUILD.bazel index 897ddad03a..1cf570a555 100644 --- a/commandsv2/BUILD.bazel +++ b/commandsv2/BUILD.bazel @@ -2,7 +2,9 @@ load("@allwpilib_pip_deps//:requirements.bzl", "requirement") load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test") load("@rules_java//java:defs.bzl", "java_binary") +load("@rules_pycross//pycross:defs.bzl", "pycross_wheel_library") load("@rules_python//python:defs.bzl", "py_binary", "py_library") +load("@rules_python//python:packaging.bzl", "py_wheel") load("//commandsv2:generate.bzl", "generate_wpilib_new_commands") load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library") load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test", "wpilib_java_library") @@ -186,10 +188,29 @@ package_default_cc_project( ) py_library( - name = "commandsv2-py", + name = "commandsv2-py-lib", srcs = glob(["src/main/python/**/*.py"]), imports = ["src/main/python"], + deps = [ + "//wpilibc:robotpy-wpilib", + requirement("typing-extensions"), + ], +) + +py_wheel( + name = "commandsv2-wheel", + distribution = "commandsv2", + strip_path_prefixes = ["commandsv2/src/main/python"], + tags = ["robotpy"], + version = "$(ROBOTPY_VERSION)", + deps = [":commandsv2-py-lib"], +) + +pycross_wheel_library( + name = "commandsv2-py", + tags = ["manual"], visibility = ["//visibility:public"], + wheel = ":commandsv2-wheel", deps = [ "//wpilibc:robotpy-wpilib", requirement("typing-extensions"), diff --git a/datalog/robotpy_native_build_info.bzl b/datalog/robotpy_native_build_info.bzl index 67f7f33f2b..217ee2d26d 100644 --- a/datalog/robotpy_native_build_info.bzl +++ b/datalog/robotpy_native_build_info.bzl @@ -31,4 +31,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/datalog", install_path = "native/datalog/", + strip_path_prefixes = ["datalog"], + requires = ["robotpy-native-wpiutil==0.0.0"], + summary = "WPILib Utility Library", + entry_points = { + "pkg_config": [ + "datalog = native.datalog", + ], + }, ) diff --git a/datalog/robotpy_pybind_build_info.bzl b/datalog/robotpy_pybind_build_info.bzl index 8ad4c950a0..29ac502cb2 100644 --- a/datalog/robotpy_pybind_build_info.bzl +++ b/datalog/robotpy_pybind_build_info.bzl @@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def wpilog_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpilog_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPILOG_HEADER_GEN = [ struct( class_name = "DataLog", @@ -208,6 +208,14 @@ def define_pybind_library(name, pkgcfgs = []): "//datalog:robotpy-native-datalog", "//wpiutil:robotpy-wpiutil", ], + strip_path_prefixes = ["datalog/src/main/python", "datalog"], + summary = "Binary wrapper for FRC wpilog library", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-datalog==0.0.0", "robotpy-wpiutil==0.0.0"], + entry_points = { + "pkg_config": ["wpilog = wpilog"], + }, visibility = ["//visibility:public"], ) diff --git a/hal/robotpy_native_build_info.bzl b/hal/robotpy_native_build_info.bzl index 9a58e6d195..e921831445 100644 --- a/hal/robotpy_native_build_info.bzl +++ b/hal/robotpy_native_build_info.bzl @@ -33,4 +33,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/wpiHal", install_path = "native/wpihal/", + strip_path_prefixes = ["hal"], + requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-ntcore==0.0.0"], + summary = "WPILib HAL implementation", + entry_points = { + "pkg_config": [ + "wpihal = native.wpihal", + ], + }, ) diff --git a/hal/robotpy_pybind_build_info.bzl b/hal/robotpy_pybind_build_info.bzl index 9380ae3100..9b1f9c7cf5 100644 --- a/hal/robotpy_pybind_build_info.bzl +++ b/hal/robotpy_pybind_build_info.bzl @@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def hal_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def hal_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): HAL_SIMULATION_HEADER_GEN = [ struct( class_name = "DriverStationData", @@ -141,7 +141,7 @@ def hal_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [] tags = ["manual", "robotpy"], ) -def wpihal_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpihal_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPIHAL_HEADER_GEN = [ struct( class_name = "CANAPITypes", @@ -421,6 +421,14 @@ def define_pybind_library(name, pkgcfgs = []): "//ntcore:pyntcore", "//wpiutil:robotpy-wpiutil", ], + strip_path_prefixes = ["hal/src/main/python", "hal"], + summary = "Binary wrapper for FRC HAL", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["pyntcore==0.0.0", "robotpy-native-wpihal==0.0.0", "robotpy-wpiutil==0.0.0"], + entry_points = { + "pkg_config": ["hal_simulation = hal.simulation", "wpihal = hal"], + }, visibility = ["//visibility:public"], ) diff --git a/ntcore/robotpy_native_build_info.bzl b/ntcore/robotpy_native_build_info.bzl index b9e58ffa56..21cb992010 100644 --- a/ntcore/robotpy_native_build_info.bzl +++ b/ntcore/robotpy_native_build_info.bzl @@ -35,4 +35,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/ntcore", install_path = "native/ntcore/", + strip_path_prefixes = ["ntcore"], + requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpinet==0.0.0", "robotpy-native-datalog==0.0.0"], + summary = "WPILib NetworkTables Library", + entry_points = { + "pkg_config": [ + "ntcore = native.ntcore", + ], + }, ) diff --git a/ntcore/robotpy_pybind_build_info.bzl b/ntcore/robotpy_pybind_build_info.bzl index 0d3178a5ca..2aaa686891 100644 --- a/ntcore/robotpy_pybind_build_info.bzl +++ b/ntcore/robotpy_pybind_build_info.bzl @@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def ntcore_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def ntcore_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): NTCORE_HEADER_GEN = [ struct( class_name = "BooleanArrayTopic", @@ -485,6 +485,14 @@ def define_pybind_library(name, pkgcfgs = []): "//wpinet:robotpy-wpinet", "//wpiutil:robotpy-wpiutil", ], + strip_path_prefixes = ["ntcore/src/main/python", "ntcore"], + summary = "Binary wrappers for the FRC ntcore library", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-ntcore==0.0.0", "robotpy-wpiutil==0.0.0", "robotpy-wpinet==0.0.0", "robotpy-wpilog==0.0.0"], + entry_points = { + "pkg_config": ["ntcore = ntcore"], + }, visibility = ["//visibility:public"], ) diff --git a/robotpyExamples/BUILD.bazel b/robotpyExamples/BUILD.bazel new file mode 100644 index 0000000000..8b2a494cc7 --- /dev/null +++ b/robotpyExamples/BUILD.bazel @@ -0,0 +1,46 @@ +load("@allwpilib_pip_deps//:requirements.bzl", "requirement") +load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file") +load("@rules_python//python:defs.bzl", "py_binary") +load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary") +load(":define_examples.bzl", "define_examples") + +py_binary( + name = "generate_bazel_files", + srcs = ["generate_bazel_files.py"], + target_compatible_with = select({ + "@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"], + "@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + deps = [ + requirement("tomli"), + ], +) + +cmd = "$(locations :generate_bazel_files) $(OUTS)" + +genrule( + name = "generate_bazel_files_rule", + srcs = [ + "examples.toml", + ], + outs = ["gen/example_projects.bzl"], + cmd = cmd, + tools = [":generate_bazel_files"], +) + +write_source_file( + name = "write_example_project_list", + in_file = ":generate_bazel_files_rule", + out_file = "example_projects.bzl", + suggested_update_target = "//:write_all", + tags = ["pregeneration"], + visibility = ["//visibility:public"], +) + +py_console_script_binary( + name = "robotpy", + pkg = "@allwpilib_pip_deps//robotpy_cli", +) + +define_examples() diff --git a/robotpyExamples/define_examples.bzl b/robotpyExamples/define_examples.bzl new file mode 100644 index 0000000000..586807d466 --- /dev/null +++ b/robotpyExamples/define_examples.bzl @@ -0,0 +1,44 @@ +load("@allwpilib_pip_deps//:requirements.bzl", "requirement") +load("@rules_python//python:defs.bzl", "py_binary", "py_test") +load("//robotpyExamples:example_projects.bzl", "PROJECTS") + +def define_examples(): + for example_folder in PROJECTS: + base_name = example_folder.replace("/", "_") + common_kwargs = dict( + srcs = [":robotpy_entry_point.py"], + main = "robotpy_entry_point.py", + data = native.glob([example_folder + "/**"]), + imports = [example_folder], + ) + common_deps = [ + ":robotpy", + "//apriltag:robotpy-apriltag", + "//commandsv2:commandsv2-py", + "//wpilibc:robotpy-wpilib", + "//romiVendordep:robotpy-romi", + "//xrpVendordep:robotpy-xrp", + requirement("numpy"), + ] + + py_test( + name = base_name + "-test", + args = ["--main", "$(location " + example_folder + "/robot.py)", "test", "--builtin"], + deps = common_deps, + size = "small", + **common_kwargs + ) + + py_binary( + name = base_name + "-run", + args = ["--main", "$(location " + example_folder + "/robot.py)", "run"], + deps = common_deps, + **common_kwargs + ) + + py_binary( + name = base_name + "-sim", + args = ["--main", "$(location " + example_folder + "/robot.py)", "sim"], + deps = common_deps + ["//simulation/halsim_gui:robotpy-halsim-gui"], + **common_kwargs + ) diff --git a/robotpyExamples/example_projects.bzl b/robotpyExamples/example_projects.bzl new file mode 100644 index 0000000000..f744214f56 --- /dev/null +++ b/robotpyExamples/example_projects.bzl @@ -0,0 +1,54 @@ +PROJECTS = [ + "AddressableLED", + "AprilTagsVision", + "ArcadeDrive", + "ArcadeDriveXboxController", + "ArmSimulation", + "CANPDP", + "DifferentialDriveBot", + "DifferentialDrivePoseEstimator", + "DigitalCommunication", + "DriveDistanceOffboard", + "DutyCycleEncoder", + "DutyCycleInput", + "ElevatorExponentialProfile", + "ElevatorExponentialSimulation", + "ElevatorProfiledPID", + "ElevatorSimulation", + "ElevatorTrapezoidProfile", + "Encoder", + "EventLoop", + "FlywheelBangBangController", + "GettingStarted", + "Gyro", + "GyroMecanum", + "HatchbotInlined", + "HatchbotTraditional", + "HidRumble", + "HttpCamera", + "I2CCommunication", + "IntermediateVision", + "MecanumBot", + "MecanumDrive", + "MecanumDrivePoseEstimator", + "Mechanism2d", + "MotorControl", + "PotentiometerPID", + "QuickVision", + "RapidReactCommandBot", + "RomiReference", + "SelectCommand", + "SimpleDifferentialDriveSimulation", + "Solenoid", + "StateSpaceArm", + "StateSpaceElevator", + "StateSpaceFlywheel", + "StateSpaceFlywheelSysId", + "SwerveBot", + "SwerveDrivePoseEstimator", + "SysId", + "TankDrive", + "TankDriveXboxController", + "UnitTest", + "XrpReference", +] diff --git a/robotpyExamples/generate_bazel_files.py b/robotpyExamples/generate_bazel_files.py new file mode 100644 index 0000000000..c887bdb011 --- /dev/null +++ b/robotpyExamples/generate_bazel_files.py @@ -0,0 +1,25 @@ + +import sys +import tomli + +def main(): + toml_filename = "robotpyExamples/examples.toml" + output_file = "robotpyExamples/example_projects.bzl" + + with open(toml_filename, "rb") as f: + data = tomli.load(f) + + contents = "PROJECTS = [\n" + for test_folder in data["tests"]["base"]: + contents += f' "{test_folder}",\n' + contents += "]\n" + + if len(sys.argv) == 2: + output_file = sys.argv[1] + + with open(output_file, "w") as f: + f.write(contents) + + +if __name__ == "__main__": + main() diff --git a/romiVendordep/robotpy_native_build_info.bzl b/romiVendordep/robotpy_native_build_info.bzl index 65380d0345..7b790587ff 100644 --- a/romiVendordep/robotpy_native_build_info.bzl +++ b/romiVendordep/robotpy_native_build_info.bzl @@ -31,4 +31,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/romiVendordep", install_path = "native/romi/", + strip_path_prefixes = ["romiVendordep"], + requires = ["robotpy-native-wpilib==0.0.0"], + summary = "WPILib Romi support library", + entry_points = { + "pkg_config": [ + "romi = native.romi", + ], + }, ) diff --git a/romiVendordep/robotpy_pybind_build_info.bzl b/romiVendordep/robotpy_pybind_build_info.bzl index ee229bf665..5ccb710743 100644 --- a/romiVendordep/robotpy_pybind_build_info.bzl +++ b/romiVendordep/robotpy_pybind_build_info.bzl @@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def romi_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def romi_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): ROMI_HEADER_GEN = [ struct( class_name = "OnBoardIO", @@ -176,6 +176,15 @@ def define_pybind_library(name, pkgcfgs = []): "//simulation/halsim_ws_core:robotpy-halsim-ws", "//wpilibc:robotpy-wpilib", ], + strip_path_prefixes = ["romiVendordep/src/main/python", "romiVendordep"], + summary = "Binary wrapper for WPILib Romi Vendor library", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-romi==0.0.0", "wpilib==0.0.0", "robotpy-halsim-ws==0.0.0"], + entry_points = { + "pkg_config": ["romi = romi"], + "robotpy_cli.2027": ["run-romi = romi.cli:RunRomi"], + }, visibility = ["//visibility:public"], ) diff --git a/shared/bazel/rules/robotpy/generate_native_build_file.py b/shared/bazel/rules/robotpy/generate_native_build_file.py index 256c1f4ec1..349ca9ce4f 100644 --- a/shared/bazel/rules/robotpy/generate_native_build_file.py +++ b/shared/bazel/rules/robotpy/generate_native_build_file.py @@ -102,6 +102,14 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/{{shared_library_name}}", install_path = "native/{{nativelib_config.pcfile[0].name}}/", + strip_path_prefixes = ["{{root_package}}"], + requires = {{raw_project_config.dependencies | double_quotes}}, + summary = "{{raw_project_config.description}}", + entry_points = { + "pkg_config": [ + "{{nativelib_config.pcfile[0].name}} = native.{{nativelib_config.pcfile[0].name}}", + ], + }, ) """ diff --git a/shared/bazel/rules/robotpy/generate_pybind_build_file.py b/shared/bazel/rules/robotpy/generate_pybind_build_file.py index 403d664da1..1c1f8aec3d 100644 --- a/shared/bazel/rules/robotpy/generate_pybind_build_file.py +++ b/shared/bazel/rules/robotpy/generate_pybind_build_file.py @@ -417,6 +417,19 @@ def generate_pybind_build_file( except: version_file = None + # The entry points defined above are implicit to how the project is broken down in the toml files. + # This addes potentially extra explicitly declared entry points + if "entry-points" in raw_config["project"]: + explicit_entry_points = raw_config["project"]["entry-points"] + for entry_point_type in explicit_entry_points: + for ep_key, ep_value in explicit_entry_points[entry_point_type].items(): + entry_points[entry_point_type].append(f"{ep_key} = {ep_value}") + + strip_path_prefixes = [ + f"{fixup_root_package_name(top_level_name)}/{stripped_include_prefix}", + f"{fixup_root_package_name(top_level_name)}", + ] + with open(output_file, "w") as f: f.write( template.render( @@ -426,6 +439,7 @@ def generate_pybind_build_file( python_deps=sorted(python_deps), all_local_native_deps=all_local_native_deps, stripped_include_prefix=stripped_include_prefix, + strip_path_prefixes=strip_path_prefixes, yml_prefix=yml_prefix, package_root_file=package_root_file, raw_project_config=raw_config["project"], diff --git a/shared/bazel/rules/robotpy/generation_utils.py b/shared/bazel/rules/robotpy/generation_utils.py index 9373438e08..70c0311458 100644 --- a/shared/bazel/rules/robotpy/generation_utils.py +++ b/shared/bazel/rules/robotpy/generation_utils.py @@ -13,6 +13,10 @@ def fixup_root_package_name(name): return "ntcore" if name == "halsim-ws": return "simulation/halsim_ws_core" + if name == "wpimath_test": + return "wpimath" + if name == "robotpy_apriltag": + return "apriltag" return name diff --git a/shared/bazel/rules/robotpy/pybind_build_file_template.jinja2 b/shared/bazel/rules/robotpy/pybind_build_file_template.jinja2 index c7f11bb65c..623b48d7b0 100644 --- a/shared/bazel/rules/robotpy/pybind_build_file_template.jinja2 +++ b/shared/bazel/rules/robotpy/pybind_build_file_template.jinja2 @@ -12,7 +12,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", {% if publish_casters_targets %}"publish_casters", {% endif %}"resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") {% for extension_module in extension_modules%} -def {{extension_module.name}}_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def {{extension_module.name}}_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): {{extension_module.name|upper}}_HEADER_GEN = [ {%- for header_cfg in extension_module.generation_data.values() %} struct( @@ -217,6 +217,16 @@ def define_pybind_library(name, pkgcfgs = []): {% if "requirement" in d %}{{d}}{% else %}"{{d}}"{% endif %}, {%- endfor %} ], + strip_path_prefixes = [{% for spp in strip_path_prefixes %}"{{ spp }}"{% if not loop.last%}, {% endif %}{% endfor %}], + summary = "{{raw_project_config.description}}", + project_urls = {{raw_project_config.urls | jsonify}}, + author_email = "RobotPy Development Team ", + requires = {{raw_project_config.dependencies | jsonify}}, + entry_points = { + {%- for group, entries in entry_points.items() %} + "{{ group }}": {{entries | jsonify}}, + {%- endfor %} + }, visibility = ["//visibility:public"], ) diff --git a/shared/bazel/rules/robotpy/pybind_rules.bzl b/shared/bazel/rules/robotpy/pybind_rules.bzl index 7b5d91456d..b8030500e5 100644 --- a/shared/bazel/rules/robotpy/pybind_rules.bzl +++ b/shared/bazel/rules/robotpy/pybind_rules.bzl @@ -1,6 +1,8 @@ load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file") load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library") +load("@rules_pycross//pycross:defs.bzl", "pycross_wheel_library") load("@rules_python//python:defs.bzl", "py_library") +load("@rules_python//python:packaging.bzl", "py_wheel") load("//shared/bazel/rules/robotpy:compatibility_select.bzl", "robotpy_compatibility_select") def create_pybind_library( @@ -82,21 +84,54 @@ def create_pybind_library( def robotpy_library( name, + deps = [], data = [], + strip_path_prefixes = None, + summary = None, + project_urls = None, + author_email = None, + entry_points = None, + requires = None, **kwargs): """ Defines a python library that is wrapping a series of pybind extensions. Outputs: - The python library + -wheel - A wheel for the library """ py_library( - name = name, + name = name + "-lib", data = data, + deps = deps, tags = ["robotpy"], **kwargs ) + py_wheel( + name = "{}-wheel".format(name), + distribution = name, + stamp = 1, + version = "$(ROBOTPY_VERSION)", + summary = summary, + requires = requires, + project_urls = project_urls, + author_email = author_email, + deps = data + [":{}-lib".format(name)], + strip_path_prefixes = strip_path_prefixes, + entry_points = entry_points, + license = "BSD-3-Clause", + tags = ["robotpy"], + ) + + pycross_wheel_library( + name = "{}".format(name), + wheel = "{}-wheel".format(name), + deps = deps, + visibility = ["//visibility:public"], + tags = ["manual"], + ) + def copy_native_file(name, library, base_path): """ Copies a compiled shared library into a naming format that can be used by robotpy rules. The libraries are named @@ -153,6 +188,12 @@ def native_wrappery_library( native_shared_library, install_path, headers, + strip_path_prefixes = [], + summary = None, + project_urls = None, + author_email = None, + entry_points = None, + requires = None, deps = []): """ This function provides a sugar wrapper for defining a python library that wraps an allwpilib native library @@ -187,11 +228,34 @@ def native_wrappery_library( ) py_library( - name = name, + name = name + "-lib", srcs = [libinit_file], data = [pc_file, ":{}.copy_lib".format(libname), headers], deps = deps, imports = ["."], - visibility = ["//visibility:public"], tags = ["robotpy"], ) + + py_wheel( + name = "{}-wheel".format(name), + distribution = name, + stamp = 1, + version = "$(ROBOTPY_VERSION)", + summary = summary, + requires = requires, + project_urls = project_urls, + author_email = author_email, + deps = [name + "-lib", ":{}.copy_lib".format(libname), headers, name + ".pc_wrapper"], + strip_path_prefixes = strip_path_prefixes, + entry_points = entry_points, + tags = ["robotpy"], + license = "BSD-3-Clause", + ) + + pycross_wheel_library( + name = "{}".format(name), + wheel = "{}-wheel".format(name), + visibility = ["//visibility:public"], + tags = ["manual"], + deps = deps, + ) diff --git a/simulation/halsim_gui/robotpy_pybind_build_info.bzl b/simulation/halsim_gui/robotpy_pybind_build_info.bzl index f098d655dd..7e9356ea48 100644 --- a/simulation/halsim_gui/robotpy_pybind_build_info.bzl +++ b/simulation/halsim_gui/robotpy_pybind_build_info.bzl @@ -4,7 +4,7 @@ load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file") load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "copy_native_file", "create_pybind_library", "robotpy_library") load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") -def halsim_gui_ext_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def halsim_gui_ext_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): HALSIM_GUI_EXT_HEADER_GEN = [ ] @@ -148,5 +148,13 @@ def define_pybind_library(name, pkgcfgs = []): "//wpimath:robotpy-wpimath", "//wpiutil:robotpy-wpiutil", ], + strip_path_prefixes = ["simulation/halsim_gui/src/main/python", "simulation/halsim_gui"], + summary = "WPILib simulation GUI", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-wpiutil==0.0.0", "robotpy-wpimath==0.0.0", "robotpy-hal==0.0.0", "pyntcore==0.0.0"], + entry_points = { + "pkg_config": ["halsim_gui_ext = halsim_gui._ext"], + }, visibility = ["//visibility:public"], ) diff --git a/wpilibc/BUILD.bazel b/wpilibc/BUILD.bazel index 09ebc0f972..f346d2a3ee 100644 --- a/wpilibc/BUILD.bazel +++ b/wpilibc/BUILD.bazel @@ -270,11 +270,7 @@ define_pybind_library( robotpy_py_test( "python_tests", - srcs = glob( - ["src/test/python/**/*.py"], - # TODO(pjreiniger) This excluded test needs the ENTRY_POINT hooks (i.e. have a dependency on a wheel) - exclude = ["src/test/python/test_pytest_plugins.py"], - ), + srcs = glob(["src/test/python/**/*.py"]), tags = ["exclusive"], deps = [ ":robotpy-wpilib", diff --git a/wpilibc/robotpy_native_build_info.bzl b/wpilibc/robotpy_native_build_info.bzl index f593188d18..dd896556f1 100644 --- a/wpilibc/robotpy_native_build_info.bzl +++ b/wpilibc/robotpy_native_build_info.bzl @@ -39,4 +39,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/wpilibc", install_path = "native/wpilib/", + strip_path_prefixes = ["wpilibc"], + requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpinet==0.0.0", "robotpy-native-ntcore==0.0.0", "robotpy-native-wpimath==0.0.0", "robotpy-native-wpihal==0.0.0"], + summary = "WPILib Robotics Library", + entry_points = { + "pkg_config": [ + "wpilib = native.wpilib", + ], + }, ) diff --git a/wpilibc/robotpy_pybind_build_info.bzl b/wpilibc/robotpy_pybind_build_info.bzl index 5072b1b1cf..3dce931814 100644 --- a/wpilibc/robotpy_pybind_build_info.bzl +++ b/wpilibc/robotpy_pybind_build_info.bzl @@ -6,7 +6,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def wpilib_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpilib_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPILIB_HEADER_GEN = [ struct( class_name = "Filesystem", @@ -1084,7 +1084,7 @@ def wpilib_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includ tags = ["manual", "robotpy"], ) -def wpilib_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpilib_simulation_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPILIB_SIMULATION_HEADER_GEN = [ struct( class_name = "ADXL345Sim", @@ -1642,6 +1642,15 @@ def define_pybind_library(name, pkgcfgs = []): requirement("pytest-reraise"), requirement("robotpy-cli"), ], + strip_path_prefixes = ["wpilibc/src/main/python", "wpilibc"], + summary = "Binary wrapper for FRC WPILib", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-wpilib==0.0.0", "robotpy-wpiutil==0.0.0", "robotpy-wpimath==0.0.0", "robotpy-hal==0.0.0", "pyntcore==0.0.0", "robotpy-cli~=2027.0.0a1", "pytest>=3.9", "pytest-reraise"], + entry_points = { + "pkg_config": ["wpilib = wpilib", "wpilib_simulation = wpilib.simulation"], + "robotpy_cli.2027": ["add-tests = wpilib._impl.cli_add_tests:AddTests", "run = wpilib._impl.cli_run:Main", "sim = wpilib._impl.cli_sim:RobotSim", "test = wpilib._impl.cli_test:RobotTest"], + }, visibility = ["//visibility:public"], ) diff --git a/wpimath/robotpy_native_build_info.bzl b/wpimath/robotpy_native_build_info.bzl index 103ac9ee62..2418b0d3ea 100644 --- a/wpimath/robotpy_native_build_info.bzl +++ b/wpimath/robotpy_native_build_info.bzl @@ -36,4 +36,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/wpimath", install_path = "native/wpimath/", + strip_path_prefixes = ["wpimath"], + requires = ["robotpy-native-wpiutil==0.0.0"], + summary = "WPILib Math Library", + entry_points = { + "pkg_config": [ + "wpimath = native.wpimath", + ], + }, ) diff --git a/wpimath/robotpy_pybind_build_info.bzl b/wpimath/robotpy_pybind_build_info.bzl index 9269865f76..bb2c908b0b 100644 --- a/wpimath/robotpy_pybind_build_info.bzl +++ b/wpimath/robotpy_pybind_build_info.bzl @@ -6,7 +6,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "publish_casters", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def wpimath_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpimath_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPIMATH_HEADER_GEN = [ struct( class_name = "ComputerVisionUtil", @@ -1296,6 +1296,14 @@ def define_pybind_library(name, pkgcfgs = []): "//wpimath:robotpy-native-wpimath", "//wpiutil:robotpy-wpiutil", ], + strip_path_prefixes = ["wpimath/src/main/python", "wpimath"], + summary = "Binary wrapper for FRC WPIMath library", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-wpimath==0.0.0", "robotpy-wpiutil==0.0.0"], + entry_points = { + "pkg_config": ["wpimath-casters = wpimath", "wpimath = wpimath"], + }, visibility = ["//visibility:public"], ) diff --git a/wpimath/robotpy_pybind_test_info.bzl b/wpimath/robotpy_pybind_test_info.bzl index 0b324c84a7..9dff3e9ec9 100644 --- a/wpimath/robotpy_pybind_test_info.bzl +++ b/wpimath/robotpy_pybind_test_info.bzl @@ -4,7 +4,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def wpimath_test_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpimath_test_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPIMATH_TEST_HEADER_GEN = [ struct( class_name = "module", @@ -133,6 +133,14 @@ def define_pybind_library(name, pkgcfgs = []): imports = ["src/test/python/cpp"], deps = [ ], + strip_path_prefixes = ["wpimath/src/test/python/cpp", "wpimath"], + summary = "Test project for verifying robotpy-build behavior", + project_urls = None, + author_email = "RobotPy Development Team ", + requires = None, + entry_points = { + "pkg_config": ["wpimath_test = wpimath_test"], + }, visibility = ["//visibility:public"], ) diff --git a/wpinet/robotpy_native_build_info.bzl b/wpinet/robotpy_native_build_info.bzl index 4b1633b9d2..8d6530a61d 100644 --- a/wpinet/robotpy_native_build_info.bzl +++ b/wpinet/robotpy_native_build_info.bzl @@ -36,4 +36,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/wpinet", install_path = "native/wpinet/", + strip_path_prefixes = ["wpinet"], + requires = ["robotpy-native-wpiutil==0.0.0"], + summary = "WPILib Networking Library", + entry_points = { + "pkg_config": [ + "wpinet = native.wpinet", + ], + }, ) diff --git a/wpinet/robotpy_pybind_build_info.bzl b/wpinet/robotpy_pybind_build_info.bzl index bf353b4a77..dcbedf1493 100644 --- a/wpinet/robotpy_pybind_build_info.bzl +++ b/wpinet/robotpy_pybind_build_info.bzl @@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def wpinet_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpinet_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPINET_HEADER_GEN = [ struct( class_name = "PortForwarder", @@ -156,6 +156,14 @@ def define_pybind_library(name, pkgcfgs = []): "//wpinet:robotpy-native-wpinet", "//wpiutil:robotpy-wpiutil", ], + strip_path_prefixes = ["wpinet/src/main/python", "wpinet"], + summary = "Binary wrapper for FRC wpinet library", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-wpinet==0.0.0", "robotpy-wpiutil==0.0.0"], + entry_points = { + "pkg_config": ["wpinet = wpinet"], + }, visibility = ["//visibility:public"], ) diff --git a/wpiutil/robotpy_native_build_info.bzl b/wpiutil/robotpy_native_build_info.bzl index 7b4c1ef768..f0cf994b6d 100644 --- a/wpiutil/robotpy_native_build_info.bzl +++ b/wpiutil/robotpy_native_build_info.bzl @@ -50,4 +50,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/wpiutil", install_path = "native/wpiutil/", + strip_path_prefixes = ["wpiutil"], + requires = ["msvc-runtime>=14.42.34433; platform_system == 'Windows'"], + summary = "WPILib Utility Library", + entry_points = { + "pkg_config": [ + "wpiutil = native.wpiutil", + ], + }, ) diff --git a/wpiutil/robotpy_pybind_build_info.bzl b/wpiutil/robotpy_pybind_build_info.bzl index 4af0c6a823..b220828821 100644 --- a/wpiutil/robotpy_pybind_build_info.bzl +++ b/wpiutil/robotpy_pybind_build_info.bzl @@ -6,7 +6,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "publish_casters", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def wpiutil_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def wpiutil_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): WPIUTIL_HEADER_GEN = [ struct( class_name = "Color", @@ -252,6 +252,14 @@ def define_pybind_library(name, pkgcfgs = []): deps = [ "//wpiutil:robotpy-native-wpiutil", ], + strip_path_prefixes = ["wpiutil/src/main/python", "wpiutil"], + summary = "Binary wrapper for FRC WPIUtil library", + project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"}, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-wpiutil==0.0.0"], + entry_points = { + "pkg_config": ["wpiutil-casters = wpiutil", "wpiutil = wpiutil"], + }, visibility = ["//visibility:public"], ) diff --git a/xrpVendordep/robotpy_native_build_info.bzl b/xrpVendordep/robotpy_native_build_info.bzl index b20c6550a5..40516a6da9 100644 --- a/xrpVendordep/robotpy_native_build_info.bzl +++ b/xrpVendordep/robotpy_native_build_info.bzl @@ -31,4 +31,12 @@ def define_native_wrapper(name, pyproject_toml = None): headers = "{}.copy_headers".format(name), native_shared_library = "shared/xrpVendordep", install_path = "native/xrp/", + strip_path_prefixes = ["xrpVendordep"], + requires = ["robotpy-native-wpilib==0.0.0"], + summary = "WPILib XRP vendor library", + entry_points = { + "pkg_config": [ + "xrp = native.xrp", + ], + }, ) diff --git a/xrpVendordep/robotpy_pybind_build_info.bzl b/xrpVendordep/robotpy_pybind_build_info.bzl index bd4877d259..5d4d3765a2 100644 --- a/xrpVendordep/robotpy_pybind_build_info.bzl +++ b/xrpVendordep/robotpy_pybind_build_info.bzl @@ -5,7 +5,7 @@ load("//shared/bazel/rules/robotpy:pybind_rules.bzl", "create_pybind_library", " load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen") load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files") -def xrp_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = [], extra_pyi_deps = []): +def xrp_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []): XRP_HEADER_GEN = [ struct( class_name = "XRPGyro", @@ -205,6 +205,16 @@ def define_pybind_library(name, pkgcfgs = []): "//wpilibc:robotpy-wpilib", "//xrpVendordep:robotpy-native-xrp", ], + strip_path_prefixes = ["xrpVendordep/src/main/python", "xrpVendordep"], + summary = "Binary wrapper for WPILib XRP Vendor library", + project_urls = None, + author_email = "RobotPy Development Team ", + requires = ["robotpy-native-xrp==0.0.0", "wpilib==0.0.0"], + entry_points = { + "pkg_config": ["xrp = xrp"], + "robotpy_cli.2027": ["run-xrp = xrp.cli:RunXrp"], + "robotpy_sim.2027": ["xrp = xrp.extension"], + }, visibility = ["//visibility:public"], )