Skip to content

Commit

Permalink
Merge branch 'main' into gui-add-deep-dark-style
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Sep 28, 2024
2 parents a41a418 + d389317 commit 5cd7610
Show file tree
Hide file tree
Showing 705 changed files with 10,416 additions and 7,760 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/comment-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
distribution: 'temurin'
java-version: 17
- name: Install wpiformat
run: pip3 install wpiformat==2024.40
run: pip3 install wpiformat==2024.41
- name: Run wpiformat
run: wpiformat
- name: Run spotlessApply
Expand Down Expand Up @@ -89,20 +89,8 @@ jobs:
run: python -m pip install jinja2
- name: Install protobuf dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler && wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe && chmod +x protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Run hal
run: ./hal/generate_usage_reporting.py
- name: Run ntcore
run: ./ntcore/generate_topics.py
- name: Run wpimath
run: ./wpimath/generate_numbers.py && ./wpimath/generate_quickbuf.py --quickbuf_plugin=protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Run HIDs
run: ./wpilibj/generate_hids.py && ./wpilibc/generate_hids.py && ./wpilibNewCommands/generate_hids.py
- name: Run PWM Controllers
run: ./wpilibj/generate_pwm_motor_controllers.py && ./wpilibc/generate_pwm_motor_controllers.py
- name: Run imgui gl3w
run: ./thirdparty/imgui_suite/generate_gl3w.py
- name: Run imgui fonts
run: ./thirdparty/imgui_suite/generate_fonts.sh
- name: Regenerate all
run: ./.github/workflows/pregen_all.py --quickbuf_plugin=protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Commit
run: |
# Set credentials
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
python-version: '3.10'
- name: Install wpiformat
run: pip3 install wpiformat==2024.40
run: pip3 install wpiformat==2024.41
- name: Run
run: wpiformat
- name: Check output
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
with:
python-version: '3.10'
- name: Install wpiformat
run: pip3 install wpiformat==2024.40
run: pip3 install wpiformat==2024.41
- name: Create compile_commands.json
run: |
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/pregen_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3

import argparse
import subprocess
import sys
from pathlib import Path


def main(argv):
script_path = Path(__file__).resolve()
REPO_ROOT = script_path.parent.parent.parent
parser = argparse.ArgumentParser()
parser.add_argument(
"--quickbuf_plugin",
help="Path to the quickbuf protoc plugin",
required=True,
)
args = parser.parse_args(argv)
subprocess.run(["python", f"{REPO_ROOT}/hal/generate_usage_reporting.py"])
subprocess.run(["python", f"{REPO_ROOT}/ntcore/generate_topics.py"])
subprocess.run(["python", f"{REPO_ROOT}/wpimath/generate_numbers.py"])
subprocess.run(
[
"python",
f"{REPO_ROOT}/wpimath/generate_quickbuf.py",
f"--quickbuf_plugin={args.quickbuf_plugin}",
]
)
subprocess.run(["python", f"{REPO_ROOT}/wpiunits/generate_units.py"])
subprocess.run(["python", f"{REPO_ROOT}/wpilibc/generate_hids.py"])
subprocess.run(["python", f"{REPO_ROOT}/wpilibj/generate_hids.py"])
subprocess.run(["python", f"{REPO_ROOT}/wpilibNewCommands/generate_hids.py"])
subprocess.run(["python", f"{REPO_ROOT}/wpilibc/generate_pwm_motor_controllers.py"])
subprocess.run(["python", f"{REPO_ROOT}/wpilibj/generate_pwm_motor_controllers.py"])
subprocess.run(["python", f"{REPO_ROOT}/thirdparty/imgui_suite/generate_gl3w.py"])
subprocess.run(f"{REPO_ROOT}/thirdparty/imgui_suite/generate_fonts.sh")


