mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
This uses all the infrastructure we put together earlier to actually build and publish all the artifacts. We might still want to adjust what is built by default to control CI times. Signed-off-by: Austin Schuh <austin.linux@gmail.com> Co-authored-by: PJ Reiniger <pj.reiniger@gmail.com> Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
358 lines
10 KiB
Python
358 lines
10 KiB
Python
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
|
|
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
|
load("@rules_java//java:defs.bzl", "java_binary")
|
|
load("@rules_pkg//:mappings.bzl", "pkg_files")
|
|
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:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_java_library")
|
|
load("//shared/bazel/rules:packaging.bzl", "package_default_jni_project")
|
|
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:pytest_util.bzl", "robotpy_py_test")
|
|
load("//wpinet:robotpy_native_build_info.bzl", "define_native_wrapper")
|
|
load("//wpinet:robotpy_pybind_build_info.bzl", "define_pybind_library", "wpinet_extension")
|
|
|
|
filegroup(
|
|
name = "doxygen-files",
|
|
srcs = glob([
|
|
"src/main/native/include/**/*",
|
|
"src/main/native/thirdparty/libuv/include/**/*",
|
|
"src/main/native/thirdparty/tcpsockets/include/**/*",
|
|
]),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
WIN_UV_SRCS = glob([
|
|
"src/main/native/thirdparty/libuv/src/win/*.cpp",
|
|
"src/main/native/thirdparty/libuv/src/win/*.h",
|
|
])
|
|
|
|
UNIX_UV_SRCS = [
|
|
"src/main/native/thirdparty/libuv/src/unix/async.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/core.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/dl.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/fs.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/getaddrinfo.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/getnameinfo.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/loop-watcher.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/loop.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/pipe.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/poll.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/process.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/random-devurandom.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/random-getentropy.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/random-getrandom.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/signal.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/stream.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/tcp.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/thread.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/tty.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/udp.cpp",
|
|
] + glob(["src/main/native/thirdparty/libuv/src/unix/*.h"])
|
|
|
|
MAC_UV_SRCS = [
|
|
"src/main/native/thirdparty/libuv/src/unix/bsd-ifaddrs.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/darwin.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/darwin-proctitle.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/fsevents.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/kqueue.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/proctitle.cpp",
|
|
]
|
|
|
|
LINUX_UV_SRCS = [
|
|
"src/main/native/thirdparty/libuv/src/unix/linux.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/procfs-exepath.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/proctitle.cpp",
|
|
"src/main/native/thirdparty/libuv/src/unix/random-sysctl-linux.cpp",
|
|
]
|
|
|
|
cc_library(
|
|
name = "libuv-headers",
|
|
hdrs = glob([
|
|
"src/main/native/thirdparty/libuv/include/**/*.h",
|
|
]),
|
|
includes = ["src/main/native/thirdparty/libuv/src"],
|
|
strip_include_prefix = "src/main/native/thirdparty/libuv/include",
|
|
)
|
|
|
|
filegroup(
|
|
name = "libuv-srcs",
|
|
srcs = select({
|
|
"@rules_bzlmodrio_toolchains//constraints/combined:is_unix": UNIX_UV_SRCS,
|
|
"//conditions:default": [],
|
|
}) +
|
|
select({
|
|
"@platforms//os:osx": MAC_UV_SRCS,
|
|
"@platforms//os:windows": WIN_UV_SRCS,
|
|
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": LINUX_UV_SRCS,
|
|
}) + glob(["src/main/native/thirdparty/libuv/src/*"]),
|
|
visibility = ["//wpinet:__subpackages__"],
|
|
)
|
|
|
|
pkg_files(
|
|
name = "thirdparty-libuv-hdr-pkg",
|
|
srcs = glob(["src/main/native/thirdparty/libuv/include/**"]),
|
|
strip_prefix = "src/main/native/thirdparty/libuv/include",
|
|
)
|
|
|
|
pkg_files(
|
|
name = "thirdparty-libuv-src-pkg",
|
|
srcs = glob(["src/main/native/thirdparty/libuv/src/**"]),
|
|
strip_prefix = "src/main/native/thirdparty/libuv/src",
|
|
)
|
|
|
|
third_party_cc_lib_helper(
|
|
name = "tcpsockets",
|
|
include_root = "src/main/native/thirdparty/tcpsockets/include",
|
|
src_root = "src/main/native/thirdparty/tcpsockets/cpp",
|
|
)
|
|
|
|
filegroup(
|
|
name = "native-srcs",
|
|
srcs = select({
|
|
"@platforms//os:osx": glob(["src/main/native/macOS/*"]),
|
|
"@platforms//os:windows": glob(["src/main/native/windows/*"]),
|
|
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": glob(["src/main/native/linux/*"]),
|
|
}),
|
|
)
|
|
|
|
cc_library(
|
|
name = "private_includes",
|
|
hdrs = glob([
|
|
"src/main/native/cpp/*.hpp",
|
|
]),
|
|
strip_include_prefix = "src/main/native/cpp",
|
|
)
|
|
|
|
wpilib_cc_library(
|
|
name = "wpinet",
|
|
srcs = glob(
|
|
["src/main/native/cpp/**"],
|
|
exclude = ["src/main/native/cpp/jni/**"],
|
|
) + [
|
|
":libuv-srcs",
|
|
] + ["native-srcs"],
|
|
hdrs = glob(["src/main/native/include/**/*"]),
|
|
extra_hdr_pkg_files = [":thirdparty-libuv-hdr-pkg"],
|
|
extra_src_pkg_files = [
|
|
":wpinet-java-jni-hdrs-pkg",
|
|
],
|
|
includes = ["src/main/native/include"],
|
|
linkopts = select({
|
|
"@platforms//os:linux": [
|
|
"-Wl,--push-state,-as-needed",
|
|
"-ldl",
|
|
"-Wl,--pop-state",
|
|
],
|
|
"//conditions:default": [],
|
|
}),
|
|
strip_include_prefix = "src/main/native/include",
|
|
third_party_libraries = [
|
|
":tcpsockets",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":libuv-headers",
|
|
":private_includes",
|
|
"//wpiutil",
|
|
],
|
|
)
|
|
|
|
wpilib_cc_shared_library(
|
|
name = "shared/wpinet",
|
|
dynamic_deps = [
|
|
"//wpiutil:shared/wpiutil",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
wpilib_cc_static_library(
|
|
name = "static/wpinet",
|
|
static_deps = [
|
|
"//wpiutil:static/wpiutil",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
wpilib_jni_cc_library(
|
|
name = "wpinetjni",
|
|
srcs = glob([
|
|
"src/main/native/cpp/jni/**",
|
|
"src/main/native/cpp/**/*.hpp",
|
|
]),
|
|
java_dep = ":wpinet-java",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
wpilib_cc_shared_library(
|
|
name = "shared/wpinetjni",
|
|
auto_export_windows_symbols = False,
|
|
dynamic_deps = [
|
|
"//wpiutil:shared/wpiutil",
|
|
":shared/wpinet",
|
|
],
|
|
use_debug_name = False,
|
|
visibility = ["//visibility:public"],
|
|
deps = [":wpinetjni"],
|
|
)
|
|
|
|
wpilib_jni_java_library(
|
|
name = "wpinet-java",
|
|
srcs = glob(["src/main/java/**/*.java"]),
|
|
maven_artifact_name = "wpinet-java",
|
|
maven_group_id = "org.wpilib.wpinet",
|
|
native_libs = [":wpinetjni"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//wpiutil:wpiutil-java",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "wpinet-cpp-test",
|
|
size = "small",
|
|
srcs = glob([
|
|
"src/test/native/**/*.cpp",
|
|
"src/test/native/**/*.hpp",
|
|
]),
|
|
tags = ["no-asan"],
|
|
deps = [
|
|
":wpinet",
|
|
"//thirdparty/googletest",
|
|
"//wpiutil:wpiutil-testlib",
|
|
],
|
|
)
|
|
|
|
wpilib_java_junit5_test(
|
|
name = "wpinet-java-test",
|
|
srcs = glob(["src/test/java/**/*.java"]),
|
|
deps = [
|
|
":wpinet-java",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "DevMain-Cpp",
|
|
srcs = ["src/dev/native/cpp/main.cpp"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
java_binary(
|
|
name = "DevMain-java",
|
|
srcs = ["src/dev/java/org/wpilib/net/DevMain.java"],
|
|
main_class = "org.wpilib.net.DevMain",
|
|
deps = [
|
|
":wpinet-java",
|
|
"//wpiutil:wpiutil-java",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "netconsoleServer",
|
|
srcs = ["src/netconsoleServer/native/cpp/main.cpp"],
|
|
linkopts = select({
|
|
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": ["-lutil"],
|
|
"//conditions:default": [],
|
|
}),
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "netconsoleTee",
|
|
srcs = ["src/netconsoleTee/native/cpp/main.cpp"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "dsclient",
|
|
srcs = ["examples/dsclient/dsclient.cpp"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "parallelconnect",
|
|
srcs = ["examples/parallelconnect/parallelconnect.cpp"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "webserver",
|
|
srcs = ["examples/webserver/webserver.cpp"],
|
|
deps = [
|
|
":wpinet",
|
|
],
|
|
)
|
|
|
|
generate_robotpy_native_wrapper_build_info(
|
|
name = "robotpy-native-wpinet-generator",
|
|
pyproject_toml = "src/main/python/native-pyproject.toml",
|
|
third_party_dirs = [
|
|
"libuv",
|
|
"tcpsockets",
|
|
],
|
|
)
|
|
|
|
define_native_wrapper(
|
|
name = "robotpy-native-wpinet",
|
|
pyproject_toml = "src/main/python/native-pyproject.toml",
|
|
)
|
|
|
|
PYBIND_PKGCFG_DEPS = [
|
|
"//wpinet:native/wpinet/robotpy-native-wpinet.pc",
|
|
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
|
|
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
|
|
]
|
|
|
|
generate_robotpy_pybind_build_info(
|
|
name = "robotpy-wpinet-generator",
|
|
additional_srcs = [":robotpy-native-wpinet.copy_headers"],
|
|
package_root_file = "src/main/python/wpinet/__init__.py",
|
|
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
|
yaml_files = glob(["src/main/python/semiwrap/*.yml"]),
|
|
)
|
|
|
|
wpinet_extension(
|
|
srcs = ["src/main/python/wpinet/src/main.cpp"],
|
|
includes = [
|
|
"src/main/python/wpinet/",
|
|
],
|
|
)
|
|
|
|
define_pybind_library(
|
|
name = "robotpy-wpinet",
|
|
pkgcfgs = PYBIND_PKGCFG_DEPS,
|
|
)
|
|
|
|
robotpy_py_test(
|
|
"python_tests",
|
|
srcs = glob(["src/test/python/**/*.py"]),
|
|
deps = [
|
|
":robotpy-wpinet",
|
|
requirement("pytest"),
|
|
],
|
|
)
|
|
|
|
package_default_jni_project(
|
|
name = "wpinet",
|
|
maven_artifact_name = "wpinet-cpp",
|
|
maven_group_id = "org.wpilib.wpinet",
|
|
)
|