mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[bazel] Clean up bazel scripts (#7984)
This commit is contained in:
2
.bazelrc
2
.bazelrc
@@ -3,6 +3,8 @@ try-import %workspace%/user.bazelrc
|
||||
|
||||
common --noenable_bzlmod
|
||||
|
||||
build --incompatible_disallow_empty_glob=1 # Bazel 8 prep
|
||||
|
||||
build --java_language_version=17
|
||||
build --java_runtime_version=roboriojdk_17
|
||||
build --tool_java_language_version=17
|
||||
|
||||
@@ -16,7 +16,8 @@ compile_pip_requirements(
|
||||
extra_args = ["--allow-unsafe"],
|
||||
requirements_in = "requirements.txt",
|
||||
requirements_txt = "requirements_lock.txt",
|
||||
tags = ["no-roborio"],
|
||||
# compile_pip_requirements does not respect target_compatible_with for some of the targets it generates under the hood
|
||||
tags = ["no-systemcore"],
|
||||
)
|
||||
|
||||
alias(
|
||||
|
||||
20
WORKSPACE
20
WORKSPACE
@@ -123,12 +123,17 @@ maven_artifacts = [
|
||||
maven_install(
|
||||
name = "maven",
|
||||
artifacts = maven_artifacts,
|
||||
maven_install_json = "//:maven_install.json",
|
||||
repositories = [
|
||||
"https://repo1.maven.org/maven2",
|
||||
"https://frcmaven.wpi.edu/artifactory/release/",
|
||||
],
|
||||
)
|
||||
|
||||
load("@maven//:defs.bzl", "pinned_maven_install")
|
||||
|
||||
pinned_maven_install()
|
||||
|
||||
# Setup aspect lib
|
||||
http_archive(
|
||||
name = "aspect_bazel_lib",
|
||||
@@ -208,8 +213,8 @@ setup_legacy_bzlmodrio_ni_cpp_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "bzlmodrio-opencv",
|
||||
sha256 = "ba3f4910ce9cc0e08abff732aeb5835b1bcfd864ca5296edeadcf2935f7e81b9",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-opencv/releases/download/2025.4.10.0-3.bcr1/bzlmodRio-opencv-2025.4.10.0-3.bcr1.tar.gz",
|
||||
sha256 = "6e8544fae07ed5b4fedc146f6ad083d0d8947e3efb5332a20abc46601a52a1b5",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-opencv/releases/download/2025.4.10.0-3.bcr2/bzlmodRio-opencv-2025.4.10.0-3.bcr2.tar.gz",
|
||||
)
|
||||
|
||||
load("@bzlmodrio-opencv//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_opencv_cpp_dependencies")
|
||||
@@ -220,6 +225,17 @@ load("@bzlmodrio-opencv//:maven_java_deps.bzl", "setup_legacy_bzlmodrio_opencv_j
|
||||
|
||||
setup_legacy_bzlmodrio_opencv_java_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "bzlmodrio-libssh",
|
||||
sha256 = "65caef82554617403a16c79e8bcac6553d40eca3e23197e63275bba22db7d5b5",
|
||||
strip_prefix = "bzlmodRio-libssh-8405fbd5eb4e42b495f08f6ccf6fbbe5ced28bb7",
|
||||
urls = ["https://github.com/wpilibsuite/bzlmodRio-libssh/archive/8405fbd5eb4e42b495f08f6ccf6fbbe5ced28bb7.tar.gz"],
|
||||
)
|
||||
|
||||
load("@bzlmodrio-libssh//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_libssh_cpp_dependencies")
|
||||
|
||||
setup_legacy_bzlmodrio_libssh_cpp_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "build_bazel_apple_support",
|
||||
sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_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/gen:gen-resources.bzl", "generate_resources")
|
||||
@@ -33,7 +34,6 @@ cc_library(
|
||||
}),
|
||||
includes = ["src/main/native/thirdparty/apriltag/include/common"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/apriltag/include",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
generate_resources(
|
||||
@@ -41,10 +41,9 @@ generate_resources(
|
||||
namespace = "frc",
|
||||
prefix = "APRILTAG",
|
||||
resource_files = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "apriltag.static",
|
||||
srcs = [":generate-resources"] + glob(
|
||||
["src/main/native/cpp/**"],
|
||||
@@ -135,5 +134,8 @@ java_binary(
|
||||
py_binary(
|
||||
name = "convert_apriltag_layouts",
|
||||
srcs = ["convert_apriltag_layouts.py"],
|
||||
tags = ["manual"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "cameraserver.static",
|
||||
srcs = glob(["src/main/native/cpp/**"]),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_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:objectivec_rules.bzl", "wpilib_objc_library")
|
||||
|
||||
WIN_SRCS = glob([
|
||||
"src/main/native/windows/**/*.cpp",
|
||||
@@ -24,7 +26,7 @@ filegroup(
|
||||
}),
|
||||
)
|
||||
|
||||
objc_library(
|
||||
wpilib_objc_library(
|
||||
name = "cscore-mac",
|
||||
srcs = glob([
|
||||
"src/main/native/objcpp/**/*.mm",
|
||||
@@ -34,9 +36,7 @@ objc_library(
|
||||
"src/main/native/include/**/*",
|
||||
"src/main/native/objcpp/**/*.h",
|
||||
]),
|
||||
copts = [
|
||||
"-std=c++20",
|
||||
],
|
||||
include_arc = False,
|
||||
includes = [
|
||||
"src/main/native/cpp",
|
||||
"src/main/native/include",
|
||||
@@ -50,7 +50,6 @@ objc_library(
|
||||
"CoreVideo",
|
||||
"IOKit",
|
||||
],
|
||||
tags = ["manual"],
|
||||
deps = [
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
@@ -58,7 +57,7 @@ objc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "cscore.static",
|
||||
srcs = [":native-srcs"] + glob(
|
||||
["src/main/native/cpp/**"],
|
||||
@@ -138,3 +137,24 @@ java_binary(
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
)
|
||||
|
||||
[wpilib_cc_library(
|
||||
name = example + "-examples",
|
||||
srcs = glob([
|
||||
"examples/" + example + "/*.cpp",
|
||||
]),
|
||||
tags = [
|
||||
"wpi-example",
|
||||
],
|
||||
deps = [
|
||||
"//cscore:cscore.static",
|
||||
"//wpigui",
|
||||
],
|
||||
) for example in [
|
||||
"enum_usb",
|
||||
"httpcvstream",
|
||||
"settings",
|
||||
"usbcvstream",
|
||||
"usbstream",
|
||||
"usbviewer",
|
||||
]]
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.cscore;
|
||||
|
||||
import edu.wpi.cscore.VideoMode.PixelFormat;
|
||||
import edu.wpi.cscore.raw.RawFrame;
|
||||
import java.nio.ByteBuffer;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
public class RawCVMatSink extends ImageSink {
|
||||
RawFrame frame = new RawFrame();
|
||||
Mat tmpMat;
|
||||
ByteBuffer origByteBuffer;
|
||||
int width;
|
||||
int height;
|
||||
int pixelFormat;
|
||||
int bgrValue = PixelFormat.kBGR.getValue();
|
||||
|
||||
private int getCVFormat(PixelFormat pixelFormat) {
|
||||
return switch (pixelFormat) {
|
||||
case kYUYV, kRGB565, kY16, kUYVY -> CvType.CV_8UC2;
|
||||
case kBGR -> CvType.CV_8UC3;
|
||||
case kBGRA -> CvType.CV_8UC4;
|
||||
case kGray, kMJPEG, kUnknown -> CvType.CV_8UC1;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a sink for accepting OpenCV images. WaitForFrame() must be called on the created sink to
|
||||
* get each new image.
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
*/
|
||||
public RawCVMatSink(String name) {
|
||||
super(CameraServerJNI.createRawSink(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for the next frame and get the image. Times out (returning 0) after 0.225 seconds. The
|
||||
* provided image will have three 3-bit channels stored in BGR order.
|
||||
*
|
||||
* @return Frame time, or 0 on error (call GetError() to obtain the error message)
|
||||
*/
|
||||
public long grabFrame(Mat image) {
|
||||
return grabFrame(image, 0.225);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for the next frame and get the image. Times out (returning 0) after timeout seconds. The
|
||||
* provided image will have three 3-bit channels stored in BGR order.
|
||||
*
|
||||
* @return Frame time, or 0 on error (call GetError() to obtain the error message); the frame time
|
||||
* is in 1 us increments.
|
||||
*/
|
||||
public long grabFrame(Mat image, double timeout) {
|
||||
frame.setWidth(0);
|
||||
frame.setHeight(0);
|
||||
frame.setPixelFormat(bgrValue);
|
||||
long rv = CameraServerJNI.grabSinkFrameTimeout(m_handle, frame, timeout);
|
||||
if (rv <= 0) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (frame.getDataByteBuffer() != origByteBuffer
|
||||
|| width != frame.getWidth()
|
||||
|| height != frame.getHeight()
|
||||
|| pixelFormat != frame.getPixelFormat()) {
|
||||
origByteBuffer = frame.getDataByteBuffer();
|
||||
height = frame.getHeight();
|
||||
width = frame.getWidth();
|
||||
pixelFormat = frame.getPixelFormat();
|
||||
tmpMat =
|
||||
new Mat(
|
||||
frame.getHeight(),
|
||||
frame.getWidth(),
|
||||
getCVFormat(VideoMode.getPixelFormatFromInt(pixelFormat)),
|
||||
origByteBuffer);
|
||||
}
|
||||
tmpMat.copyTo(image);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.cscore;
|
||||
|
||||
import edu.wpi.cscore.VideoMode.PixelFormat;
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
public class RawCVMatSource extends ImageSource {
|
||||
/**
|
||||
* Create an OpenCV source.
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param mode Video mode being generated
|
||||
*/
|
||||
public RawCVMatSource(String name, VideoMode mode) {
|
||||
super(
|
||||
CameraServerJNI.createRawSource(
|
||||
name, mode.pixelFormat.getValue(), mode.width, mode.height, mode.fps));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an OpenCV source.
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param pixelFormat Pixel format
|
||||
* @param width width
|
||||
* @param height height
|
||||
* @param fps fps
|
||||
*/
|
||||
public RawCVMatSource(
|
||||
String name, VideoMode.PixelFormat pixelFormat, int width, int height, int fps) {
|
||||
super(CameraServerJNI.createRawSource(name, pixelFormat.getValue(), width, height, fps));
|
||||
}
|
||||
|
||||
/**
|
||||
* Put an OpenCV image and notify sinks.
|
||||
*
|
||||
* <p>Only 8-bit single-channel or 3-channel (with BGR channel order) images are supported. If the
|
||||
* format, depth or channel order is different, use Mat.convertTo() and/or cvtColor() to convert
|
||||
* it first.
|
||||
*
|
||||
* @param image OpenCV image
|
||||
*/
|
||||
public void putFrame(Mat image) {
|
||||
int channels = image.channels();
|
||||
if (channels != 1 && channels != 3) {
|
||||
throw new VideoException("Unsupported Image Type");
|
||||
}
|
||||
int imgType = channels == 1 ? PixelFormat.kGray.getValue() : PixelFormat.kBGR.getValue();
|
||||
CameraServerJNI.putRawSourceFrame(
|
||||
m_handle,
|
||||
image.dataAddr(),
|
||||
image.width(),
|
||||
image.height(),
|
||||
imgType,
|
||||
(int) image.total() * channels);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_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")
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "datalog.static",
|
||||
srcs = glob(
|
||||
["src/main/native/cpp/**"],
|
||||
@@ -46,7 +47,10 @@ wpilib_jni_java_library(
|
||||
py_binary(
|
||||
name = "datalog",
|
||||
srcs = ["examples/printlog/datalog.py"],
|
||||
tags = ["manual"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
@@ -79,10 +83,7 @@ java_binary(
|
||||
cc_test(
|
||||
name = "datalog-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob([
|
||||
"src/test/native/**/*.cpp",
|
||||
"src/test/native/**/*.h",
|
||||
]),
|
||||
srcs = glob(["src/test/native/**/*.cpp"]),
|
||||
tags = [
|
||||
"exclusive",
|
||||
"no-asan",
|
||||
|
||||
57
datalogtool/BUILD.bazel
Normal file
57
datalogtool/BUILD.bazel
Normal file
@@ -0,0 +1,57 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
|
||||
generate_resources(
|
||||
name = "generate-resources",
|
||||
namespace = "dlt",
|
||||
prefix = "DLT",
|
||||
resource_files = glob(["src/main/native/resources/*"]),
|
||||
)
|
||||
|
||||
generate_version_file(
|
||||
name = "generate-version",
|
||||
output_file = "WPILibVersion.cpp",
|
||||
template = "src/main/generate/WPILibVersion.cpp.in",
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "datalogtool",
|
||||
srcs = glob(["src/main/native/cpp/*"]) + [
|
||||
":generate-resources",
|
||||
":generate-version",
|
||||
],
|
||||
defines = ["LIBSSH_STATIC"],
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:darwin": [
|
||||
"-framework",
|
||||
"Kerberos",
|
||||
],
|
||||
"@bazel_tools//src/conditions:linux_x86_64": [],
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"-DEFAULTLIB:Gdi32.lib",
|
||||
"-DEFAULTLIB:Shell32.lib",
|
||||
"-DEFAULTLIB:d3d11.lib",
|
||||
"-DEFAULTLIB:d3dcompiler.lib",
|
||||
"-DEFAULTLIB:ws2_32.lib",
|
||||
"-DEFAULTLIB:advapi32.lib",
|
||||
"-DEFAULTLIB:crypt32.lib",
|
||||
"-DEFAULTLIB:user32.lib",
|
||||
"-SUBSYSTEM:WINDOWS",
|
||||
],
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_cross_compiler": [],
|
||||
}),
|
||||
tags = [
|
||||
"no-roborio",
|
||||
"wpi-cpp-gui",
|
||||
],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [
|
||||
"//datalog:datalog.static",
|
||||
"//glass:libglass",
|
||||
"@bzlmodrio-libssh//libraries/cpp/libssh",
|
||||
],
|
||||
)
|
||||
@@ -1,5 +1,5 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@rules_java//java:defs.bzl", "java_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
|
||||
@@ -8,10 +8,9 @@ generate_resources(
|
||||
namespace = "fields",
|
||||
prefix = "FIELDS",
|
||||
resource_files = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "fieldImages",
|
||||
srcs = [":generate-resources"] + glob(["src/main/native/cpp/**"]),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "libglass",
|
||||
srcs = glob(["src/lib/native/cpp/**/*.cpp"]),
|
||||
hdrs = glob(["src/lib/native/include/**"]),
|
||||
@@ -19,7 +20,7 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "libglassnt",
|
||||
srcs = glob(["src/libnt/native/cpp/*.cpp"]),
|
||||
hdrs = glob(["src/libnt/native/include/**/*.h"]),
|
||||
|
||||
@@ -3,14 +3,10 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//hal:generate.bzl", "generate_hal")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_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")
|
||||
|
||||
filegroup(
|
||||
name = "templates",
|
||||
srcs = glob(["src/generate/*"]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "proto_files",
|
||||
srcs = glob(["src/mrc/proto/**/*.proto"]),
|
||||
@@ -24,7 +20,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
generate_hal(
|
||||
@@ -42,34 +37,16 @@ write_source_files(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "generated_cc_headers",
|
||||
hdrs = glob(["src/generated/main/native/include/**"]),
|
||||
includes = ["src/generated/main/native/include"],
|
||||
strip_include_prefix = "src/generated/main/native/include",
|
||||
visibility = ["//hal:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "mrc_cc_headers",
|
||||
hdrs = glob(["src/mrc/include/**"]),
|
||||
includes = ["src/mrc/include"],
|
||||
strip_include_prefix = "src/mrc/include",
|
||||
visibility = ["//hal:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "mrc",
|
||||
include_root = "src/mrc/include",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "generated_mrc_cc_headers",
|
||||
hdrs = glob(["src/generated/main/native/cpp/mrc/protobuf/**"]),
|
||||
hdrs = glob(["src/generated/main/native/cpp/mrc/protobuf/*.npb.h"]),
|
||||
includes = ["src/generated/main/native/cpp/mrc/protobuf"],
|
||||
strip_include_prefix = "src/generated/main/native/cpp/mrc/protobuf",
|
||||
visibility = ["//hal:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_java",
|
||||
srcs = glob(["src/generated/main/java/**/*.java"]),
|
||||
visibility = ["//hal:__subpackages__"],
|
||||
)
|
||||
|
||||
SYSTEMCORE_SRCS = glob(["src/main/native/systemcore/**"])
|
||||
@@ -84,7 +61,7 @@ filegroup(
|
||||
}),
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "wpiHal.static",
|
||||
srcs = [":platform-srcs"] + glob(
|
||||
[
|
||||
@@ -96,11 +73,12 @@ cc_library(
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = ["src/main/native/include"],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
third_party_header_only_libraries = [
|
||||
":mrc",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generated_cc_headers",
|
||||
":generated_mrc_cc_headers",
|
||||
":mrc_cc_headers",
|
||||
"//ntcore:ntcore.static",
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
@@ -132,10 +110,7 @@ wpilib_jni_java_library(
|
||||
cc_test(
|
||||
name = "hal-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob([
|
||||
"src/test/native/**/*.cpp",
|
||||
"src/test/native/**/*.h",
|
||||
]),
|
||||
srcs = glob(["src/test/native/**/*.cpp"]),
|
||||
deps = [
|
||||
":wpiHal.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
|
||||
@@ -9,7 +9,7 @@ def __generate_hal_impl(ctx):
|
||||
args.add("--nanopb", ctx.executable._nanopb_generator)
|
||||
|
||||
ctx.actions.run(
|
||||
inputs = ctx.attr._templates.files.to_list() + ctx.attr.proto_files.files.to_list(),
|
||||
inputs = ctx.attr.proto_files.files.to_list(),
|
||||
outputs = [output_dir],
|
||||
executable = ctx.executable._tool,
|
||||
arguments = [args],
|
||||
@@ -35,9 +35,6 @@ generate_hal = rule(
|
||||
cfg = "exec",
|
||||
executable = True,
|
||||
),
|
||||
"_templates": attr.label(
|
||||
default = Label("//hal:templates"),
|
||||
),
|
||||
"_tool": attr.label(
|
||||
default = Label("//hal:generate_nanopb"),
|
||||
cfg = "exec",
|
||||
|
||||
1313
maven_install.json
Executable file
1313
maven_install.json
Executable file
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,10 @@
|
||||
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_library", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//ntcore:generate_ntcore.bzl", "generate_ntcore")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_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")
|
||||
|
||||
@@ -28,7 +29,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
@@ -42,50 +42,40 @@ write_source_files(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "generated_cc_headers",
|
||||
hdrs = glob(["src/generated/main/native/include/**"]),
|
||||
includes = ["src/generated/main/native/include"],
|
||||
strip_include_prefix = "src/generated/main/native/include",
|
||||
visibility = ["//ntcore:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_cc_source",
|
||||
srcs = glob(
|
||||
["src/generated/main/native/cpp/**"],
|
||||
exclude = ["src/generated/main/native/cpp/jni/**"],
|
||||
),
|
||||
visibility = ["//ntcore:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "generated_cc",
|
||||
include_root = "src/generated/main/native/include",
|
||||
src_excludes = ["src/generated/main/native/cpp/jni/**"],
|
||||
src_root = "src/generated/main/native/cpp",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_jni",
|
||||
srcs = glob(["src/generated/main/native/cpp/jni/**"]),
|
||||
visibility = ["//ntcore:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_java",
|
||||
srcs = glob(["src/generated/main/java/**/*.java"]),
|
||||
visibility = ["//ntcore:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "ntcore.static",
|
||||
srcs = glob(
|
||||
["src/main/native/cpp/**"],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
) + [":generated_cc_source"],
|
||||
),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = [
|
||||
"src/main/native/cpp",
|
||||
"src/main/native/include",
|
||||
],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
third_party_libraries = [
|
||||
":generated_cc",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generated_cc_headers",
|
||||
"//datalog:datalog.static",
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
import edu.wpi.first.wpilibj.networktables.*;
|
||||
import edu.wpi.first.wpilibj.tables.*;
|
||||
|
||||
public class Client {
|
||||
private static class MyLogger implements NetworkTablesJNI.LoggerFunction {
|
||||
public void apply(int level, String file, int line, String msg) {
|
||||
System.err.println(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
NetworkTablesJNI.setLogger(new MyLogger(), 0);
|
||||
NetworkTable.setIPAddress("127.0.0.1");
|
||||
NetworkTable.setPort(10000);
|
||||
NetworkTable.setClientMode();
|
||||
NetworkTable nt = NetworkTable.getTable("");
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
try {
|
||||
System.out.println("Got foo: " + nt.getNumber("foo"));
|
||||
} catch (TableKeyNotDefinedException ex) {
|
||||
}
|
||||
nt.putBoolean("bar", false);
|
||||
nt.setFlags("bar", NetworkTable.PERSISTENT);
|
||||
nt.putBoolean("bar2", true);
|
||||
nt.putBoolean("bar2", false);
|
||||
nt.putBoolean("bar2", true);
|
||||
nt.putString("str", "hello world");
|
||||
double[] nums = new double[3];
|
||||
nums[0] = 0.5;
|
||||
nums[1] = 1.2;
|
||||
nums[2] = 3.0;
|
||||
nt.putNumberArray("numarray", nums);
|
||||
String[] strs = new String[2];
|
||||
strs[0] = "Hello";
|
||||
strs[1] = "World";
|
||||
nt.putStringArray("strarray", strs);
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
import edu.wpi.first.wpilibj.networktables.*;
|
||||
import edu.wpi.first.wpilibj.tables.*;
|
||||
|
||||
public class Server {
|
||||
private static class MyLogger implements NetworkTablesJNI.LoggerFunction {
|
||||
public void apply(int level, String file, int line, String msg) {
|
||||
System.err.println(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
NetworkTablesJNI.setLogger(new MyLogger(), 0);
|
||||
NetworkTable.setIPAddress("127.0.0.1");
|
||||
NetworkTable.setPort(10000);
|
||||
NetworkTable.setServerMode();
|
||||
NetworkTable nt = NetworkTable.getTable("");
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
nt.putNumber("foo", 0.5);
|
||||
nt.setFlags("foo", NetworkTable.PERSISTENT);
|
||||
nt.putNumber("foo2", 0.5);
|
||||
nt.putNumber("foo2", 0.7);
|
||||
nt.putNumber("foo2", 0.6);
|
||||
nt.putNumber("foo2", 0.5);
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <chrono>
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <thread>
|
||||
|
||||
#include "ntcore.h"
|
||||
|
||||
int main() {
|
||||
auto inst = nt::GetDefaultInstance();
|
||||
nt::AddLogger(
|
||||
inst,
|
||||
[](const nt::LogMessage& msg) {
|
||||
std::fputs(msg.message.c_str(), stderr);
|
||||
std::fputc('\n', stderr);
|
||||
},
|
||||
0, UINT_MAX);
|
||||
nt::StartClient(inst, "127.0.0.1", 10000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
|
||||
auto foo = nt::GetEntry(inst, "/foo");
|
||||
auto foo_val = nt::GetEntryValue(foo);
|
||||
if (foo_val && foo_val->IsDouble()) {
|
||||
std::printf("Got foo: %g\n", foo_val->GetDouble());
|
||||
}
|
||||
|
||||
auto bar = nt::GetEntry(inst, "/bar");
|
||||
nt::SetEntryValue(bar, nt::Value::MakeBoolean(false));
|
||||
nt::SetEntryFlags(bar, NT_PERSISTENT);
|
||||
|
||||
auto bar2 = nt::GetEntry(inst, "/bar2");
|
||||
nt::SetEntryValue(bar2, nt::Value::MakeBoolean(true));
|
||||
nt::SetEntryValue(bar2, nt::Value::MakeBoolean(false));
|
||||
nt::SetEntryValue(bar2, nt::Value::MakeBoolean(true));
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <chrono>
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <thread>
|
||||
|
||||
#include "ntcore.h"
|
||||
|
||||
int main() {
|
||||
auto inst = nt::GetDefaultInstance();
|
||||
nt::AddLogger(
|
||||
inst,
|
||||
[](const nt::LogMessage& msg) {
|
||||
std::fputs(msg.message.c_str(), stderr);
|
||||
std::fputc('\n', stderr);
|
||||
},
|
||||
0, UINT_MAX);
|
||||
nt::StartServer(inst, "persistent.ini", "", 10000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
auto foo = nt::GetEntry(inst, "/foo");
|
||||
nt::SetEntryValue(foo, nt::Value::MakeDouble(0.5));
|
||||
nt::SetEntryFlags(foo, NT_PERSISTENT);
|
||||
|
||||
auto foo2 = nt::GetEntry(inst, "/foo2");
|
||||
nt::SetEntryValue(foo2, nt::Value::MakeDouble(0.5));
|
||||
nt::SetEntryValue(foo2, nt::Value::MakeDouble(0.7));
|
||||
nt::SetEntryValue(foo2, nt::Value::MakeDouble(0.6));
|
||||
nt::SetEntryValue(foo2, nt::Value::MakeDouble(0.5));
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "romi-cpp.static",
|
||||
srcs = glob([
|
||||
"src/main/native/cpp/**",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
build:systemcore --config=base_linux
|
||||
|
||||
build:systemcore --platforms=@rules_bzlmodrio_toolchains//platforms/systemcore
|
||||
build:systemcore --build_tag_filters=-no-bookworm
|
||||
build:systemcore --build_tag_filters=-no-systemcore
|
||||
build:systemcore --features=compiler_param_file
|
||||
build:systemcore --platform_suffix=systemcore
|
||||
build:systemcore --incompatible_enable_cc_toolchain_resolution
|
||||
|
||||
60
shared/bazel/rules/cc_rules.bzl
Normal file
60
shared/bazel/rules/cc_rules.bzl
Normal file
@@ -0,0 +1,60 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def third_party_cc_lib_helper(
|
||||
name,
|
||||
include_root,
|
||||
src_root = None,
|
||||
src_excludes = [],
|
||||
visibility = None):
|
||||
"""
|
||||
Helper for src / headers pairs that aren't directly compiled, but rather pulled into a bigger library.
|
||||
|
||||
Due to allwpilibs directory structure of includes and sources living next to eachother, it often is required
|
||||
to make a header shim to deal with the include path, and a filegroup of the sources. This pattern is extermely
|
||||
common for the thirdparty libraries that live beneath certain libraries.
|
||||
|
||||
This will produce a library shim with the include path stripped, and a filegroup of sources.
|
||||
|
||||
Params
|
||||
include_root: The package relative path to the header files. This will be used to glob the files and strip the include prefix
|
||||
src_root: Optional. The package relative path to the source files.
|
||||
src_excludes: Optional. Used to exclude files from the src_root glob
|
||||
visibilty: The visibility of header shim / source files / package files
|
||||
"""
|
||||
cc_library(
|
||||
name = name + "-headers",
|
||||
hdrs = native.glob([
|
||||
include_root + "/**",
|
||||
]),
|
||||
includes = [include_root],
|
||||
strip_include_prefix = include_root,
|
||||
visibility = visibility,
|
||||
)
|
||||
|
||||
if src_root:
|
||||
native.filegroup(
|
||||
name = name + "-srcs",
|
||||
srcs = native.glob([src_root + "/**"], exclude = src_excludes),
|
||||
visibility = visibility,
|
||||
)
|
||||
|
||||
def wpilib_cc_library(
|
||||
name,
|
||||
srcs = [],
|
||||
deps = [],
|
||||
third_party_libraries = [],
|
||||
third_party_header_only_libraries = [],
|
||||
**kwargs):
|
||||
"""
|
||||
This function is used to ease the creation of a cc_library with helpers for handling thirdparty libraries in the standard allwpilib format.
|
||||
|
||||
Params:
|
||||
third_party_libraries: These are helper dependencies, created by third_party_cc_lib_helper. Header shims will be added as deps and src filegroups will be added to srcs
|
||||
third_party_header_only_libraries: Similar to third_party_libraries, but for shims that contain no sources
|
||||
"""
|
||||
cc_library(
|
||||
name = name,
|
||||
srcs = srcs + [lib + "-srcs" for lib in third_party_libraries],
|
||||
deps = deps + [lib + "-headers" for lib in third_party_libraries + third_party_header_only_libraries],
|
||||
**kwargs
|
||||
)
|
||||
@@ -3,6 +3,9 @@ load("@rules_python//python:defs.bzl", "py_binary")
|
||||
py_binary(
|
||||
name = "gen_resources",
|
||||
srcs = ["gen_resources.py"],
|
||||
tags = ["manual"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
18
shared/bazel/rules/halsim_library.bzl
Normal file
18
shared/bazel/rules/halsim_library.bzl
Normal file
@@ -0,0 +1,18 @@
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
|
||||
def wpilib_halsim_extension(
|
||||
name,
|
||||
**kwargs):
|
||||
"""
|
||||
Helper wrapper for creating a HALSIM extension. Provides some of the default argments for creating the library.
|
||||
"""
|
||||
wpilib_cc_library(
|
||||
name = name,
|
||||
includes = ["src/main/native/include"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
**kwargs
|
||||
)
|
||||
@@ -30,6 +30,6 @@ def wpilib_java_junit5_test(
|
||||
main_class = "org.junit.platform.console.ConsoleLauncher",
|
||||
use_testrunner = False,
|
||||
testonly = True,
|
||||
tags = tags + ["no-roborio", "no-bionic", "no-raspbian", "allwpilib-build-java", "no-asan", "no-tsan", "no-ubsan"],
|
||||
tags = tags + ["allwpilib-build-java", "no-asan", "no-tsan", "no-ubsan"],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@@ -81,7 +81,6 @@ def wpilib_jni_java_library(
|
||||
jni = "@rules_bzlmodrio_toolchains//jni"
|
||||
_jni_headers(
|
||||
name = headers_name,
|
||||
tags = ["manual"],
|
||||
jni = jni,
|
||||
lib = ":" + name,
|
||||
testonly = testonly,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("//shared/bazel/rules:halsim_library.bzl", "wpilib_halsim_extension")
|
||||
|
||||
cc_library(
|
||||
name = "headers",
|
||||
@@ -6,15 +7,9 @@ cc_library(
|
||||
includes = ["src/main/native/include"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_halsim_extension(
|
||||
name = "halsim_ds_socket",
|
||||
srcs = glob(["src/main/native/cpp/**"]),
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":headers",
|
||||
"//hal:wpiHal.static",
|
||||
@@ -25,10 +20,7 @@ cc_library(
|
||||
cc_test(
|
||||
name = "halsim_ds_socket-test",
|
||||
size = "small",
|
||||
srcs = glob([
|
||||
"src/test/native/**/*.cpp",
|
||||
"src/test/native/**/*.h",
|
||||
]),
|
||||
srcs = glob(["src/test/native/**/*.cpp"]),
|
||||
deps = [
|
||||
"//simulation/halsim_ds_socket",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("//shared/bazel/rules:halsim_library.bzl", "wpilib_halsim_extension")
|
||||
|
||||
cc_library(
|
||||
wpilib_halsim_extension(
|
||||
name = "halsim_gui",
|
||||
srcs = glob([
|
||||
"src/main/native/cpp/*",
|
||||
"src/main/native/include/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/include"],
|
||||
tags = [
|
||||
"wpi-cpp-gui",
|
||||
],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//glass:libglassnt",
|
||||
"//hal:wpiHal.static",
|
||||
@@ -25,10 +19,7 @@ cc_library(
|
||||
cc_test(
|
||||
name = "halsim_gui-test",
|
||||
size = "small",
|
||||
srcs = glob([
|
||||
"src/test/native/**/*.cpp",
|
||||
"src/test/native/**/*.h",
|
||||
]),
|
||||
srcs = glob(["src/test/native/**/*.cpp"]),
|
||||
tags = [
|
||||
"no-asan",
|
||||
"wpi-cpp-gui",
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//shared/bazel/rules:halsim_library.bzl", "wpilib_halsim_extension")
|
||||
|
||||
cc_library(
|
||||
wpilib_halsim_extension(
|
||||
name = "halsim_ws_client",
|
||||
srcs = glob([
|
||||
"src/main/native/cpp/*.cpp",
|
||||
"src/main/native/include/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/include"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//simulation/halsim_ws_core",
|
||||
],
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "halsim_ws_core",
|
||||
srcs = glob(["src/main/native/cpp/*.cpp"]),
|
||||
hdrs = glob([
|
||||
"src/main/native/include/*.h",
|
||||
"src/main/native/include/*.inc",
|
||||
]),
|
||||
hdrs = glob(["src/main/native/include/*.h"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("//shared/bazel/rules:halsim_library.bzl", "wpilib_halsim_extension")
|
||||
|
||||
cc_library(
|
||||
name = "headers",
|
||||
@@ -6,15 +7,9 @@ cc_library(
|
||||
includes = ["src/main/native/include"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_halsim_extension(
|
||||
name = "halsim_ws_server",
|
||||
srcs = glob(["src/main/native/cpp/**"]),
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":headers",
|
||||
"//simulation/halsim_ws_core",
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("//shared/bazel/rules:halsim_library.bzl", "wpilib_halsim_extension")
|
||||
|
||||
cc_library(
|
||||
wpilib_halsim_extension(
|
||||
name = "halsim_xrp",
|
||||
srcs = glob([
|
||||
"src/main/native/cpp/*",
|
||||
"src/main/native/include/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/include"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//simulation/halsim_ws_core",
|
||||
"//xrpVendordep:xrp-cpp",
|
||||
|
||||
@@ -6,7 +6,6 @@ generate_version_file(
|
||||
name = "generate-version",
|
||||
output_file = "WPILibVersion.cpp",
|
||||
template = "src/main/generate/WPILibVersion.cpp.in",
|
||||
visibility = ["//sysid:__subpackages__"],
|
||||
)
|
||||
|
||||
generate_resources(
|
||||
@@ -27,7 +26,6 @@ cc_library(
|
||||
],
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//sysid:__subpackages__"],
|
||||
deps = [
|
||||
"//datalog:datalog.static",
|
||||
"//glass:libglass",
|
||||
|
||||
4
thirdparty/googletest/BUILD.bazel
vendored
4
thirdparty/googletest/BUILD.bazel
vendored
@@ -1,6 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "googletest.static",
|
||||
srcs = glob(["src/**"]),
|
||||
hdrs = glob(["include/**"]),
|
||||
|
||||
20
thirdparty/imgui_suite/BUILD.bazel
vendored
20
thirdparty/imgui_suite/BUILD.bazel
vendored
@@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
load("//shared/bazel/rules:objectivec_rules.bzl", "wpilib_objc_library")
|
||||
|
||||
cc_library(
|
||||
@@ -168,7 +169,11 @@ cc_library(
|
||||
"@bazel_tools//src/conditions:windows": WINDOWS_DEFINES,
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": LINUX_DEFINES,
|
||||
}),
|
||||
tags = ["manual"],
|
||||
target_compatible_with = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
deps = [
|
||||
":glfw_hdrs",
|
||||
],
|
||||
@@ -203,7 +208,6 @@ cc_library(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//thirdparty/imgui_suite:__subpackages__"],
|
||||
deps = [":glfw_hdrs"] + select({
|
||||
"@bazel_tools//src/conditions:darwin": [":glfw_src_darwin"],
|
||||
"@bazel_tools//src/conditions:windows": [":glfw_src"],
|
||||
@@ -281,8 +285,11 @@ cc_library(
|
||||
],
|
||||
linkstatic = True,
|
||||
strip_include_prefix = "imgui/include",
|
||||
tags = ["manual"],
|
||||
visibility = ["//thirdparty/imgui_suite:__subpackages__"],
|
||||
target_compatible_with = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
deps = [
|
||||
":glfw",
|
||||
],
|
||||
@@ -305,7 +312,6 @@ wpilib_objc_library(
|
||||
|
||||
cc_library(
|
||||
name = "imgui",
|
||||
visibility = ["//thirdparty/imgui_suite:__subpackages__"],
|
||||
deps = select({
|
||||
"@bazel_tools//src/conditions:darwin": [":imgui_src_darwin"],
|
||||
"@bazel_tools//src/conditions:windows": [":imgui_src"],
|
||||
@@ -324,7 +330,6 @@ cc_library(
|
||||
includes = ["implot/include"],
|
||||
linkstatic = True,
|
||||
strip_include_prefix = "implot/include",
|
||||
visibility = ["//thirdparty/imgui_suite:__subpackages__"],
|
||||
deps = [
|
||||
"//thirdparty/imgui_suite:imgui",
|
||||
],
|
||||
@@ -340,13 +345,12 @@ cc_library(
|
||||
hdrs = glob(["stb/include/**"]),
|
||||
linkstatic = True,
|
||||
strip_include_prefix = "stb/include",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
#########################################
|
||||
# IMGUI suite
|
||||
#########################################
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "imgui_suite",
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:public"],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
load("//shared/bazel/rules:objectivec_rules.bzl", "wpilib_objc_library")
|
||||
|
||||
WIN_SRCS = glob(["src/main/native/directx11/**/*.cpp"])
|
||||
@@ -31,7 +32,7 @@ wpilib_objc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "wpigui",
|
||||
srcs = glob(["src/main/native/cpp/**/*.cpp"]) +
|
||||
select({
|
||||
|
||||
@@ -1,8 +1,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_library", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_library")
|
||||
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test")
|
||||
load("//wpilibNewCommands:generate.bzl", "generate_wpilib_new_commands")
|
||||
|
||||
@@ -10,11 +11,9 @@ py_binary(
|
||||
name = "generate_hids",
|
||||
srcs = ["generate_hids.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": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
@@ -23,7 +22,6 @@ filegroup(
|
||||
srcs = glob(["src/generate/main/**"]) + [
|
||||
"//wpilibj:hid_schema",
|
||||
],
|
||||
visibility = ["//wpilibNewCommands:__subpackages__"],
|
||||
)
|
||||
|
||||
generate_wpilib_new_commands(
|
||||
@@ -40,35 +38,28 @@ write_source_files(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "generated_cc_headers",
|
||||
hdrs = glob(["src/generated/main/native/include/**"]),
|
||||
includes = ["src/generated/main/native/include"],
|
||||
strip_include_prefix = "src/generated/main/native/include",
|
||||
visibility = ["//wpilibNewCommands:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_cc_source",
|
||||
srcs = glob(["src/generated/main/native/cpp/**"]),
|
||||
visibility = ["//wpilibNewCommands:__subpackages__"],
|
||||
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"]),
|
||||
visibility = ["//wpilibNewCommands:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "wpilibNewCommands.static",
|
||||
srcs = glob(["src/main/native/cpp/**"]) + [":generated_cc_source"],
|
||||
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 = [
|
||||
":generated_cc_headers",
|
||||
"//wpilibc:wpilibc.static",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -2,22 +2,27 @@ 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_library", "cc_test")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_library")
|
||||
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
|
||||
load("//wpilibc:generate.bzl", "generate_wpilibc")
|
||||
|
||||
py_binary(
|
||||
name = "generate_hids",
|
||||
srcs = ["generate_hids.py"],
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "generate_pwm_motor_controllers",
|
||||
srcs = ["generate_pwm_motor_controllers.py"],
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
@@ -30,7 +35,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generate_hids",
|
||||
":generate_pwm_motor_controllers",
|
||||
@@ -43,7 +47,6 @@ filegroup(
|
||||
"//wpilibj:hid_schema",
|
||||
"//wpilibj:pwm_schema",
|
||||
],
|
||||
visibility = ["//wpilibc:__subpackages__"],
|
||||
)
|
||||
|
||||
generate_wpilibc(
|
||||
@@ -54,7 +57,6 @@ generate_version_file(
|
||||
name = "generate-version",
|
||||
output_file = "WPILibVersion.cpp",
|
||||
template = "src/generate/WPILibVersion.cpp.in",
|
||||
visibility = ["//wpilibc:__subpackages__"],
|
||||
)
|
||||
|
||||
write_source_files(
|
||||
@@ -67,36 +69,27 @@ write_source_files(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "generated_cc_headers",
|
||||
hdrs = glob(["src/generated/main/native/include/**"]),
|
||||
includes = ["src/generated/main/native/include"],
|
||||
strip_include_prefix = "src/generated/main/native/include",
|
||||
visibility = ["//wpilibc:__subpackages__"],
|
||||
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_cc_source",
|
||||
srcs = glob(
|
||||
["src/generated/main/native/cpp/**"],
|
||||
exclude = ["src/generated/main/native/cpp/jni/**"],
|
||||
),
|
||||
visibility = ["//wpilibc:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "wpilibc.static",
|
||||
srcs = [
|
||||
":generate-version",
|
||||
] + glob([
|
||||
"src/main/native/cppcs/**",
|
||||
"src/main/native/cpp/**",
|
||||
]) + [":generated_cc_source"],
|
||||
]),
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
third_party_libraries = [
|
||||
":generated_cc",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generated_cc_headers",
|
||||
"//cameraserver:cameraserver.static",
|
||||
"//cscore:cscore.static",
|
||||
"//datalog:datalog.static",
|
||||
|
||||
@@ -5,13 +5,13 @@ def build_examples(halsim_deps = []):
|
||||
for folder in EXAMPLE_FOLDERS:
|
||||
cc_library(
|
||||
name = folder + "-examples-headers",
|
||||
hdrs = native.glob(["src/main/cpp/examples/" + folder + "/include/**/*.h"]),
|
||||
hdrs = native.glob(["src/main/cpp/examples/" + folder + "/include/**/*.h"], allow_empty = True),
|
||||
strip_include_prefix = "src/main/cpp/examples/" + folder + "/include",
|
||||
tags = ["wpi-example"],
|
||||
)
|
||||
cc_binary(
|
||||
name = folder + "-example",
|
||||
srcs = native.glob(["src/main/cpp/examples/" + folder + "/cpp/**/*.cpp", "src/main/cpp/examples/" + folder + "/c/**/*.c"]),
|
||||
srcs = native.glob(["src/main/cpp/examples/" + folder + "/cpp/**/*.cpp", "src/main/cpp/examples/" + folder + "/c/**/*.c"], allow_empty = True),
|
||||
deps = [
|
||||
"//wpilibNewCommands:wpilibNewCommands.static",
|
||||
"//apriltag:apriltag.static",
|
||||
@@ -40,7 +40,6 @@ def build_snippets():
|
||||
cc_library(
|
||||
name = folder + "-template",
|
||||
srcs = native.glob(["src/main/cpp/snippets/" + folder + "/**/*.cpp"]),
|
||||
hdrs = native.glob(["src/main/cpp/snippets/" + folder + "/**/*.h"]),
|
||||
deps = [
|
||||
"//wpilibNewCommands:wpilibNewCommands.static",
|
||||
],
|
||||
@@ -68,7 +67,7 @@ def build_tests():
|
||||
cc_test(
|
||||
name = folder + "-test",
|
||||
size = "small",
|
||||
srcs = native.glob([example_test_folder + "/**/*.cpp", example_src_folder + "/cpp/**/*.cpp", example_src_folder + "/c/**/*.c"]),
|
||||
srcs = native.glob([example_test_folder + "/**/*.cpp", example_src_folder + "/cpp/**/*.cpp", example_src_folder + "/c/**/*.c"], allow_empty = True),
|
||||
deps = [
|
||||
"//wpilibNewCommands:wpilibNewCommands.static",
|
||||
":{}-examples-headers".format(folder),
|
||||
|
||||
@@ -91,5 +91,12 @@ TEMPLATES_FOLDERS = [
|
||||
]
|
||||
|
||||
TESTS_FOLDERS = [
|
||||
"ArmSimulation",
|
||||
"DigitalCommunication",
|
||||
"ElevatorSimulation",
|
||||
"I2CCommunication",
|
||||
"MecanumControllerCommand",
|
||||
"PotentiometerPID",
|
||||
"SwerveControllerCommand",
|
||||
"UnitTest",
|
||||
]
|
||||
|
||||
@@ -164,7 +164,8 @@
|
||||
],
|
||||
"foldername": "PotentiometerPID",
|
||||
"gradlebase": "cpp",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "Elevator with exponential profiled PID",
|
||||
@@ -257,7 +258,8 @@
|
||||
],
|
||||
"foldername": "I2CCommunication",
|
||||
"gradlebase": "cpp",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "Digital Communication Sample",
|
||||
@@ -268,7 +270,8 @@
|
||||
],
|
||||
"foldername": "DigitalCommunication",
|
||||
"gradlebase": "cpp",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "HTTP Camera",
|
||||
@@ -474,7 +477,8 @@
|
||||
],
|
||||
"foldername": "MecanumControllerCommand",
|
||||
"gradlebase": "cpp",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "SwerveControllerCommand",
|
||||
@@ -491,7 +495,8 @@
|
||||
],
|
||||
"foldername": "SwerveControllerCommand",
|
||||
"gradlebase": "cpp",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "DriveDistanceOffboard",
|
||||
@@ -615,7 +620,8 @@
|
||||
],
|
||||
"foldername": "ElevatorSimulation",
|
||||
"gradlebase": "cpp",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "Elevator Exponential Profile Simulation",
|
||||
@@ -675,7 +681,8 @@
|
||||
],
|
||||
"foldername": "ArmSimulation",
|
||||
"gradlebase": "cpp",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "UnitTesting",
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include <frc/simulation/DriverStationSim.h>
|
||||
#include <frc/simulation/SimHooks.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <units/time.h>
|
||||
|
||||
#include "Robot.h"
|
||||
|
||||
class MecanumControllerCommandTest : public testing::Test {
|
||||
Robot m_robot;
|
||||
std::optional<std::thread> m_thread;
|
||||
bool joystickWarning;
|
||||
|
||||
public:
|
||||
void SetUp() override {
|
||||
frc::sim::PauseTiming();
|
||||
joystickWarning = frc::DriverStation::IsJoystickConnectionWarningSilenced();
|
||||
frc::DriverStation::SilenceJoystickConnectionWarning(true);
|
||||
|
||||
m_thread = std::thread([&] { m_robot.StartCompetition(); });
|
||||
frc::sim::StepTiming(0.0_ms); // Wait for Notifiers
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
m_robot.EndCompetition();
|
||||
m_thread->join();
|
||||
|
||||
frc::sim::DriverStationSim::ResetData();
|
||||
frc::DriverStation::SilenceJoystickConnectionWarning(joystickWarning);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(MecanumControllerCommandTest, Match) {
|
||||
// auto
|
||||
frc::sim::DriverStationSim::SetAutonomous(true);
|
||||
frc::sim::DriverStationSim::SetEnabled(true);
|
||||
frc::sim::DriverStationSim::NotifyNewData();
|
||||
|
||||
frc::sim::StepTiming(15_s);
|
||||
|
||||
// brief disabled period- exact duration shouldn't matter
|
||||
frc::sim::DriverStationSim::SetAutonomous(false);
|
||||
frc::sim::DriverStationSim::SetEnabled(false);
|
||||
frc::sim::DriverStationSim::NotifyNewData();
|
||||
|
||||
frc::sim::StepTiming(3_s);
|
||||
|
||||
// teleop
|
||||
frc::sim::DriverStationSim::SetAutonomous(false);
|
||||
frc::sim::DriverStationSim::SetEnabled(true);
|
||||
frc::sim::DriverStationSim::NotifyNewData();
|
||||
|
||||
frc::sim::StepTiming(135_s);
|
||||
|
||||
// end of match
|
||||
frc::sim::DriverStationSim::SetAutonomous(false);
|
||||
frc::sim::DriverStationSim::SetEnabled(false);
|
||||
frc::sim::DriverStationSim::NotifyNewData();
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <hal/HALBase.h>
|
||||
|
||||
/**
|
||||
* Runs all unit tests.
|
||||
*/
|
||||
int main(int argc, char** argv) {
|
||||
HAL_Initialize(500, 0);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
int ret = RUN_ALL_TESTS();
|
||||
return ret;
|
||||
}
|
||||
@@ -15,7 +15,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
@@ -27,7 +26,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
@@ -40,7 +38,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generate_hids",
|
||||
":generate_pwm_motor_controllers",
|
||||
@@ -65,13 +62,11 @@ generate_version_file(
|
||||
name = "generate-version",
|
||||
output_file = "WPILibVersion.java",
|
||||
template = "src/generate/WPILibVersion.java.in",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "generated_java",
|
||||
srcs = glob(["src/generated/main/java/**/*.java"]),
|
||||
visibility = ["//wpilibj:__subpackages__"],
|
||||
)
|
||||
|
||||
java_library(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//wpilibjExamples:build_java_examples.bzl", "build_commands", "build_examples", "build_snippets", "build_templates")
|
||||
load("//wpilibjExamples:build_java_examples.bzl", "build_commands", "build_examples", "build_snippets", "build_templates", "build_tests")
|
||||
|
||||
py_binary(
|
||||
name = "generate_bazel_files",
|
||||
@@ -44,3 +44,5 @@ build_examples(halsim_deps = halsim_deps)
|
||||
build_snippets()
|
||||
|
||||
build_templates()
|
||||
|
||||
build_tests()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("//wpilibjExamples:example_projects.bzl", "COMMANDS_V2_FOLDERS", "EXAMPLES_FOLDERS", "SNIPPETS_FOLDERS", "TEMPLATES_FOLDERS")
|
||||
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test")
|
||||
load("//wpilibjExamples:example_projects.bzl", "COMMANDS_V2_FOLDERS", "EXAMPLES_FOLDERS", "SNIPPETS_FOLDERS", "TEMPLATES_FOLDERS", "TEST_FOLDERS")
|
||||
|
||||
def build_examples(halsim_deps):
|
||||
for folder in EXAMPLES_FOLDERS:
|
||||
@@ -69,3 +70,20 @@ def build_templates():
|
||||
],
|
||||
tags = ["wpi-example"],
|
||||
)
|
||||
|
||||
def build_tests():
|
||||
for folder in TEST_FOLDERS:
|
||||
wpilib_java_junit5_test(
|
||||
name = folder + "-test",
|
||||
srcs = native.glob(["src/test/java/edu/wpi/first/wpilibj/examples/" + folder + "/**/*.java"]),
|
||||
deps = [
|
||||
":" + folder + "-example",
|
||||
"//hal:hal-java",
|
||||
"//ntcore:networktables-java",
|
||||
"//wpilibj:wpilibj",
|
||||
"//wpilibNewCommands:wpilibNewCommands-java",
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
tags = ["wpi-example"],
|
||||
)
|
||||
|
||||
@@ -97,5 +97,10 @@ TEMPLATES_FOLDERS = [
|
||||
]
|
||||
|
||||
TEST_FOLDERS = [
|
||||
"armsimulation",
|
||||
"digitalcommunication",
|
||||
"elevatorsimulation",
|
||||
"i2ccommunication",
|
||||
"potentiometerpid",
|
||||
"unittest",
|
||||
]
|
||||
|
||||
@@ -114,7 +114,8 @@
|
||||
"foldername": "potentiometerpid",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "Elevator with trapezoid profiled PID",
|
||||
@@ -607,7 +608,8 @@
|
||||
"foldername": "elevatorsimulation",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "Elevator Exponential Profile Simulation",
|
||||
@@ -640,7 +642,8 @@
|
||||
"foldername": "armsimulation",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main",
|
||||
"commandversion": 2
|
||||
"commandversion": 2,
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "UnitTesting",
|
||||
@@ -749,7 +752,8 @@
|
||||
"foldername": "digitalcommunication",
|
||||
"gradlebase": "java",
|
||||
"commandversion": 2,
|
||||
"mainclass": "Main"
|
||||
"mainclass": "Main",
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "I2C Communication Sample",
|
||||
@@ -761,7 +765,8 @@
|
||||
"foldername": "i2ccommunication",
|
||||
"gradlebase": "java",
|
||||
"commandversion": 2,
|
||||
"mainclass": "Main"
|
||||
"mainclass": "Main",
|
||||
"hasunittests": true
|
||||
},
|
||||
{
|
||||
"name": "Flywheel BangBangController",
|
||||
|
||||
@@ -3,6 +3,7 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_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("//wpimath:generate.bzl", "generate_wpimath")
|
||||
@@ -25,7 +26,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
@@ -37,7 +37,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
@@ -49,7 +48,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
@@ -61,7 +59,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":generate_nanopb",
|
||||
":generate_numbers",
|
||||
@@ -87,43 +84,22 @@ write_source_files(
|
||||
filegroup(
|
||||
name = "generated_java",
|
||||
srcs = glob(["src/generated/main/java/**/*.java"]),
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "eigen-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/eigen/include/**",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/eigen/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/eigen/include",
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "eigen",
|
||||
include_root = "src/main/native/thirdparty/eigen/include",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
third_party_cc_lib_helper(
|
||||
name = "gcem",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/gcem/include/**",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/gcem/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/gcem/include",
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
include_root = "src/main/native/thirdparty/gcem/include",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "sleipnir-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/sleipnir/include/**/*.hpp",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/sleipnir/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/sleipnir/include",
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "sleipnir-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/sleipnir/src/**"]),
|
||||
visibility = ["//wpimath:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "sleipnir",
|
||||
include_root = "src/main/native/thirdparty/sleipnir/include",
|
||||
src_root = "src/main/native/thirdparty/sleipnir/src",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@@ -131,10 +107,9 @@ cc_library(
|
||||
hdrs = glob(["src/generated/main/native/cpp/**/*.h"]),
|
||||
includes = ["src/generated/main/native/cpp"],
|
||||
strip_include_prefix = "src/generated/main/native/cpp",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "wpimath.static",
|
||||
srcs = glob(
|
||||
[
|
||||
@@ -142,7 +117,7 @@ cc_library(
|
||||
"src/generated/main/native/cpp/**/*.cpp",
|
||||
],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
) + [":sleipnir-srcs"],
|
||||
),
|
||||
hdrs = glob(["src/main/native/include/**"]),
|
||||
defines = ["WPILIB_EXPORTS"],
|
||||
includes = [
|
||||
@@ -150,12 +125,16 @@ cc_library(
|
||||
"src/main/native/thirdparty/sleipnir/src",
|
||||
],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
third_party_header_only_libraries = [
|
||||
":eigen",
|
||||
":gcem",
|
||||
],
|
||||
third_party_libraries = [
|
||||
":sleipnir",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":eigen-headers",
|
||||
":gcem",
|
||||
":nanopb-generated-headers",
|
||||
":sleipnir-headers",
|
||||
"//wpiutil:wpiutil.static",
|
||||
],
|
||||
)
|
||||
@@ -203,10 +182,6 @@ cc_test(
|
||||
"src/test/native/cpp/**/*.cpp",
|
||||
"src/test/native/cpp/**/*.h",
|
||||
]),
|
||||
tags = [
|
||||
"no-bullseye",
|
||||
"no-raspi",
|
||||
],
|
||||
deps = [
|
||||
":test_headers",
|
||||
":wpimath.static",
|
||||
@@ -247,5 +222,8 @@ java_binary(
|
||||
py_binary(
|
||||
name = "ExponentialProfileModel",
|
||||
srcs = ["algorithms/ExponentialProfileModel.py"],
|
||||
tags = ["manual"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_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/gen:gen-resources.bzl", "generate_resources")
|
||||
@@ -55,7 +56,6 @@ cc_library(
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/libuv/src"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/libuv/include",
|
||||
visibility = ["//wpinet:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@@ -69,23 +69,12 @@ filegroup(
|
||||
"@bazel_tools//src/conditions:windows": WIN_UV_SRCS,
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": LINUX_UV_SRCS,
|
||||
}) + glob(["src/main/native/thirdparty/libuv/src/*"]),
|
||||
visibility = ["//wpinet:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "tcpsockets-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/tcpsockets/include/**/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/tcpsockets/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/tcpsockets/include",
|
||||
visibility = ["//wpinet:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "tcpsockets-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/tcpsockets/cpp/**"]),
|
||||
visibility = ["//wpinet:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "tcpsockets",
|
||||
include_root = "src/main/native/thirdparty/tcpsockets/include",
|
||||
src_root = "src/main/native/thirdparty/tcpsockets/cpp",
|
||||
)
|
||||
|
||||
generate_resources(
|
||||
@@ -112,14 +101,13 @@ cc_library(
|
||||
strip_include_prefix = "src/main/native/cpp",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "wpinet.static",
|
||||
srcs = glob(
|
||||
["src/main/native/cpp/**"],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
) + [
|
||||
":libuv-srcs",
|
||||
":tcpsockets-srcs",
|
||||
] + ["native-srcs"],
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
implementation_deps = [
|
||||
@@ -131,10 +119,12 @@ cc_library(
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
third_party_libraries = [
|
||||
":tcpsockets",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":libuv-headers",
|
||||
":tcpsockets-headers",
|
||||
"//wpiutil:wpiutil.static",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -9,8 +9,10 @@ py_binary(
|
||||
name = "generate_units",
|
||||
srcs = ["generate_units.py"],
|
||||
data = glob(["src/generate/main/java/**"]),
|
||||
tags = ["manual"],
|
||||
visibility = ["//visibility:public"],
|
||||
target_compatible_with = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [requirement("jinja2")],
|
||||
)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "third_party_cc_lib_helper", "wpilib_cc_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/gen:gen-resources.bzl", "generate_resources")
|
||||
@@ -33,7 +34,6 @@ py_binary(
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@@ -56,168 +56,66 @@ write_source_files(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "argparse-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/argparse/include/**/*",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/argparse/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/argparse/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "argparse",
|
||||
include_root = "src/main/native/thirdparty/argparse/include",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "debugging-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/debugging/include/**/*",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/debugging/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/debugging/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "debugging",
|
||||
include_root = "src/main/native/thirdparty/debugging/include",
|
||||
src_root = "src/main/native/thirdparty/debugging/src",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "debugging-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/debugging/src/**"]),
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "expected",
|
||||
include_root = "src/main/native/thirdparty/expected/include",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "expected-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/expected/include/**/*",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/expected/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/expected/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "fmtlib",
|
||||
include_root = "src/main/native/thirdparty/fmtlib/include",
|
||||
src_root = "src/main/native/thirdparty/fmtlib/src",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "concurrentqueue-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/concurrentqueue/include/**/*",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/concurrentqueue/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/concurrentqueue/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "json",
|
||||
include_root = "src/main/native/thirdparty/json/include",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "fmtlib-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/fmtlib/include/**/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/fmtlib/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/fmtlib/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "llvm",
|
||||
include_root = "src/main/native/thirdparty/llvm/include",
|
||||
src_root = "src/main/native/thirdparty/llvm/cpp",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "fmtlib-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/fmtlib/src/**"]),
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "memory",
|
||||
include_root = "src/main/native/thirdparty/memory/include",
|
||||
src_root = "src/main/native/thirdparty/memory/src",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "json-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/json/include/**/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/json/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/json/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "mpack",
|
||||
include_root = "src/main/native/thirdparty/mpack/include",
|
||||
src_root = "src/main/native/thirdparty/mpack/src",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "llvm-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/llvm/include/**/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/llvm/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/llvm/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "protobuf",
|
||||
include_root = "src/main/native/thirdparty/protobuf/include",
|
||||
src_root = "src/main/native/thirdparty/protobuf/src",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "llvm-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/llvm/cpp/**"]),
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "nanopb",
|
||||
include_root = "src/main/native/thirdparty/nanopb/include",
|
||||
src_root = "src/main/native/thirdparty/nanopb/src",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "memory-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/memory/include/**/*.hpp",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/memory/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/memory/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "memory-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/memory/src/**"]),
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "mpack-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/mpack/include/**/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/mpack/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/mpack/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "mpack-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/mpack/src/**"]),
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "protobuf-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/protobuf/include/**/*.h",
|
||||
"src/main/native/thirdparty/protobuf/include/**/*.inc",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/protobuf/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/protobuf/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "protobuf-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/protobuf/src/**"]),
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "nanopb-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/nanopb/include/**/*.h",
|
||||
"src/main/native/thirdparty/nanopb/include/**/*.inc",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/nanopb/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/nanopb/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "nanopb-srcs",
|
||||
srcs = glob(["src/main/native/thirdparty/nanopb/src/**"]),
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "sigslot-headers",
|
||||
hdrs = glob([
|
||||
"src/main/native/thirdparty/sigslot/include/**/*.h",
|
||||
]),
|
||||
includes = ["src/main/native/thirdparty/sigslot/include"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/sigslot/include",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
third_party_cc_lib_helper(
|
||||
name = "sigslot",
|
||||
include_root = "src/main/native/thirdparty/sigslot/include",
|
||||
)
|
||||
|
||||
generate_resources(
|
||||
@@ -230,48 +128,40 @@ generate_resources(
|
||||
filegroup(
|
||||
name = "native-srcs",
|
||||
srcs = select({
|
||||
"@bazel_tools//src/conditions:windows": glob([
|
||||
"src/main/native/windows/*.cpp",
|
||||
"src/main/native/windows/*.h",
|
||||
]),
|
||||
"@bazel_tools//src/conditions:windows": glob(["src/main/native/windows/*.cpp"]),
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_unix": glob(["src/main/native/unix/*.cpp"]),
|
||||
}),
|
||||
)
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "wpiutil.static",
|
||||
srcs = glob(
|
||||
["src/main/native/cpp/**"],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
) + [
|
||||
":debugging-srcs",
|
||||
":fmtlib-srcs",
|
||||
":generate-resources",
|
||||
":llvm-srcs",
|
||||
":memory-srcs",
|
||||
":mpack-srcs",
|
||||
":nanopb-srcs",
|
||||
":native-srcs",
|
||||
":protobuf-srcs",
|
||||
],
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = ["src/main/native/include"],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
third_party_header_only_libraries = [
|
||||
":argparse",
|
||||
":expected",
|
||||
":json",
|
||||
":sigslot",
|
||||
],
|
||||
third_party_libraries = [
|
||||
":debugging",
|
||||
":fmtlib",
|
||||
":llvm",
|
||||
":memory",
|
||||
":mpack",
|
||||
":nanopb",
|
||||
":protobuf",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":argparse-headers",
|
||||
":concurrentqueue-headers",
|
||||
":debugging-headers",
|
||||
":expected-headers",
|
||||
":fmtlib-headers",
|
||||
":json-headers",
|
||||
":llvm-headers",
|
||||
":memory-headers",
|
||||
":mpack-headers",
|
||||
":nanopb-headers",
|
||||
":protobuf-headers",
|
||||
":sigslot-headers",
|
||||
] + select({
|
||||
deps = select({
|
||||
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": ["@bzlmodrio-ni//libraries/cpp/ni:shared"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
@@ -312,7 +202,6 @@ cc_library(
|
||||
hdrs = glob(["src/generated/test/native/cpp/*.h"]),
|
||||
includes = ["src/generated/test/native/cpp"],
|
||||
strip_include_prefix = "src/generated/test/native/cpp",
|
||||
visibility = ["//wpiutil:__subpackages__"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library")
|
||||
|
||||
cc_library(
|
||||
wpilib_cc_library(
|
||||
name = "xrp-cpp",
|
||||
srcs = glob([
|
||||
"src/main/native/cpp/**",
|
||||
|
||||
Reference in New Issue
Block a user