if __name__ == "__main__":
main(sys.argv[1:])
18 changes: 2 additions & 16 deletions .github/workflows/pregenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,8 @@ jobs:
run: python -m pip install jinja2
- name: Install protobuf dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler && wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe && chmod +x protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Run hal
run: ./hal/generate_usage_reporting.py
- name: Run ntcore
run: ./ntcore/generate_topics.py
- name: Run wpimath
run: ./wpimath/generate_numbers.py && ./wpimath/generate_quickbuf.py --quickbuf_plugin=protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Run wpiunits
run: ./wpiunits/generate_units.py
- name: Run HIDs
run: ./wpilibj/generate_hids.py && ./wpilibc/generate_hids.py && ./wpilibNewCommands/generate_hids.py
- name: Run PWM Controllers
run: ./wpilibj/generate_pwm_motor_controllers.py && ./wpilibc/generate_pwm_motor_controllers.py
- name: Run imgui gl3w
run: ./thirdparty/imgui_suite/generate_gl3w.py
- name: Run imgui fonts
run: ./thirdparty/imgui_suite/generate_fonts.sh
- name: Regenerate all
run: python ./.github/workflows/pregen_all.py --quickbuf_plugin protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
image: wpilib/roborio-cross-ubuntu:2024-22.04
options: -v ${{ github.workspace }}:/work -w /work -e GITHUB_REF -e CI -e DISPLAY
run: df . && rm -f semicolon_delimited_script && ./gradlew :wpilibc:publish :wpilibj:publish :wpilibNewCommands:publish :hal:publish :cameraserver:publish :ntcore:publish :cscore:publish :wpimath:publish :wpinet:publish :wpiutil:publish :apriltag:publish :wpiunits:publish :simulation:halsim_gui:publish :simulation:halsim_ds_socket:publish :fieldImages:publish -x test -x Javadoc -x doxygen --build-cache && cp -r /root/releases/maven/development /work
run: df . && rm -f semicolon_delimited_script && ./gradlew :wpilibc:publish :wpilibj:publish :wpilibNewCommands:publish :hal:publish :cameraserver:publish :ntcore:publish :cscore:publish :wpimath:publish :wpinet:publish :wpiutil:publish :apriltag:publish :wpiunits:publish :simulation:halsim_gui:publish :simulation:halsim_ds_socket:publish :fieldImages:publish :epilogue-processor:publish :epilogue-runtime:publish :thirdparty:googletest:publish -x test -x Javadoc -x doxygen --build-cache && cp -r /root/releases/maven/development /work
- uses: actions/upload-artifact@v4
with:
name: MavenArtifacts
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ compile_commands.json

# clang configuration and clangd cache
.clang
.clangd/
.clangd
.cache/

imgui.ini
Expand Down
3 changes: 2 additions & 1 deletion .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ includeOtherLibs {
^cameraserver/
^cscore
^fmt/
^gtest/
^glass/
^google/
^gtest/
^hal/
^imgui
^implot
Expand Down
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ option(WITH_EXAMPLES "Build examples" OFF)
option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
option(WITH_GUI "Build GUI items" ON)
option(WITH_SIMULATION_MODULES "Build simulation modules" ON)
option(WITH_PROTOBUF "Build protobuf support" ON)

# Options for using a package manager (e.g., vcpkg) for certain dependencies.
option(USE_SYSTEM_FMTLIB "Use system fmtlib" OFF)
Expand Down Expand Up @@ -128,12 +129,14 @@ else()
find_package(Java REQUIRED COMPONENTS Runtime)
endif()

find_package(LIBSSH 0.7.1)
find_package(LIBSSH CONFIG 0.7.1)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "" FORCE)
find_package(Protobuf REQUIRED)
find_program(PROTOC_COMPILER protoc REQUIRED)
if(WITH_PROTOBUF)
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "" FORCE)
find_package(Protobuf REQUIRED)
find_program(PROTOC_COMPILER protoc REQUIRED)
endif()
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)

get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion apriltag/src/main/native/cpp/AprilTagDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "frc/apriltag/AprilTagDetector.h"

#include <cmath>
#include <numbers>
#include <utility>

