mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
172 lines
4.6 KiB
Python
172 lines
4.6 KiB
Python
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", "java_library")
|
|
load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
|
|
load("@rules_python//python:defs.bzl", "py_binary")
|
|
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")
|
|
load("//shared/bazel/rules:packaging.bzl", "pkg_java_files")
|
|
load("//wpilibNewCommands:generate.bzl", "generate_wpilib_new_commands")
|
|
|
|
py_binary(
|
|
name = "generate_hids",
|
|
srcs = ["generate_hids.py"],
|
|
target_compatible_with = select({
|
|
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
|
"//conditions:default": [],
|
|
}),
|
|
deps = [requirement("jinja2")],
|
|
)
|
|
|
|
filegroup(
|
|
name = "templates",
|
|
srcs = glob(["src/generate/main/**"]) + [
|
|
"//wpilibj:hid_schema",
|
|
],
|
|
)
|
|
|
|
generate_wpilib_new_commands(
|
|
name = "generate_wpilib_new_commands",
|
|
)
|
|
|
|
write_source_files(
|
|
name = "write_wpilib_new_commands",
|
|
files = {
|
|
"src/generated": ":generate_wpilib_new_commands",
|
|
},
|
|
suggested_update_target = "//:write_all",
|
|
tags = ["pregeneration"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
third_party_cc_lib_helper(
|
|
name = "generated_cc",
|
|
include_root = "src/generated/main/native/include",
|
|
src_root = "src/generated/main/native/cpp",
|
|
)
|
|
|
|
filegroup(
|
|
name = "generated_java",
|
|
srcs = glob(["src/generated/main/java/**/*.java"]),
|
|
)
|
|
|
|
wpilib_cc_library(
|
|
name = "wpilibNewCommands",
|
|
srcs = glob(["src/main/native/cpp/**"]),
|
|
hdrs = glob(["src/main/native/include/**"]),
|
|
includes = ["src/main/native/include"],
|
|
strip_include_prefix = "src/main/native/include",
|
|
third_party_libraries = [
|
|
":generated_cc",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//ntcore",
|
|
"//wpilibc",
|
|
"//wpinet",
|
|
],
|
|
)
|
|
|
|
wpilib_cc_shared_library(
|
|
name = "shared/wpilibNewCommands",
|
|
dynamic_deps = [
|
|
"//hal:shared/wpiHal",
|
|
"//ntcore:shared/ntcore",
|
|
"//wpilibc:shared/wpilibc",
|
|
"//wpimath:shared/wpimath",
|
|
"//wpinet:shared/wpinet",
|
|
"//wpiutil:shared/wpiutil",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [":wpilibNewCommands"],
|
|
)
|
|
|
|
wpilib_cc_static_library(
|
|
name = "static/wpilibNewCommands",
|
|
static_deps = [
|
|
"//ntcore:static/ntcore",
|
|
"//wpilibc:static/wpilibc",
|
|
"//wpinet:static/wpinet",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [":wpilibNewCommands"],
|
|
)
|
|
|
|
java_library(
|
|
name = "wpilibNewCommands-java",
|
|
srcs = glob(["src/main/java/**/*.java"]) + [":generated_java"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//cscore:cscore-java",
|
|
"//hal:hal-java",
|
|
"//ntcore:ntcore-java",
|
|
"//wpilibj:wpilibj-java",
|
|
"//wpimath:wpimath-java",
|
|
"//wpinet:wpinet-java",
|
|
"//wpiunits:wpiunits-java",
|
|
"//wpiutil:wpiutil-java",
|
|
],
|
|
)
|
|
|
|
pkg_java_files(name = "wpilibNewCommands-java-srcs")
|
|
|
|
pkg_zip(
|
|
name = "libwpilibNewCommands-java-sources",
|
|
srcs = [":wpilibNewCommands-java-srcs"],
|
|
out = "libwpilibNewCommands-java-sources.jar",
|
|
)
|
|
|
|
cc_test(
|
|
name = "wpilibNewCommands-cpp-test",
|
|
size = "small",
|
|
srcs = glob([
|
|
"src/test/native/**/*.cpp",
|
|
"src/test/native/**/*.h",
|
|
]),
|
|
tags = [
|
|
"no-tsan",
|
|
"no-ubsan",
|
|
],
|
|
deps = [
|
|
":wpilibNewCommands",
|
|
"//thirdparty/googletest",
|
|
],
|
|
)
|
|
|
|
wpilib_java_junit5_test(
|
|
name = "wpilibNewCommands-java-test",
|
|
srcs = glob(["**/*.java"]),
|
|
resource_strip_prefix = "wpilibNewCommands/src/test/resources",
|
|
resources = glob(["src/test/resources/**"]),
|
|
deps = [
|
|
":wpilibNewCommands-java",
|
|
"//hal:hal-java",
|
|
"//ntcore:ntcore-java",
|
|
"//wpilibj:wpilibj-java",
|
|
"//wpimath:wpimath-java",
|
|
"//wpiunits:wpiunits-java",
|
|
"//wpiutil:wpiutil-java",
|
|
"@maven//:org_mockito_mockito_core",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "DevMain-Cpp",
|
|
srcs = ["src/dev/native/cpp/main.cpp"],
|
|
deps = [
|
|
],
|
|
)
|
|
|
|
java_binary(
|
|
name = "DevMain-Java",
|
|
srcs = ["src/dev/java/edu/wpi/first/wpilibj2/commands/DevMain.java"],
|
|
main_class = "edu.wpi.first.wpilibj2.commands.DevMain",
|
|
deps = [
|
|
"//hal:hal-java",
|
|
"//ntcore:ntcore-java",
|
|
"//wpimath:wpimath-java",
|
|
"//wpiutil:wpiutil-java",
|
|
],
|
|
)
|