Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed Dec 16, 2023
1 parent 3351a9b commit 544eeb0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rules_robotpy_utils/generate_robotpy_project_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ def generate_robotpy_project_files(
file_mapping = {}
generated_files = []

init_file = init_file or "_init_{}.py".format(name)
init_file_name = name
if init_file_name.startswith("_"):
init_file_name = init_file_name[1:]

init_file = init_file or "_init_{}.py".format(init_file_name)
file_mapping[init_file] = "__filtered_gen_{}_init".format(name)
generated_files.append("on_build_dl/{}{}/".format(parent_folder, name) + init_file)
filter_srcs(
Expand Down
34 changes: 34 additions & 0 deletions rules_robotpy_utils/pybind_subproject_rules.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
load("@//shared/bazel/rules/python/pybind_generator:pybind_rules.bzl", "create_pybind_library")
load("@//shared/bazel/rules/python/pybind_generator:generate_robotpy_project_files.bzl", "generate_robotpy_project_files")


def create_robotpy_pybind_subproject(
name,
config_file,
visibility,
internal_project_dependencies = [],
python_deps = [],
parent_folder = "",
**pybind_library_kwargs,
):

generate_robotpy_project_files(
name = name,
config_file =config_file,
internal_project_dependencies = internal_project_dependencies,
python_deps = python_deps,
parent_folder = parent_folder,
visibility = visibility,
)

create_pybind_library(
name,
extension_visibility = visibility,
**pybind_library_kwargs,
)

native.filegroup(
name = "python_files",
srcs = native.glob(["**/*.py"]),
visibility = visibility,
)

0 comments on commit 544eeb0

Please sign in to comment.