#ifdef _WIN32
#pragma warning(disable : 4200)
Expand Down
10 changes: 5 additions & 5 deletions apriltag/src/main/native/cpp/AprilTagFieldLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "frc/apriltag/AprilTagFieldLayout.h"

#include <system_error>
#include <utility>
#include <vector>

#include <units/angle.h>
#include <units/length.h>
Expand All @@ -15,14 +17,12 @@
using namespace frc;

AprilTagFieldLayout::AprilTagFieldLayout(std::string_view path) {
std::error_code ec;
std::unique_ptr<wpi::MemoryBuffer> fileBuffer =
wpi::MemoryBuffer::GetFile(path, ec);
if (fileBuffer == nullptr || ec) {
auto fileBuffer = wpi::MemoryBuffer::GetFile(path);
if (!fileBuffer) {
throw std::runtime_error(fmt::format("Cannot open file: {}", path));
}

wpi::json json = wpi::json::parse(fileBuffer->GetCharBuffer());
wpi::json json = wpi::json::parse(fileBuffer.value()->GetCharBuffer());

for (const auto& tag : json.at("tags").get<std::vector<AprilTag>>()) {
m_apriltags[tag.ID] = tag;
Expand Down
2 changes: 2 additions & 0 deletions apriltag/src/test/native/cpp/LoadConfigTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// 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 <vector>

#include <gtest/gtest.h>

#include "frc/apriltag/AprilTagFieldLayout.h"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ repositories {
}
}
dependencies {
implementation "edu.wpi.first:native-utils:2025.2.0"
implementation "edu.wpi.first:native-utils:2025.3.0"
}
12 changes: 6 additions & 6 deletions cameraserver/multiCameraServer/src/main/native/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <string>
#include <string_view>
#include <thread>
#include <utility>
#include <vector>

#include <networktables/NetworkTableInstance.h>
Expand Down Expand Up @@ -94,18 +95,17 @@ bool ReadCameraConfig(const wpi::json& config) {

bool ReadConfig() {
// open config file
std::error_code ec;
std::unique_ptr<wpi::MemoryBuffer> fileBuffer =
wpi::MemoryBuffer::GetFile(configFile, ec);
if (fileBuffer == nullptr || ec) {
wpi::print(stderr, "could not open '{}': {}\n", configFile, ec.message());
auto fileBuffer = wpi::MemoryBuffer::GetFile(configFile);
if (!fileBuffer) {
wpi::print(stderr, "could not open '{}': {}\n", configFile,
fileBuffer.error().message());
return false;
}

// parse file
wpi::json j;
try {
j = wpi::json::parse(fileBuffer->GetCharBuffer());
j = wpi::json::parse(fileBuffer.value()->GetCharBuffer());
} catch (const wpi::json::parse_error& e) {
wpi::print(stderr, "config error in '{}': byte {}: {}\n", configFile,
e.byte, e.what());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "cameraserver/CameraServer.h"

#include <atomic>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include <fmt/format.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include "cameraserver/CameraServerShared.h"

#include <memory>
#include <utility>

#include <wpi/mutex.h>

namespace {
Expand Down
1 change: 1 addition & 0 deletions cameraserver/src/main/native/cpp/vision/VisionRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "vision/VisionRunner.h"

#include <memory>
#include <thread>

#include <opencv2/core/mat.hpp>
Expand Down
3 changes: 3 additions & 0 deletions cmake/modules/AddTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ include(CompileWarnings)

macro(wpilib_add_test name srcdir)
file(GLOB_RECURSE test_src ${srcdir}/*.cpp)
if(NOT WITH_PROTOBUF)
list(FILTER test_src EXCLUDE REGEX "/proto/")
endif()
add_executable(${name}_test ${test_src})
set_property(TARGET ${name}_test PROPERTY FOLDER "tests")
wpilib_target_warnings(${name}_test)
Expand Down
Loading

0 comments on commit 5cd7610

Please sign in to comment.